Framework Architecture
Full-Stack Runtime Architecture
At runtime, an Aegil application is a standard, production-ready Serverpod backend communicating with a Flutter frontend over HTTP RPC and real-time WebSockets, backed by PostgreSQL. Aegil itself has zero runtime dependencies—it operates entirely as a design-time domain compiler and verification harness.
Runtime topology
Section titled “Runtime topology”Aegil has zero runtime dependencies. Aegil is a compiler and verification harness: once compiled, your backend and frontend run using official Serverpod and Flutter packages.

The three runtime layers
Section titled “The three runtime layers”1. Flutter Client Layer (client/lib/)
Section titled “1. Flutter Client Layer (client/lib/)”- Single Public API Barrel: Hand-written Flutter code never imports deep backend or protocol paths. Everything is exposed through
package:<app>_flutter/api.dart. - Pre-Configured Client:
createAppClient()initializes connectivity with session persistence, automatic reconnects, and token management. - Generated Feature BLoCs: Every entity with an
@autoQueryreceives an<Entity>Blocmanaging query caching, optimistic UI updates, and real-time stream subscriptions.
2. Network Transport Layer
Section titled “2. Network Transport Layer”- HTTP RPC: Unary operations (queries and mutations) execute over Serverpod’s high-performance HTTP JSON-RPC protocol.
- WebSocket Streams: Real-time streams declared via
@autoStreammaintain a persistent WebSocket connection to broadcast live updates instantly. - Session Tokens: Authentication headers are attached automatically by the client SDK and validated on every request.
3. Serverpod Backend Layer (.aegil/server/)
Section titled “3. Serverpod Backend Layer (.aegil/server/)”- Zero-Trust Identity Extraction: Endpoints extract
auth.idandauth.rolestrictly from the server session. No client can pass anactingRoleparameter. - Database-Level RLS Pushdown: Common Expression Language (CEL) policies declared in specs compile into PostgreSQL
WHEREclauses, filtering data inside the database. - Transaction Lifecycle: Mutations execute inside atomic database transactions (
Transaction tx), passing pre-fetched entities and transactions to custom hooks.
Next steps
Section titled “Next steps”- Explore Serverpod Backend & PostgreSQL.
- Learn Custom Business Logic with Server Hooks.
- Learn Flutter UI & Reactive BLoCs.
- Learn Spec-Diff Database Migrations.