Skip to content

Scaffolding

create-mantle-app bootstraps a new Mantle project with Lambda handlers, TypeScript config, Drizzle schema, and OpenTofu infrastructure.

Final result

bash
npx create-mantle-app my-api --template api --database aurora-dsql
cd my-api
npx mantle build

Step 1: Run the scaffolder

bash
npx create-mantle-app

The interactive wizard asks five questions:

  1. Project name — lowercase alphanumeric with hyphens (e.g. my-api)
  2. Templateminimal, api, or full
  3. Database provideraurora-dsql, aurora-serverless-v2, neon, or none
  4. Auth providerbetter-auth or none
  5. Features — multi-select: observability, resilience

Non-interactive mode

Pass all options as flags to skip prompts:

bash
npx create-mantle-app my-api \
  --template api \
  --database aurora-dsql \
  --auth better-auth \
  --features observability,resilience

Use --yes to accept all defaults with only a project name:

bash
npx create-mantle-app my-api --yes
# template=api, database=aurora-dsql, auth=better-auth, features=observability

All flags

FlagShortDescription
--template <t>-tminimal, api, or full
--database <db>-daurora-dsql, aurora-serverless-v2, neon, none
--auth <a>-abetter-auth or none
--features <list>Comma-separated: observability, resilience
--package-manager <pm>pnpm, npm, yarn, or bun (auto-detected)
--directory <dir>Output directory (defaults to project name)
--skip-installSkip package installation
--skip-gitSkip git init
--yes-yUse all defaults, no prompts

Templates

minimal

A single Lambda handler — no database, no auth.

my-api/
  src/lambdas/api/
    ping.get.ts         # GET /ping → 200 { status: 'ok' }
  mantle.config.ts
  package.json
  tsconfig.json

api

REST API with database access and authentication.

my-api/
  src/
    lambdas/
      api/
        items/
          index.get.ts    # GET /items
          index.post.ts   # POST /items
      standalone/
        MigrateDSQL/
          index.ts
    entities/
      schema.ts
  migrations/
  infra/
    main.tf
  mantle.config.ts
  drizzle.config.ts

full

Everything in api plus EventBridge handlers and scheduled tasks.

Database providers

ProviderAuth method
aurora-dsqlIAM token (auto-rotated)
aurora-serverless-v2RDS Data API
neonConnection string
none

The selected provider configures getDrizzleClient(), drizzle.config.ts, and the OpenTofu database module.

Features

FeatureWhat it adds
observability@mantleframework/observability — Lambda Powertools logger, metrics, tracing
resilience@mantleframework/resilience — idempotency helpers, retry utilities

Step 2: Start building

bash
cd my-api

# Generate migrations from your schema
npx mantle db generate

# Build Lambda bundles
npx mantle build

# Deploy
npx mantle deploy --stage dev

Next steps