Local development
See package manager commands and troubleshooting for pnpm 11/12 and npm usage.
This page covers the swallowkit dev command, local seed data management, and backend-specific setup.
Starting the dev server
npx swallowkit devpnpm exec swallowkit devThis normally starts both servers:
- Next.js at http://localhost:3000
- Azure Functions at http://localhost:7071
When auth.provider is swa, it also starts the SWA authentication emulator at http://localhost:4280. Use port 4280 for authenticated UI testing. If SWA CLI is not installed, swallowkit dev prints the project-local installation command and exits before starting any servers.
Parallel development with Git worktrees
When swallowkit dev runs in a Git linked worktree, it automatically isolates that worktree's local Cosmos DB data. All worktrees share the same Cosmos DB Emulator process, but linked worktrees append an eight-character hash of the canonical worktree root path to the configured database name. For example, MyAppDatabase becomes MyAppDatabase_a31f92c4.
The main worktree keeps the existing database name without a suffix. Seed replacement and create-dev-seeds --from-emulator use the resolved database, so parallel coding agents in different linked worktrees do not delete or replace each other's containers or data. The startup log shows the resolved database name and whether worktree isolation is enabled.
Options
| Flag | Description |
|---|---|
-p, --port <port> | Next.js server port |
-f, --functions-port <port> | Azure Functions port |
--host <host> | Server hostname |
--seed-env <name> | Apply seed data before startup |
-o, --open | Open browser automatically |
-v, --verbose | Verbose logging |
--no-functions | Skip Azure Functions startup |
--mock-connectors | Use mock connector server |
--swa-port <port> | SWA authentication emulator port (default: 4280) |
--no-swa | Skip the SWA authentication emulator |
Backend-specific behavior
TypeScript
No additional setup required. Functions start immediately with func start.
Python
swallowkit dev uses uv for local Python environment management:
- Installs or reuses a project-local
uvbinary under.uv/bin - Keeps uv-managed Python under
.uv/python - Creates
functions/.venvfor the Functions app - Creates
functions/.codegen-venvfor schema generation (used byscaffold)
You do not need to install Python or create virtualenvs manually.
C#
Azure Functions isolated worker (.NET 10) requires a build step before the host responds. swallowkit dev waits up to 90 seconds for the Functions host to become ready before printing the URL.
Requires .NET 10 SDK and Azure Functions Core Tools 4.6.0 or later.
Dev seeds
Dev seeds let you populate the local Cosmos DB Emulator with known data before starting the server.
Create seed templates
npx swallowkit create-dev-seeds localpnpm exec swallowkit create-dev-seeds localThis generates one JSON file per model under dev-seeds/local/:
dev-seeds/
local/
todo.json
category.jsonEach file corresponds to a schema in shared/models/. Edit the files to add your test data:
[
{
"id": "seed-todo-001",
"text": "First todo",
"completed": false,
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}
]Every document must include an id field.
Export current emulator data
npx swallowkit create-dev-seeds local --from-emulator --forcepnpm exec swallowkit create-dev-seeds local --from-emulator --forceThis exports the current data from matching Cosmos DB Emulator containers into the seed files. System properties like _etag are stripped automatically.
Apply seeds on startup
npx swallowkit dev --seed-env localpnpm exec swallowkit dev --seed-env localThis replaces the data in each matching container with the JSON documents from dev-seeds/local/. Containers without a matching file are left untouched.
If --seed-env is omitted, existing emulator data is preserved.
Use cases
- Replay a known state for demos or bug reproduction
- Preserve realistic data registered during manual testing
- Reset the emulator to a consistent state before validation
- Share test data with team members via the repository
Mock connectors
For models that use external data connectors (MySQL, PostgreSQL, REST APIs), you can develop locally without the real external service:
npx swallowkit dev --mock-connectorspnpm exec swallowkit dev --mock-connectorsThis starts a mock proxy server on port 7072 that:
- Intercepts requests to connector model routes
- Returns realistic fake data generated from the Zod schema
- Proxies standard Cosmos DB model requests to the real Functions runtime on port 7071
The frontend and BFF layer behave identically regardless of whether real or mock data is used.
Next steps
- Scaffold guide — CRUD generation and model configuration
- Deploy to Azure — Move from local to cloud
- External connectors — Connect to MySQL, PostgreSQL, REST APIs
