# Beignet > A TypeScript application framework with a clear architecture, integrated production capabilities, and CLI tools to help developers and agents scaffold and check changes. Framework version: 0.0.65. These docs describe the current checkout, not a release archive. Compare the installed package version before using these examples. Prefer installed package skills and changelogs when versions differ. Source revision: ba3f49c103f3c4515e8ca14e07651fe5b83e2cec. Uncommitted changes: yes. ## Start here - [Agent instructions](https://www.beignetjs.com/markdown/agent-instructions.md): Detect the app, choose guidance, make a change, and verify it. - [Documentation manifest](https://www.beignetjs.com/docs-manifest.json): Version, source revision, page descriptions, Markdown URLs, and byte sizes. Fetch only the pages needed for the current task. Page links below return Markdown, with code examples and links to related pages. ## Start - [Introduction](https://www.beignetjs.com/markdown/docs.md): Learn what Beignet provides, how it fits with Next.js, and where to start with a new app, an existing app, a tutorial, or a specific task. - [Quickstart](https://www.beignetjs.com/markdown/getting-started.md): Create a Beignet app, run it locally, and make a first schema change you can watch take effect across the form, API, and OpenAPI. - [Add Beignet to an existing Next.js app](https://www.beignetjs.com/markdown/guides/existing-nextjs-app.md): Add a public catalog endpoint in three files, then use its shared validation and typed client alongside existing Next.js routes. - [Build with a coding agent](https://www.beignetjs.com/markdown/getting-started/agents.md): Create or inspect a Beignet app with a coding agent, make the first validation change, and review the checks together. - [Beignet](https://www.beignetjs.com/markdown/index.md): A TypeScript application framework with a clear architecture, integrated production capabilities, and CLI tools to help developers and agents scaffold and check changes. ## Learn - [Build your first feature](https://www.beignetjs.com/markdown/learn.md): Build a Projects feature with persistent data, account ownership, and a React UI, on your own or with a coding agent. - [Build your first feature: API](https://www.beignetjs.com/markdown/build-first-resource.md): Start the three-chapter Projects tutorial: generate the API, add a description field, migrate SQLite, and verify persisted records over HTTP. - [Build your first feature: ownership](https://www.beignetjs.com/markdown/build-first-resource/ownership.md): Add session-derived ownership, policies, filtered lists, and access-control tests to the Projects API from chapter one. - [Build your first feature: UI](https://www.beignetjs.com/markdown/build-first-resource/ui.md): Connect the authorized projects API to forms, a paginated list, detail and edit screens, cache refreshes, and account-switch cleanup. ## Guides - [Guides](https://www.beignetjs.com/markdown/guides.md): Find practical guides for adopting Beignet, testing features, receiving webhooks, uploading files, sending mail, running background work, and deployment. - [Protect a resource](https://www.beignetjs.com/markdown/guides/protect-a-resource.md): Add session-derived ownership, filtered lists, and policy checks to a generated resource, then test owner, other-account, and anonymous access through use cases and HTTP. - [Connect forms and lists](https://www.beignetjs.com/markdown/guides/forms-and-lists.md): Build a paginated Todo list and contract-validated forms, handle request failures, refresh cached data, and clear private state on sign-out. - [Test a feature from business rule to HTTP](https://www.beignetjs.com/markdown/guides/test-a-feature.md): Test validation, ownership, HTTP errors, idempotency, and SQLite persistence using the starter's real Todos feature. - [Receive a GitHub webhook](https://www.beignetjs.com/markdown/guides/github-webhook.md): Verify signed GitHub issue events, persist opened issues once, test duplicate deliveries, and recover failed deliveries. - [Run a background job](https://www.beignetjs.com/markdown/guides/background-jobs.md): Add background work to the SQLite starter, save a job with a Todo, verify delivery and retries, and keep the outbox drain running in production. - [Send an email](https://www.beignetjs.com/markdown/guides/send-email.md): Configure Resend, send a test email through an operator task, and verify validation and delivery with a memory mailer. - [Upload a file](https://www.beignetjs.com/markdown/guides/upload-file.md): Persist private Todo attachments, authorize downloads, replace files, and retry removals without losing track of stored objects. - [Deploy a Next.js app](https://www.beignetjs.com/markdown/guides/deploy-nextjs.md): Deploy the SQLite starter to Vercel and Turso with production configuration, reviewed migrations, readiness checks, and persistent data. ## Architecture - [Mental model](https://www.beignetjs.com/markdown/concepts.md): Understand Beignet's application architecture: give API contracts, business workflows, and infrastructure clear responsibilities, then add capabilities as features grow. - [App architecture](https://www.beignetjs.com/markdown/app-architecture.md): Decide where a change belongs in a Beignet app, find the files for each production concern, and understand the dependency boundaries checked by the CLI. - [Comparisons](https://www.beignetjs.com/markdown/comparisons.md): How Beignet compares to tRPC, ts-rest, oRPC, Hono, NestJS, AdonisJS, and Laravel-style frameworks — and when each is the better choice. ## Core app model - [Contracts](https://www.beignetjs.com/markdown/contracts.md): Define Beignet API contracts for methods, paths, parameters, responses, errors, metadata, and schema validation. - [Use cases](https://www.beignetjs.com/markdown/application.md): Build validated Beignet use cases with input and output schemas, domain events, instrumentation, and route-handler wiring. - [Agent capabilities](https://www.beignetjs.com/markdown/agent-capabilities.md): Expose typed, validated Beignet use cases through capability registries, MCP tools, and Better Auth Agent Auth. - [Ports and adapters](https://www.beignetjs.com/markdown/ports.md): Define dependency ports for Beignet application code so handlers and use cases stay independent from infrastructure. - [Routes and server](https://www.beignetjs.com/markdown/server.md): Create Beignet servers with typed route handlers, request and response validation, lifecycle hooks, and runtime adapters. - [Request lifecycle](https://www.beignetjs.com/markdown/request-lifecycle.md): Follow a Beignet request through route matching, parsing, hooks, context, handlers, validation, errors, and response ownership. - [Hooks](https://www.beignetjs.com/markdown/hooks.md): Use Beignet server hooks for auth, CORS, logging, tracing, rate limits, response shaping, and error mapping. - [Errors](https://www.beignetjs.com/markdown/errors.md): Handle Beignet server and client errors with AppError, ContractError, structured response envelopes, and safeCall. - [Clients](https://www.beignetjs.com/markdown/client.md): Create fully typed Beignet HTTP clients from your contracts with typed params, responses, errors, and safe calls. - [OpenAPI](https://www.beignetjs.com/markdown/openapi.md): Generate OpenAPI 3.1 documents from Beignet contracts, operation metadata, responses, parameters, and Zod schemas. ## Feature design - [Domain modeling](https://www.beignetjs.com/markdown/domain.md): Use Beignet domain helpers for value objects, entities, domain events, and validated domain modeling. - [Authentication](https://www.beignetjs.com/markdown/authentication.md): Authenticate Beignet requests with auth ports, route metadata, HTTP boundary hooks, and Better Auth. - [Authorization](https://www.beignetjs.com/markdown/authorization.md): Keep Beignet authorization in use cases and app-owned policy functions so business rules run from HTTP, jobs, scripts, and tests. - [Tenancy](https://www.beignetjs.com/markdown/tenancy.md): Resolve tenant scope from verified request state, carry it on context, scope repositories, and enforce tenant boundaries in policies. - [Config](https://www.beignetjs.com/markdown/config.md): Define environment-first Beignet configuration with schema validation, prefix filtering, typed values, and testable config loading. - [Testing](https://www.beignetjs.com/markdown/testing.md): Test Beignet apps at the use-case, route, contract, provider, seed, and resource boundaries. ## Frontend adapters - [React overview](https://www.beignetjs.com/markdown/react.md): Choose Beignet React integrations for server state, URL state, and forms while reusing contract schemas and types. - [React Query](https://www.beignetjs.com/markdown/react-query.md): Create typed TanStack Query options, mutations, query keys, cancellation, and prefetching from Beignet contracts. - [React Hook Form](https://www.beignetjs.com/markdown/react-hook-form.md): Create typed React Hook Form options from Beignet request body schemas and reuse contract validation in forms. - [TanStack Form](https://www.beignetjs.com/markdown/react-form.md): Create typed TanStack Form options from Beignet request body schemas with Standard Schema validation and server error mapping. - [React uploads](https://www.beignetjs.com/markdown/react-uploads.md): Track Beignet upload client state from React components with typed metadata, progress, errors, and completion results. - [nuqs](https://www.beignetjs.com/markdown/nuqs.md): Connect Beignet query schemas to nuqs URL state for typed search, filters, tabs, sorting, and pagination. ## Infrastructure - [Providers](https://www.beignetjs.com/markdown/providers.md): Install Beignet provider adapters for databases, caches, mail, auth, logging, jobs, rate limits, and event buses. - [Database and transactions](https://www.beignetjs.com/markdown/database.md): Use Beignet repository ports, Drizzle adapters, Unit of Work transactions, and after-commit domain events in production apps. - [Encryption](https://www.beignetjs.com/markdown/encryption.md): Encrypt sensitive strings through EncryptionPort, bind values to their context, and manage key generation, rotation, and recovery. - [Cache](https://www.beignetjs.com/markdown/cache.md): Use Beignet's CachePort with Redis or app-owned adapters for cached reads, invalidation, and typed serialization. - [Search](https://www.beignetjs.com/markdown/search.md): Index and query searchable Beignet read models through SearchPort, memory tests, and Meilisearch providers. - [Storage](https://www.beignetjs.com/markdown/storage.md): Use Beignet's StoragePort for object storage, generated files, imports, exports, attachments, and public asset URLs. - [Uploads](https://www.beignetjs.com/markdown/uploads.md): Define typed upload workflows with file constraints, authorization, direct upload signing, completion hooks, and storage-backed objects. - [Payments and billing](https://www.beignetjs.com/markdown/payments.md): Use Beignet's PaymentsPort with Stripe for hosted checkout, billing portal sessions, refunds, verified webhooks, and app-owned billing workflows. - [Webhooks](https://www.beignetjs.com/markdown/webhooks.md): Receive provider webhooks with raw-body signature verification, typed event catalogs, Next.js route adapters, and idempotent handlers. - [Feature flags](https://www.beignetjs.com/markdown/feature-flags.md): Define typed Beignet feature flags, evaluate them through FlagsPort, test them with memory adapters, and adapt OpenFeature providers. - [Mail](https://www.beignetjs.com/markdown/mail.md): Send mail through Beignet's stable MailerPort with Resend, SMTP, memory test adapters, jobs, and devtools. - [Rate limiting](https://www.beignetjs.com/markdown/rate-limiting.md): Protect Beignet routes with contract metadata, rate limit hooks, and Upstash-backed RateLimitPort adapters. ## Background work - [Workflows](https://www.beignetjs.com/markdown/workflows.md): Map Beignet's background work toolbox: events, jobs, schedules, tasks, notifications, idempotency, and outbox, and how they compose into workflows. - [Events](https://www.beignetjs.com/markdown/events.md): Define Beignet domain events, listeners, event buses, and after-commit publishing. - [Broadcasting](https://www.beignetjs.com/markdown/broadcasting.md): Publish typed browser updates through authorized channels, SSE, and memory or Redis providers, with reconnect reconciliation and transactional inbox hints. - [Jobs](https://www.beignetjs.com/markdown/jobs.md): Define typed Beignet jobs, dispatch them locally or durably, and run them through provider adapters such as BullMQ or Inngest. - [Schedules](https://www.beignetjs.com/markdown/schedules.md): Define typed Beignet schedules for cron-triggered workflows, inline testing, and job dispatch. - [Idempotency](https://www.beignetjs.com/markdown/idempotency.md): Make Beignet commands, webhooks, and jobs safe to retry with scoped keys, payload fingerprints, and durable reservations. - [Locks and leases](https://www.beignetjs.com/markdown/locks.md): Coordinate singleton schedules, jobs, outbox drains, and short critical sections with lease-backed LocksPort providers. - [Outbox](https://www.beignetjs.com/markdown/outbox.md): Record Beignet events and jobs transactionally, then drain them after commit with retries and dead-letter handling. - [Notifications](https://www.beignetjs.com/markdown/notifications.md): Define user-facing Beignet notifications above mail, Web Push, jobs, events, and outbox-backed delivery. - [Tasks](https://www.beignetjs.com/markdown/tasks.md): Define typed Beignet operational tasks for backfills and maintenance, register them in server/tasks.ts, and run them with beignet task run. ## Observability - [OpenTelemetry](https://www.beignetjs.com/markdown/observability.md): Export Beignet request, use case, listener, job, schedule, task, and provider telemetry through app-owned OpenTelemetry SDKs. - [Logging](https://www.beignetjs.com/markdown/logging.md): Add structured logging to Beignet apps with LoggerPort, request hooks, Pino, request IDs, and production-safe metadata. - [Error reporting](https://www.beignetjs.com/markdown/error-reporting.md): Report Beignet HTTP, job, schedule, outbox, and task failures through ErrorReporterPort, memory tests, and Sentry providers. - [Audit and activity logging](https://www.beignetjs.com/markdown/audit.md): Record durable Beignet audit logs with actor, tenant, request, resource, and transaction-aware activity metadata. - [Devtools](https://www.beignetjs.com/markdown/devtools.md): Use Beignet devtools to inspect development-time request, error, use case, job, schedule, and provider events. ## Going to production - [Going to production](https://www.beignetjs.com/markdown/deployment.md): Take a Beignet app to production: preflight checks, env validation and secrets, host settings, runtime entrypoints, and the pre-launch security checklist. - [Runtime recipes](https://www.beignetjs.com/markdown/runtime-recipes.md): Choose Beignet runtime entrypoints for web processes, cron routes, outbox drains, workers, provider-backed functions, tasks, and readiness checks. - [Privacy lifecycle](https://www.beignetjs.com/markdown/privacy-lifecycle.md): Design Beignet app retention, export, deletion, anonymization, redaction, and sensitive-data boundaries before production launch. ## Reference - [CLI](https://www.beignetjs.com/markdown/cli.md): Use the Beignet CLI to create apps, generate features, inspect routes, and keep projects aligned. - [Agent tools](https://www.beignetjs.com/markdown/agents.md): Give developers and coding agents a shared application structure, source inspection, generators, and checks, supported by versioned package guidance and MCP tools. - [Instructions for coding agents](https://www.beignetjs.com/markdown/agent-instructions.md): Start agent work in a new or existing Beignet app: select version-appropriate guidance, inspect the source, scaffold a change, and verify the result. - [Packages and imports](https://www.beignetjs.com/markdown/package-reference.md): Map Beignet app responsibilities to the core subpaths, integration packages, providers, and tooling that implement them. - [Stability and releases](https://www.beignetjs.com/markdown/stability.md): Understand Beignet's alpha compatibility policy, matching package versions, release validation, and upgrade expectations. - [Upgrading](https://www.beignetjs.com/markdown/upgrading.md): Upgrade Beignet packages together, review package changelogs, and validate your application after updating. - [Writing a provider](https://www.beignetjs.com/markdown/writing-a-provider.md): Build a Beignet provider package: ports, lifecycle, instrumentation, metadata manifest, and conventions. - [API reference](https://www.beignetjs.com/markdown/api-reference.md): Open the generated Beignet API reference built from public TypeScript exports and TSDoc comments. ## Optional - [Full documentation](https://www.beignetjs.com/llms-full.txt): All guide pages for tools that need the complete corpus.