Skip to content

Local development ​

For React, dev starts Vite (3000), managed BFF Functions (7073), independent Functions (7071), and SWA CLI (4280). Open the SWA port, not Vite directly. --bff-port changes the managed API port. --no-functions retains the BFF; --no-swa removes same-origin routing/auth emulation. See React local development for settings and prerequisites. Next.js-specific steps below apply only to Next.js projects.

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 ​

bash
npx swallowkit dev
bash
pnpm exec swallowkit dev

This normally starts both servers:

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.

Next.js styling ​

SwallowKit uses webpack for Next.js development and builds. New projects explicitly include @tailwindcss/postcss and a PostCSS configuration, even when the current create-next-app template configures Tailwind only for Turbopack. Existing PostCSS configuration files are preserved. If an existing project has Tailwind classes but no styled output, install @tailwindcss/postcss as a dev dependency and enable it in your PostCSS configuration; a Turbopack-only CSS loader does not run with webpack.

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 ​

FlagDescription
-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, --openOpen browser automatically
-v, --verboseVerbose logging
--no-functionsSkip Azure Functions startup
--mock-connectorsUse mock connector server
--swa-port <port>SWA authentication emulator port (default: 4280)
--no-swaSkip 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:

  • Reuses installed uv; bootstraps .uv/bin only if uv is missing, without changing PATH
  • Uses normal uv interpreter discovery (including installed Python and the Windows registry), .python-version, UV_PYTHON, and user configuration; does not force a managed download, cache directory, or Python 3.11
  • Creates functions/.venv for the Functions app
  • Creates functions/.codegen-venv for schema generation (used by scaffold)

If Python is not installed, uv may download it according to your settings. New projects do not create a .python-version pin. An existing pin remains effective: update it explicitly if you want another interpreter. Existing environments are reused and are never automatically cleared. When switching Python, explicitly recreate the environment with uv after preserving anything you need.

On Windows with Smart App Control, an unsigned interpreter or venv executable may be blocked. Use a trusted interpreter (for example official CPython) and explicitly select it with uv; do not disable application-control policy. An execution failure reports the executable path and preserves the environment.

Local interpreter selection is separate from the generated Azure runtime and CI version (Python 3.14, the current GA default). Python 3.15 is currently in Azure Functions preview; Core Tools 4.14.0 currently accepts only Python 3.10–3.14. Use an interpreter supported by your Core Tools version for dev, even if scaffold works with a newer Python. A Functions startup failure stops dev rather than reporting the backend as still warming up.

Schema-tool installation defaults to PyYAML's pure-Python mode when building from source, avoiding a C compiler requirement for its optional accelerator. An explicit PYYAML_FORCE_LIBYAML setting is respected.

C# ​

Azure Functions isolated worker (.NET 10) starts with dotnet run, which builds and launches Core Tools from the output directory so function extensions load correctly. The requested --functions-port is forwarded to the host. swallowkit dev waits up to 90 seconds for readiness.

React/Vite excludes standalone functions/, managed bff/, .uv/, .swallowkit/, and compiled shared/dist/ from file watching, including when starting existing projects through swallowkit dev. Your Vite configuration and other ignore rules are retained, and frontend files and shared model sources remain watched.

Requires .NET 10 SDK and Azure Functions Core Tools 4.6.0 or later.

New C# projects use Cosmos SDK 3.63.2, including fixes for binary query responses. In existing generated projects using 3.47.0, update the Microsoft.Azure.Cosmos reference in functions/*.csproj to 3.63.2 and run dotnet restore. This fixes the Unknown JsonNodeType: Unknown exception when reading query results, including list endpoints and lookups with a custom partition key; resetting the emulator or deleting data is unnecessary.

Dev seeds ​

Dev seeds let you populate the local Cosmos DB Emulator with known data before starting the server.

From model definition to Azure initialization ​

SwallowKit generates CRUD from the Zod schemas in shared/models/ and lets you test it with JSON under dev-seeds/<name>/. The same reviewed seed files can initialize Azure, without maintaining separate local and cloud data-loading scripts. Azure initialization supports TypeScript, C#, and Python backends through a manually dispatched GitHub Actions workflow.

  1. Define the model in shared/models/ and run swallowkit scaffold <model> to generate CRUD and the corresponding infrastructure migration. See the scaffold guide for model definitions and generated outputs.
  2. Run swallowkit create-dev-seeds local to create JSON templates. To preserve data entered through the application, use swallowkit create-dev-seeds local --from-emulator. Add --force only when you intend to overwrite existing seed files.
  3. Review and edit the JSON, then run swallowkit dev --seed-env local to replace the matching local containers and check the UI and API. Omit --seed-env when continuing development without reapplying seeds.
  4. Review the files intended for Azure and commit them with the models and generated code. Do not commit personal data or secrets as test fixtures.
  5. Run swallowkit provision against the intended Azure environment to apply infrastructure/model migrations and create the database and containers. Complete the ordinary Functions deployment and GitHub Actions secret configuration.
  6. From main, manually run Initialize Azure Cosmos DB seed data, set seed_name to local, and confirm the Function App name. Use default mode for the first initialization, and check both the initialization and ordinary-package restoration results.

See the Cosmos DB bootstrap seed section in the deployment guide for cloud execution, limits, and recovery.

Correcting seed data ​

When you find a mistake in initial data, edit the seed JSON and check it locally first. To apply the reviewed correction to Azure, enable force in the manual workflow. It replaces the entire item with the same id and partition key, but retains items absent from the seed. On a live app, this also overwrites values that users may have changed.

These similarly named options operate on different targets:

OperationTarget and behavior
create-dev-seeds ... --forceOverwrites local seed files; does not initialize Azure.
dev --seed-env <name>Replaces matching local Emulator containers with seed contents; does not initialize Azure.
Azure workflow force: falseCreates missing items, skips identical items, and stops on different existing items.
Azure workflow force: trueCreates or overwrites seed items; does not delete items absent from the seed or containers.

Azure force is neither a delete-all reset nor an atomic transaction. Earlier writes remain after a failure; review counts and diagnostics before rerunning.

Create seed templates ​

bash
npx swallowkit create-dev-seeds local
bash
pnpm exec swallowkit create-dev-seeds local

This generates one JSON file per model under dev-seeds/local/:

dev-seeds/
  local/
    todo.json
    category.json

Each file corresponds to a schema in shared/models/. Edit the files to add your test data:

json
[
  {
    "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 ​

bash
npx swallowkit create-dev-seeds local --from-emulator --force
bash
pnpm exec swallowkit create-dev-seeds local --from-emulator --force

This 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 ​

bash
npx swallowkit dev --seed-env local
bash
pnpm exec swallowkit dev --seed-env local

This 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:

bash
npx swallowkit dev --mock-connectors
bash
pnpm exec swallowkit dev --mock-connectors

This 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 ​

Durable Functions and Azurite ​

Start Azurite before swallowkit dev when standalone Durable Functions uses the Azure Storage provider with UseDevelopmentStorage=true. Dev checks reachability of the default Blob, Queue and Table ports (10000–10002) for this shortcut and reports missing listeners. HTTP readiness only covers HTTP. Verify Durable storage separately by running a test orchestration. Azure Storage connections and other Durable providers follow their own configuration. Cosmos DB Emulator is separate.

Released under the MIT License.