Skip to content

Quickstart

This guide walks you through creating a minimal Sigil environment with a Postgres database and a service that connects to it.

Create sigil.config.ts in your project root:

import { Environment, Postgres, Service } from "sigil";
import path from "path";
const root = import.meta.dir;
const env = new Environment("my-app");
// Add a Postgres database
const db = env.add(
new Postgres("db", {
port: 5432,
database: "myapp",
username: "postgres",
password: "postgres",
})
);
// Add your backend service
env.add(
new Service("api", {
command: ["node", "server.js"],
cwd: path.join(root, "backend"),
env: {
DATABASE_URL: db.connectionString,
},
readyCheck: {
url: "http://localhost:3000/health",
timeout: 30000,
},
})
);
export default env;
Terminal window
sigil up

Sigil will:

  1. Pull the Postgres Docker image (first run only)
  2. Start a Postgres container
  3. Wait for the database to be ready
  4. Start your backend service with DATABASE_URL injected
  5. Poll the health endpoint until the service is ready

Output looks like:

[sigil] Starting environment "my-app"...
[sigil] Starting entity: db
[sigil] Pulling image postgres:16...
[sigil] Container sigil-db started on port 5432
[sigil] Starting entity: api
[api] Server listening on port 3000
[sigil] All entities started. Press Ctrl+C to stop.

In another terminal:

Terminal window
sigil status
Instance: default (PID 12345, running, started 2m ago)
Config: /path/to/sigil.config.ts
Entities:
db running
api running
Terminal window
sigil down

Or press Ctrl+C in the terminal running sigil up.

You can run multiple instances simultaneously:

Terminal window
sigil up dev # starts instance named "dev"
sigil up test # starts instance named "test"
sigil status # shows both
sigil down dev # stops only "dev"
  • Concepts — Understand entities, interfaces, and the lifecycle model
  • Full-Stack Example — A complete app with Postgres + FastAPI + React