Ship a typed API in five minutes.
This guide walks you from npm i to a deployed, observable backend with a real Postgres database, generated clients, and a function running at the edge. No Docker. No YAML.
Prerequisites
You'll need a few things on your machine before you start. Lambda runs on every recent runtime; we test against the matrix below in CI.
- Node.js
20.xor later (Bun, Deno, and Node 22 are also supported). - A package manager —
npm,pnpm,yarn, orbun. - A Lambda account. The free tier includes one project, 1 GB of Postgres, and 1M function invocations.
Already have an account? Skip ahead to Step 2 — link your project and the CLI will pick up your session automatically.
1. Install the CLI
The Lambda CLI is a single static binary. Install it with your package manager of choice — it ships TypeScript types and the runtime SDK in the same package.
1# installs the CLI & runtime SDK
2$ npm install -g @lambda/cli
3
4# sign in — opens your browser
5$ lambda login
6→ Authorized as maya@acme.co (Acme Corp · production) $ pnpm add -g @lambda/cli
$ lambda login $ yarn global add @lambda/cli
$ lambda login $ bun install -g @lambda/cli
$ lambda login 2. Initialize a project
Run lambda init in an empty directory. The CLI scaffolds a project, links it to a workspace on Lambda Cloud, and writes a lambda.config.ts you can commit.
Pick a workspace and region
By default we'll deploy to the region closest to you. You can pin a primary region and add read replicas later from the dashboard.
Choose a starter
Empty, REST API, GraphQL, or one of fourteen full-stack examples (Next.js, Remix, Astro, SvelteKit, Expo, etc.).
Run the dev server
lambda dev starts a local emulator with hot-reload, a real Postgres, and live trace inspection on :4321.
3. Define your first model
Models are TypeScript files that compile to a typed REST API, a typed client, and a Postgres migration — automatically. Save the file and the CLI does the rest in under a second.
1import { model, id, ref, money, enumOf, timestamp } from "@lambda/schema";
2import { Customer } from "./customer";
3
4export const Order = model(({
5 id: id("ord_"),
6 customer: ref(Customer),
7 total: money({ currency: "USD" }),
8 status: enumOf("pending", "paid", "refunded"),
9 createdAt: timestamp({ default: "now()" }),
10}).index("customer", "status"); Renames are migrations too. If you rename a field, Lambda generates a backfill plan and asks you to confirm before destructive changes hit production. Read more in Zero-downtime migrations.
4. Endpoint reference
Every model gets the standard six endpoints. Below is the auto-generated reference for the Order model you just defined.
| Field | Type | Description |
|---|---|---|
| customer* | string | ID of an existing Customer object. Must belong to the calling workspace. |
| total* | money | An amount in the smallest unit of the currency. e.g. 4200 = $42.00 |
| status | enum | One of pending, paid, refunded. Defaults to "pending" |
| metadata | object | Up to 50 key-value pairs of arbitrary string data. Indexed for queries. |
5. Deploy to production
When you're ready, lambda deploy ships your project to every region you've configured. Deploys are atomic — they either succeed everywhere or roll back instantly. There's no half-state.
1$ lambda deploy --env production
2
3 ✓ typecheck 0.3s
4 ✓ generate clients 0.4s · 4 langs
5 ✓ migrate database 2.1s · 1 plan applied
6 ✓ build edge bundles 3.6s · 41 functions
7 ✓ ship to 38 regions 7.8s
8
9→ https://acme.lambda.app (commit a3f9c1d · build #1842) That's it. Your API is live, your clients are generated, your database is migrated, and every request is being traced end-to-end. Open the dashboard to see logs streaming in real time.
If something felt off, tell us — every doc has a maintainer on call.