Concepts

Components & Connections

Last updated January 2026

A project is a set of components and the connections between them. This is what you build on the canvas, and what your infra.json describes.


Components

A component is one piece of infrastructure, with a type and a name. The ones you will use most:

ComponentWhat it is
ContainerA long-running service built from your code: a web app, an API, or a worker.
FunctionA serverless function, optionally run on a schedule.
DatabaseA managed relational (PostgreSQL) database.
BucketObject storage for files.
VolumeA persistent disk attached to a container.
SecretSensitive values made available to your app at runtime.
DomainA custom domain served in front of your app, with TLS.
CDNCaches static content close to your users.

Connections

A connection is a directed link from one component to another, and it does the wiring for you. When you connect two components, Spawned opens the network path between them and injects what the source needs as environment variables. You never hardcode an endpoint or a credential.

ConnectionWhat it does
Container → DatabaseInjects the host, port, name, user, and password so the app can connect.
Container → BucketGrants read/write access and injects the bucket name.
Container → SecretMakes the secret’s values available to the container.
Domain → ContainerRoutes the domain’s traffic to the container, with TLS.

The injected environment variables are prefixed with the target component’s name, in uppercase. A Database named db gives your app DB_HOST, DB_PORT, DB_NAME, DB_USER, and DB_PASSWORD. A Bucket named uploads gives UPLOADS_BUCKET. Your code reads these at runtime.


The infra.json

Everything above is captured in your project’s infra.json, the declarative definition of your infrastructure. A small project looks like this:

{
  "version": "2.0",
  "platform": "aws",
  "components": [
    {
      "type": "Container",
      "name": "api",
      "source": { "git": { "url": "github.com/you/app", "ref": "main" } },
      "ports": [{ "name": "http", "port": 8000 }]
    },
    { "type": "Database", "name": "db", "db_name": "app", "username": "appuser" },
    { "type": "Bucket", "name": "uploads" }
  ],
  "connections": [
    { "from": "api", "to": "db" },
    { "from": "api", "to": "uploads" }
  ]
}

This is a container built from your repository, a PostgreSQL database, and a bucket. The two connections give the container the database credentials and bucket access automatically.

You can edit the infra.json by hand, view it from the canvas with the Source button, or let your coding agent write it. For the full list of components and their fields, run spawned schema. See the CLI to work with it from your terminal.

    Components & Connections