# Zerotal > A batteries-included, full-stack TypeScript framework for Bun: routing, an ORM, auth, validation, jobs, mail and notifications, realtime, an admin panel, tenancy and AI, from one dependency tree, on any host. Every page below is the Markdown copy of a page on https://zerotal.dev. The whole guide is also one file at https://zerotal.dev/llms-full.txt. An app's own coding agent gets the same pages, for the version it has installed, from the `search_docs` tool in `@zerotal/arch`. ## Prologue - [About Zerotal](https://zerotal.dev/docs/about.md): The complete standalone tour of Zerotal — what it is, the ideas behind it, and runnable examples for every major feature. Everything you need to start building on one page. - [Upgrade Guide](https://zerotal.dev/docs/upgrade.md): Move a Zerotal app to a newer release safely by bumping packages, applying breaking changes, and migrating. - [Support Policy](https://zerotal.dev/docs/support-policy.md): What Zerotal supports and for how long — Bun versions, databases, release cadence, maturity levels, and deprecation. - [Supply-Chain Security](https://zerotal.dev/docs/supply-chain.md): How Zerotal's packages are built and published — npm provenance, pinned CI actions, a short dependency list, no install scripts — and how to check each claim yourself. - [Contribution Guide](https://zerotal.dev/docs/contributing.md): Get the Zerotal monorepo running locally and pass the checks your change needs to land. ## Getting Started - [Getting Started](https://zerotal.dev/docs/getting-started.md): Scaffold, configure, and run your first Zerotal application on Bun in a few minutes. - [What Ships](https://zerotal.dev/docs/what-ships.md): Everything the framework already does, by area — what provides it, where it comes from, and the page that covers it. Check here before building one. - [Directory Structure](https://zerotal.dev/docs/structure.md): Where each kind of file lives in a Zerotal app and how the framework wires those directories by convention. - [Configuration](https://zerotal.dev/docs/config-system.md): Read deployment state, structure it in typed config files, and access it anywhere at runtime. - [Conventions](https://zerotal.dev/docs/conventions.md): How Zerotal auto-discovers and wires your app/* classes at boot, with no manual register() calls. - [Commands](https://zerotal.dev/docs/commands.md): Build and run CLI commands with bun zt, from generators to your own class- or closure-based commands. - [Scaffolding](https://zerotal.dev/docs/scaffolding.md): Generate typed boilerplate files at conventional paths with the make:* commands instead of writing them by hand. - [Deployment](https://zerotal.dev/docs/deployment.md): Take a Zerotal app to production — environment, migrations, assets, the server process, a reverse proxy, and a worker. - [Site gate](https://zerotal.dev/docs/site-gate.md): Maintenance mode and private preview — take a site down correctly, or open it only to the people you invite. ## Tutorial - [Build Your First App](https://zerotal.dev/docs/tutorial.md): A nine-milestone tutorial that takes a new Zerotal app from scaffold to deploy — tasks inside projects, with validation, a policy, queued mail, tests and teams. - [Scaffold and Run](https://zerotal.dev/docs/tutorial/scaffold.md): Milestone 1 of the tutorial — scaffold a Zerotal app from the React starter, migrate, seed and run it, and sign in as the demo user. - [Add a Model](https://zerotal.dev/docs/tutorial/model.md): Milestone 2 of the tutorial — generate the Task model and its migration, give the table its columns, and run it. - [Add Routes and Pages](https://zerotal.dev/docs/tutorial/routes-and-pages.md): Milestone 3 of the tutorial — a page for each project that lists its tasks, a form that adds one, and routes to tick a task off and delete it. - [Validate the Form](https://zerotal.dev/docs/tutorial/validation.md): Milestone 4 of the tutorial — rules for a task's title and an optional assignee, a blank field that counts as absent, and the errors the form shows. - [Write a Policy](https://zerotal.dev/docs/tutorial/policy.md): Milestone 5 of the tutorial — a policy that lets only a project's owner change or delete its tasks, checked on every route that loads one. - [Send a Queued Notification](https://zerotal.dev/docs/tutorial/notifications.md): Milestone 6 of the tutorial — email the assignee when a task is assigned, in the background, with the queue registered and a worker running. - [Write Feature Tests](https://zerotal.dev/docs/tutorial/tests.md): Milestone 7 of the tutorial — feature tests for every task action, the queued notification faked, and the test that proves a stranger is refused. - [Add Teams](https://zerotal.dev/docs/tutorial/multi-tenancy.md): Milestone 8 of the tutorial — make the app multi-tenant with @zerotal/tenancy, so every account works in a team and no team can see another's projects or tasks. - [Deploy It](https://zerotal.dev/docs/tutorial/deploy.md): Milestone 9 of the tutorial — rehearse a production release on your machine with deploy:production, pass its gate, and run the server and the worker in production mode. ## Architecture Concepts - [The Application](https://zerotal.dev/docs/application.md): Understand the kernel that owns the container, runs the provider lifecycle, and takes you from boot to a running server. - [Request Lifecycle](https://zerotal.dev/docs/lifecycle.md): Understand the boot and per-request lifecycles so your logic runs in the right place. - [Service Container](https://zerotal.dev/docs/container.md): Register how each object is built once, then resolve it by name with dependencies wired automatically. - [Service Providers](https://zerotal.dev/docs/providers.md): Register a feature's bindings and hook into the application boot and shutdown sequence. - [Events](https://zerotal.dev/docs/events.md): React to things that happen in your app, and observe the framework itself, through two purpose-built event buses. ## The Basics - [Routing](https://zerotal.dev/docs/routing.md): Explicit routes, groups, file-based routes, model binding, domains, and testing — the whole routing surface on one page. - [Middleware](https://zerotal.dev/docs/middleware.md): Inspect, transform, or short-circuit HTTP requests in a layered pipeline between the server and your controller. - [Controllers](https://zerotal.dev/docs/controllers.md): Group related request handlers into classes that map actions to routes and resolve dependencies through the container. - [Requests Context](https://zerotal.dev/docs/context.md): Every handler and middleware receives the per-request HttpContext directly — route params, typed input helpers, uploads, headers, response building, flash, and after-response hooks on one object. - [Responses](https://zerotal.dev/docs/responses.md): Send JSON, HTML views, redirects, and custom responses back to the client from controllers and middleware. - [Validation](https://zerotal.dev/docs/validator.md): Validate request input against typed rule chains and turn failures into the right HTTP response automatically. - [Session](https://zerotal.dev/docs/session.md): Give every HTTP request a signed, per-user data store you can read, write, and flash from anywhere in the pipeline. - [Cookies](https://zerotal.dev/docs/cookies.md): Read and write raw HTTP cookies via the request/response headers when the session isn't the right fit. - [CSRF Protection](https://zerotal.dev/docs/csrf.md): Block cross-site request forgery by requiring a per-session token on every mutating request. - [Error Handling](https://zerotal.dev/docs/errors.md): Turn any unhandled exception into the right HTTP response for the client and environment. - [Logger](https://zerotal.dev/docs/logger.md): Record structured, multi-channel application logs and auto-capture framework signals like slow queries and request errors. ## Frontend - [View](https://zerotal.dev/docs/view.md): Render server-side HTML from typed JSX components that escape untrusted data by default. - [Assets](https://zerotal.dev/docs/assets.md): Compile and serve your CSS and JavaScript with Bun's native bundler and hot reload — no separate build tool to configure. - [Components](https://zerotal.dev/docs/components.md): Themeable UI components for Flow that you install via the CLI or import from the package. ## Inertia - [Inertia](https://zerotal.dev/docs/inertia.md): Build a single-page app with server-side routing and controllers — no separate API layer or client-side router. - [Inertia Rendering Pages](https://zerotal.dev/docs/inertia/rendering.md): Return a page from a controller, choose a component, and control the response. - [Inertia Props](https://zerotal.dev/docs/inertia/props.md): Pass data to a page — eager, lazy, deferred, and merged props, plus the shared props every page receives. - [Inertia Middleware & Versioning](https://zerotal.dev/docs/inertia/middleware.md): The Inertia middleware, asset versioning, and forcing a full reload after a deploy. - [Inertia Server-Side Rendering](https://zerotal.dev/docs/inertia/ssr.md): Render the first paint on the server, and what changes when you do. - [Inertia DevTools](https://zerotal.dev/docs/inertia/devtools.md): Record every Inertia request — component, props, timing, and headers — and read it in the Inertia DevTools browser extension. - [Inertia CLI & Build](https://zerotal.dev/docs/inertia/build.md): The page registry, the bundler pipeline, and building for production. - [Inertia Reference](https://zerotal.dev/docs/inertia/references.md): Every helper, prop type, and config key in one table. ## Flow - [Flow](https://zerotal.dev/docs/flow.md): Build reactive, server-driven UIs as plain TypeScript classes — no API layer, no client store, no hand-written reactivity. - [Flow Routing](https://zerotal.dev/docs/flow/routing.md): Map URLs to Flow pages — file-based routes, route parameters, and navigation. - [Flow Decorators](https://zerotal.dev/docs/flow/decorators.md): The decorators that expose state and actions to the client: @expose, @locked, @computed, and friends. - [Flow Lifecycle Hooks](https://zerotal.dev/docs/flow/lifecycle.md): Where to run code as a component mounts, updates, and tears down. - [Flow Events & Broadcasting](https://zerotal.dev/docs/flow/events.md): Component events, browser events, and multiplayer state shared over WebSockets. - [Flow Forms, Validation & Uploads](https://zerotal.dev/docs/flow/forms.md): Two-way bound inputs, real-time validation, and server-handled file uploads. - [Models in Components](https://zerotal.dev/docs/flow/models.md): Put an ORM model on a Flow component — what crosses the wire, what the client may change, and what stays on the server. - [Flow Pagination](https://zerotal.dev/docs/flow/pagination.md): The Pagination mixin, URL-synced pages, and named paginators. - [Flow Built-in Components](https://zerotal.dev/docs/flow/components.md): The component library that ships with Flow — forms, overlays, tables, and feedback. - [Icons](https://zerotal.dev/docs/flow/icons.md): 2,060 icons bundled with Flow's component library — typed by name, rendered on the server, nothing to install. - [Flow Layouts & Composition](https://zerotal.dev/docs/flow/layouts.md): Wrap pages in layouts, compose behaviour with mixins, nest components, and pass markup between them. - [Flow Transport & Performance](https://zerotal.dev/docs/flow/performance.md): How updates reach the browser, what to do on hostile networks, and the polish that hides latency. - [Testing Flow Components](https://zerotal.dev/docs/flow/testing.md): Drive a component in-process with FlowTest, and pin the wiring in a real browser with FlowBrowser. - [Flow Reference](https://zerotal.dev/docs/flow/references.md): Every decorator, prop, directive, and client global in one table. ## Database - [Database](https://zerotal.dev/docs/database.md): Talk to your database directly — transactions, raw queries, replicas, and locks — beneath the ORM. - [Query Builder](https://zerotal.dev/docs/query-builder.md): Build parameterized SQL with a fluent, model-free chain that runs only when you call a terminal method. - [Migrations](https://zerotal.dev/docs/migrations.md): Version-control your database schema with up/down migration files the ORM applies in order. - [Seeding](https://zerotal.dev/docs/seeding.md): Populate your database with repeatable test and demo data through ORM-aware seeder classes. - [Pagination](https://zerotal.dev/docs/pagination.md): Split large query results into pages with the metadata and URL helpers a UI needs. ## ORM Models - [ORM](https://zerotal.dev/docs/orm.md): Map model classes to database tables with an Active Record layer over Bun's native SQL client. - [Casts & Mutators](https://zerotal.dev/docs/orm/casts.md): Translate between raw database values and rich, typed TypeScript values on every read and write. - [Queries](https://zerotal.dev/docs/orm/queries.md): Read and write model records with a fluent, type-aware query builder. - [Relationships](https://zerotal.dev/docs/orm/relationships.md): Define and query associations between models with relation decorators and eager loading. - [ORM Serialization](https://zerotal.dev/docs/orm/serialization.md): Control exactly which model fields reach your JSON API responses. - [Lifecycle & Events](https://zerotal.dev/docs/orm/lifecycle.md): Hook into every persistence event, enforce status transitions, and prune stale records as your models are created, changed, and deleted. - [Factories](https://zerotal.dev/docs/orm/factories.md): Generate realistic model instances on demand for seeders and tests. ## Security - [Authentication](https://zerotal.dev/docs/authentication.md): Sessions, login, guards, API tokens, passwordless login, and testing — the whole authentication surface on one page. - [Authorization (Roles & Permissions)](https://zerotal.dev/docs/authorization.md): Authorize users against database-backed roles and permissions composed onto your models. - [Two-Factor Authentication](https://zerotal.dev/docs/roles-and-2fa.md): Add TOTP-based two-factor authentication so logins require a one-time code from an authenticator app. - [Social Login](https://zerotal.dev/docs/social.md): Authenticate users through GitHub, Google, and Apple with OAuth2 drivers that handle CSRF state, token exchange, and profile normalisation for you. - [Email Verification](https://zerotal.dev/docs/email-verification.md): Confirm a user controls their email address with signed, expiring verification links — no token table required. - [Password Reset](https://zerotal.dev/docs/password-reset.md): Generate, email, and verify hashed reset tokens so users can securely set a new password. - [Encryption & Hashing](https://zerotal.dev/docs/encryption.md): Encrypt values symmetrically with APP_KEY, hash passwords one-way, and sign tamper-proof URLs. ## Digging Deeper - [Helpers](https://zerotal.dev/docs/helpers.md): Small, named, tree-shakeable functions for env, config, control flow, strings, and responses. - [Carbon & CarbonInterval](https://zerotal.dev/docs/carbon.md): Timezone-aware, immutable date-times and durations — creating, reading, arithmetic, differences, formatting, intervals, and testing on one page. - [HTTP Client](https://zerotal.dev/docs/client.md): Call another service from your app — requests, auth, timeouts, retries, errors, and a circuit breaker. - [Rate Limiting](https://zerotal.dev/docs/rate-limiting.md): Cap how many requests an actor can make in a time window and respond with 429 when they exceed it. - [Notifications](https://zerotal.dev/docs/notifications.md): Send one notification across mail, database, Slack, SMS, and real-time broadcast channels from a single class. - [Queue](https://zerotal.dev/docs/queue.md): Offload slow work to background jobs that run outside the request cycle. - [Scheduler](https://zerotal.dev/docs/scheduler.md): Run recurring tasks on a cron-like schedule from class files or a fluent facade, executed in the worker process. - [Cache](https://zerotal.dev/docs/cache.md): Store expensive query results, computed values, and API responses so repeat reads skip the work. - [Storage](https://zerotal.dev/docs/storage.md): Read and write files through one API that works the same on local disk or any S3-compatible service. - [Media Library](https://zerotal.dev/docs/media.md): Attach files to models with collections, image conversions, responsive images and ordering, on any storage disk. - [Broadcasting](https://zerotal.dev/docs/broadcasting.md): Push server-side events to subscribed clients in real time over WebSockets, with Pusher-protocol compatibility built in. - [Locking](https://zerotal.dev/docs/lock.md): Coordinate critical sections across processes and servers with atomic, owner-guarded distributed locks. - [Internationalization](https://zerotal.dev/docs/i18n.md): Resolve each visitor's locale automatically, then translate English source strings with interpolation, pluralization, and fallback. - [Health Checks](https://zerotal.dev/docs/health.md): Serve a probe-friendly /health endpoint that reports liveness and the readiness of your app's dependencies. - [DevTools](https://zerotal.dev/docs/devtools.md): See per-request SQL, logs, mail, cache, and jobs in a live in-browser debug panel during development. - [Agent Surface](https://zerotal.dev/docs/arch.md): Give coding agents the framework's machine-readable truth — exact signatures, live routes and schema, version-matched docs, and a health check they can act on. ## Broadcasting - [Broadcasting Events](https://zerotal.dev/docs/broadcasting/events.md): Write a broadcast event, dispatch it, and broadcast model changes automatically. - [Broadcasting Channels](https://zerotal.dev/docs/broadcasting/channels.md): Public, private, presence, and typed channels — and authorizing access to them. - [Broadcasting on the Client](https://zerotal.dev/docs/broadcasting/client.md): Subscribe from the browser and react to events as they arrive. - [Testing Broadcasting](https://zerotal.dev/docs/broadcasting/testing.md): Fake the broadcaster and assert on what would have been sent. - [Broadcasting References](https://zerotal.dev/docs/broadcasting/references.md): The Broadcast facade, channel APIs, errors, and commands. ## Testing - [Testing](https://zerotal.dev/docs/testing.md): Boot your real app in tests and assert on HTTP, the database, console commands, browsers, and faked services. - [HTTP Tests](https://zerotal.dev/docs/testing/http.md): Boot your real application and exercise it over real HTTP requests with chainable response assertions. - [Console Tests](https://zerotal.dev/docs/testing/console.md): Run CLI commands in-process from a test and assert their output, exit code, and side effects. - [FlowBrowser](https://zerotal.dev/docs/testing/flow-browser.md): Drive a real page against a real server inside bun test, and assert on the WebSocket bridge itself. - [Browser Tests](https://zerotal.dev/docs/testing/browser.md): Drive a real browser against a running Zerotal app with Playwright to test Flow and Inertia UIs end-to-end. - [Database Testing](https://zerotal.dev/docs/testing/database.md): Keep database tests isolated with per-test transactional rollback and assert on rows and stored files. - [Mocking](https://zerotal.dev/docs/testing/mocking.md): Swap real services for in-memory fakes so tests can assert side effects without doing real I/O. ## Official Packages - [Admin Panel](https://zerotal.dev/docs/admin.md): A Filament-style, server-driven admin panel — declare resources as classes and get tables, forms, infolists, actions, relations, dashboards, search, notifications, and auth pages. - [AI](https://zerotal.dev/docs/ai.md): Text, streaming, structured output, typed tools, and an agent loop behind one provider-agnostic facade. - [Monitor](https://zerotal.dev/docs/monitor.md): The Super Panel — a self-hosted, real-data monitoring dashboard for requests, queries, jobs, cache, realtime, and more, built on the same event bus the logger reads. - [Multi-Tenancy](https://zerotal.dev/docs/tenancy.md): Resolve the active tenant from each request and isolate its data, files, and cache automatically across the call stack. - [Settings](https://zerotal.dev/docs/settings.md): Per-tenant settings with typed defaults in code, overrides per tenant and per user, hidden but never deleted, audited, and a generated admin screen. - [Telemetry](https://zerotal.dev/docs/telemetry.md): Trace requests and operations across your app with OTLP-compatible spans and zero SDK dependencies. - [Audit](https://zerotal.dev/docs/audit.md): Capture every model write and custom event — with old/new values, actor, and request metadata — into a queryable audit_logs table. ## Admin Panel - [Admin Resources](https://zerotal.dev/docs/admin/resources.md): Declare a resource and get list, create, edit, and view screens for a model. - [Admin Tables](https://zerotal.dev/docs/admin/tables.md): Columns, filters, sorting, search, and bulk actions on the list screen. - [Admin Forms & Infolists](https://zerotal.dev/docs/admin/forms.md): Build create and edit forms, and lay out the read-only view screen. - [Admin Actions & Relations](https://zerotal.dev/docs/admin/actions.md): Row, bulk, and page actions, related-record managers, and soft-delete handling. - [Panel Structure](https://zerotal.dev/docs/admin/structure.md): Group resources into clusters, nest one resource under another's records, back a single row, and run more than one panel from a single app. - [Admin Dashboard & Navigation](https://zerotal.dev/docs/admin/dashboard.md): Widgets, global search, the command palette, notifications, and the nav tree. - [Extending the UI](https://zerotal.dev/docs/admin/extending-ui.md): Render your own cells, controls and entries, inject markup into the panel's chrome, and back a resource with something other than a model. - [Operations](https://zerotal.dev/docs/admin/operations.md): The features a panel grows once real people use it daily — record history, impersonation, saved views, the media library, roles and permissions, and a dashboard each person arranges. - [Admin Custom Pages & Plugins](https://zerotal.dev/docs/admin/extending.md): Add your own pages, and contribute pages or widgets to the panel from a package. - [Admin Auth Pages & Theming](https://zerotal.dev/docs/admin/auth.md): The built-in login and profile screens, and how to restyle the panel. - [Testing the Admin Panel](https://zerotal.dev/docs/admin/testing.md): Drive panel screens in tests and assert on what they render. - [Admin References](https://zerotal.dev/docs/admin/references.md): Every resource, table, form, and action API in one table. ## Resources - [Package Development](https://zerotal.dev/docs/package-development.md): Build a first-party @zerotal package that auto-discovers, merges config, and passes the linter like a native one. - [Inspirations & Attributions](https://zerotal.dev/docs/inspirations.md): The frameworks, runtimes, and tools that shaped Zerotal's design — what it borrowed, adapted, and where it diverged. ## Optional - [Release Notes](https://zerotal.dev/docs/changelog.md): What changed in each tagged Zerotal release, and the steps needed to upgrade. - [Documentation](https://zerotal.dev/docs.md): Start here — installation, the ideas behind Zerotal, and a map of every guide in the documentation.