Running and Debugging Locally
This guide shows how to run your full-stack Aegil application locally during development, select target client devices, reset the local PostgreSQL container, and inspect generated credentials.
Prerequisites
Section titled “Prerequisites”- Docker Desktop or Docker Engine running locally.
- Aegil CLI installed and accessible on your
PATH. - A valid project workspace containing
aegil.yamlandspecs/.
Fast preflight checks (aegil check)
Section titled “Fast preflight checks (aegil check)”Before running a full build or verification suite, you can run a fast, read-only check:
aegil checkaegil check parses all specs/**/*.tsp files, validates toolchain pins in aegil.yaml, verifies ownership boundaries, and checks schema compatibility—without writing any files to disk. It is ideal for pre-commit hooks or fast editor diagnostics.
Running the full stack locally (aegil run)
Section titled “Running the full stack locally (aegil run)”Just like flutter run starts your client application, aegil run manages your entire full-stack development environment:
aegil runWhat aegil run automates:
- Docker container: Checks Docker and launches a PostgreSQL container on port
8090. - Database migrations: Automatically applies Serverpod database migrations.
- Backend server: Starts the Serverpod server listening on
http://localhost:8080. - Flutter client: Boots the Flutter application on your default device (macOS, Chrome, or mobile).
Selecting a Flutter device (-d)
Section titled “Selecting a Flutter device (-d)”Pass the -d flag to target a specific Flutter device or browser:
# Run Flutter on Chrome webaegil run -d chrome
# Run Flutter on macOS desktopaegil run -d macosResetting the local database (--reset-db)
Section titled “Resetting the local database (--reset-db)”If you make substantial changes to your schemas during development or need to reset sample data, pass --reset-db:
aegil run --reset-dbThis safely removes the existing local PostgreSQL container volume, starts a fresh database container, applies all migrations from scratch, and regenerates server passwords.
Managing local development secrets (aegil secrets)
Section titled “Managing local development secrets (aegil secrets)”To inspect the environment variables and passwords generated for local development:
aegil secretsThis displays the local database passwords, JWT signing keys, and Redis configuration stored securely in .aegil/server/config/passwords.yaml and .aegil/server/.env (mode 0600).
What could go wrong?
Section titled “What could go wrong?”| What you see | Why | What to do |
|---|---|---|
Cannot connect to Docker |
Docker Desktop or daemon is not running. | Start Docker Desktop and re-run aegil run or aegil verify. |
Password authentication failed for user postgres |
Stale container volume with outdated credentials. | Run aegil run --reset-db to reset the container with fresh credentials. |
ERR_STALE_BUILD |
Specs or hooks were edited since the last build. | Run aegil build before aegil verify. |
ERR_TAMPERED_GENERATED_FILE |
A file in .aegil/ was edited manually. |
Discard changes to .aegil/ and edit specs/<feature>/*.tsp instead. |
Next steps
Section titled “Next steps”- Learn 5-Stage Verification Harness.
- Review CLI Commands & Options.
- Review Error Codes Reference.