Infrastructure

Globe is built on top of multiple cloud compute providers to provide a scalable and reliable service. The following sections provide an overview of the infrastructure used to run Globe & how you can integrate your Dart applications.

How it works

Each time you create a new successful deployment, the Globe deployment service creates an executable of your Dart project. This executable is distributed to our global private deployment registry.

When a user makes a request to your application, they first end up connecting to our global edge network (300+ locations). Our edge network provides zero latency routing management and allows us to route your user to the nearest Globe compute region where our infrastructure will start a container in isolation on demand if necessary.

Our edge network routing service is also responsible for features such as DDoS mitigation, instant rollbacks, A/B testing deployments and more.

Architecture

Globe uses a custom made runner technology to start your Dart applications on demand in a sandbox environment. The platform will automatically scale your application based on the number of requests it receives. Runners are created on demand in the closest region to where a user request originates from.

Key Details

  • Architecture: Your Dart code is compiled for the x86_64 architecture.
  • FFI (Foreign Function Interface): If your application depends on FFI, ensure that the associated code or libraries are also compiled for the x86_64 architecture. Note that some syscalls may not be permitted in the runtime environment. If a particular syscall is critical to your application’s functionality, please submit an issue.

Benefits

  • Unlimited Scale: Theoretically scale to handle any amount of traffic.
  • Fully Managed Backend Infrastructure: No need to configure or manage servers, networking, or scaling—everything is handled automatically.

Limitations

  • No Persistent Volume: Do not rely on a persistent file system.
  • No Persistent Memory: Treat each request as though it operates in a fresh environment.

Even if a user performs multiple requests from the same region, the same runner is not guaranteed to handle subsequent requests.

Starting a server

The Globe infrastructure expects that your Dart application starts listening to a port whenever executed. During the build phase of a deployment, a check will take place to ensure that your application is listening to a port. If this is not the case, the deployment will fail.

Using a package such as shelf, you can easily start a server that accepts inbound HTTP requests by accessing the PORT environment variable:

import 'dart:io';

import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;

void main() async {
  final handler =
      const Pipeline().addHandler((Request request) {
        return Response.ok('Hello, World!');
      });

  final server = await shelf_io.serve(
    handler,
    // Use any IPv4 address.
    InternetAddress.anyIPv4,
    // Use the PORT environment variable.
    int.tryParse(Platform.environment['PORT'] ?? '8080') ?? 8080,
  );
}