← Back to Blog
Header image for blog post: How to spin up a secure code sandbox & microVM in seconds with Northflank
Will Stewart
Published 10th July 2025

How to spin up a secure code sandbox & microVM in seconds with Northflank

Running secure, isolated workloads at scale has never been easier. With Northflank, you can spin up microVM-backed containers in seconds, combining the performance and compatibility of containers with the strong isolation of virtual machines.

In this guide, we’ll walk you through how to:

  • Create a secure, multi-tenant project on Northflank
  • Deploy any container image using microVMs
  • Build and deploy from Dockerfiles or OCI-compliant containers
  • Launch services in seconds with strong network and runtime isolation

💡 Northflank operates over 2 million microVMs every month and has been in production since 2021. Northflank’s engineering team is active in the OSS community, maintaining and contributing to Kata Containers, QEMU, containerd, Cloud Hypervisor, and more.

We operate microVMs on our own infrastructure and for our enterprise customers with our bring your own cloud offering. Northflank’s platform can operate workloads in your own Virtual Private Cloud (VPC).

Building a secure sandboxing platform with Firecracker and Kubernetes isn’t a weekend project. It can take a team months or longer, and the complexity doesn’t go away, it becomes something you have to operate and maintain every day.

Northflank already did the hard part. You can start running secure microVMs in seconds, without any heavy lifting required.

Companies like Writer, Sentry, and others have leveraged Northflank’s secure runtime to run multi-tenant customer deployments for untrusted code at scale.

It’s proven in production and you get to partner closely with the Northflank infrastructure engineering team.

Let’s dive in.

Why use microVMs?

microVMs (like those powered by Kata Containers) offer VM-level isolation with container startup speed. They’re ideal for:

  • Running untrusted code inside a secure sandbox
  • Isolating multi-tenant workloads in a secure runtime
  • Securing AI inferenceCI jobs, or backend functions
  • Minimizing kernel attack surface per container

Northflank natively supports microVM-backed workloads with seamless orchestration, startup, and monitoring.

Northflank sandboxes are powered by microVMs or gVisor. Technologies like Firecracker, Kata, gVisor, and Cloud Hypervisor (CLH), giving you flexibility in your secure compute stack wherever you need it: AWS, GCP, Azure, bare-metal.

Step 1: Create a project for multi-tenancy

To enable secure isolation between end-users or workloads, start by creating a dedicated project:

  1. Head to your Northflank dashboard
  2. Click “Create Project”
  3. Choose:
    • Region for running workloads close to your users
    • or Bring your own cloud to run workloads in your own VPC or customers VPC for data privacy and locality

Each project acts as a namespace, giving you strict runtime and network separation, perfect for SaaS platforms, API execution environments, or internal tooling.

Here is a code snippet example of initializing the Northflank SDK and creating a project:

import {
  ApiClient,
  ApiClientInMemoryContextProvider,
} from "@northflank/js-client";

const contextProvider = new ApiClientInMemoryContextProvider();
await contextProvider.addContext({
  name: "context",
  token: process.env.NORTHFLANK_TOKEN,
});

const apiClient = new ApiClient(contextProvider, {
  throwErrorOnHttpErrorCode: true,
});

const project = await apiClient.create.project({
  data: {
    name: "sandbox-project",
    region: "europe-west",
  }
});

Step 2: Create a service

Next, create a service backed by microVMs:

  1. In your project, click “Create Service”
  2. Select “Job or Backend Service” depending on the use case
  3. Choose your container image:
    • Public (e.g. ubuntupythonghcr.io/...)
    • Private (via credentials)
  4. Choose CPU, memory, disk — your microVM will be provisioned accordingly
  5. Hit “Deploy”

Northflank provisions the microVM, pulls your image, and runs it within seconds inside a secure sandbox.

💡 Pro tip: Enable persistent or ephemeral disk storage depending on workload needs (e.g. build caching, temporary compute jobs, etc.)

Here is an example of using the Northflank SDK to provision a secure sandbox that will boot in a few seconds:

const service = await apiClient.create.service.deployment({
  parameters: {
    projectId: project.data.id,
  },
  data: {
    name: "sandbox-service",
    billing: {
      deploymentPlan: "nf-compute-20", // 2 vCPU, 4GB RAM
    },
    deployment: {
      instances: 1,
      external: {
        imagePath: "alpine:latest",
      },
    },
  },
});

Step 3: (Optional) Build from a Dockerfile

Need to build your image from source?

  1. Create a new Build in the same project
  2. Connect a Git repository or upload a Dockerfile
  3. Configure:
    • Build context
    • Dockerfile path
    • Build arguments or secrets
  4. Northflank will use fast, ephemeral builds to produce an OCI image
  5. Deploy that image to any service — including microVMs — with a single click

Step 4: Secure by default, scale on demand

Every microVM on Northflank runs:

  • In its own secure runtime with a sandboxed kernel
  • With configurable CPU and memory limits
  • With no shared namespaces unless explicitly enabled
  • Over isolated, per-service networking

The secure sandboxing model prevents container breakout and ensures tenant isolation, even for untrusted workloads.

You can scale vertically (larger instances) or horizontally (replica count) and even autoscale based on resource usage.

Common use cases

Here are just a few things you can build with Northflank microVM services:

Use caseBenefits
Untrusted code runnersVM-grade isolation, no risk of container breakout — run in a secure sandbox using Northflank secure runtime
Multi-tenant API hostingIsolated execution per customer or request, protected by a Northflank’s hardened secure runtime
AI model inferenceCombine with GPUs and secure tenant-level execution using Northflank’s gVisor or microVMs
Serverless backendsFast boot times, strong tenancy and network isolation
Build sandboxesRun npm installcargo build, or docker build safely inside a hardened, using Northflank ephemeral microVMs

Get started today

If you're looking to run secure, high-performance workloads with full tenancy isolation,

Northflank microVMs offer the best of both worlds: speed and safety.

Try it now → Sign up at northflank.com

Share this article with your network
X