--- title: "Beignet" description: "A TypeScript application framework with a clear architecture, integrated production capabilities, and CLI tools to help developers and agents scaffold and check changes." url: "https://www.beignetjs.com/" markdown_url: "https://www.beignetjs.com/markdown/index.md" framework_version: "0.0.65" documentation_scope: "current-checkout" source_revision: "ba3f49c103f3c4515e8ca14e07651fe5b83e2cec" source_modified: true --- An opinionated application framework # A clear architecture for growing TypeScript applications Beignet brings APIs, business workflows, and production infrastructure into one consistent application model. Start with authentication and persistence, add capabilities as you need them, and use the CLI to scaffold and check your changes. [Start building](https://www.beignetjs.com/markdown/getting-started.md) [Build with an agent](https://www.beignetjs.com/markdown/getting-started/agents.md) Next.js handles pages and rendering. Beignet connects your APIs, application behavior, and infrastructure. Start with Next.js or use the [Web Fetch adapter](https://www.beignetjs.com/markdown/server.md#web-fetch-runtimes). [Alpha software](https://www.beignetjs.com/markdown/stability.md). APIs may change between releases. Your next feature A place for every piece ```bash bun beignet make resource projects ``` ```text features/projects/ contracts.ts HTTP API schemas.ts Shared validation use-cases.ts Business workflows ports.ts Dependency interfaces routes.ts Route bindings tests/ Feature behavior ``` The generator also adds repository adapters and registers the feature in your app. Make it yours, then check the result. ```bash bun beignet check ``` [Follow the Projects tutorial](https://www.beignetjs.com/markdown/learn.md) Production concerns, one application model ## Answers for the next requirement Keep business rules in feature workflows, describe APIs with shared contracts, and connect databases and services through typed dependency interfaces. Each new feature follows the same structure. The full-stack Next.js starter includes sign-in, a database-backed Todos feature with ownership checks, and a UI shell. Generators add jobs, uploads, notifications, and other capabilities when you need them. Configure providers for the services and runtime you choose. [Understand the architecture](https://www.beignetjs.com/markdown/concepts.md) Who can read or change this? Identify the caller at the request boundary and enforce ownership in the business workflow. [Add resource ownership](https://www.beignetjs.com/markdown/build-first-resource/ownership.md) with authentication and feature policies. How do I run work reliably after a request? Save work alongside the database change, then deliver it through an outbox and retry failed jobs. [Build a background workflow](https://www.beignetjs.com/markdown/guides/background-jobs.md). How do I handle files and messages? Use shared application ports to [send email](https://www.beignetjs.com/markdown/guides/send-email.md), [accept private uploads](https://www.beignetjs.com/markdown/guides/upload-file.md), and [deliver notifications](https://www.beignetjs.com/markdown/notifications.md) through configured providers. How do I inspect failures and deploy changes? Follow requests in [devtools](https://www.beignetjs.com/markdown/devtools.md), [test feature behavior](https://www.beignetjs.com/markdown/guides/test-a-feature.md), and [deploy with migrations and readiness checks](https://www.beignetjs.com/markdown/guides/deploy-nextjs.md). See the boundaries work together ## Keep the whole feature connected A feature owns its API, business rules, and dependencies. Change the Projects name limit from 120 to 24 characters, try the form, and follow that rule through the contract, use case, client, and checks. The Projects tutorial uses `CreateProjectInputSchema` for request and use-case validation. The form derives validation from the create contract, and OpenAPI describes the same input. Tightening the name limit rejects “Customer onboarding portal” with HTTP 422; the original limit accepts it with HTTP 201. ```diff --- a/features/projects/schemas.ts +++ b/features/projects/schemas.ts @@ -97,5 +97,5 @@ export const CreateProjectInputSchema = z.object({ - name: z.string().trim().min(1).max(120), + name: z.string().trim().min(1).max(24), description: z.string().max(500).optional(), }); ``` [Read the contract](https://www.beignetjs.com/markdown/build-first-resource.md#read-the-contract), [enforce ownership in the use case](https://www.beignetjs.com/markdown/build-first-resource/ownership.md#enforce-it-in-every-use-case), [build the form](https://www.beignetjs.com/markdown/build-first-resource/ui.md#build-the-projects-list), and [try the API](https://www.beignetjs.com/markdown/build-first-resource.md#see-it-respond). One contract across the stack Define the API shape once. Request validation, typed client calls, React adapters, and OpenAPI use the same contract. [Explore contracts](https://www.beignetjs.com/markdown/contracts.md) Business rules you can reuse Put application behavior in use cases. Call them from routes, jobs, or scripts, and test them with in-memory dependencies. [Explore use cases](https://www.beignetjs.com/markdown/application.md) Infrastructure with a defined place Use typed ports for the dependencies a workflow needs. Connect databases and external services in adapters, and supply in-memory implementations in tests. [Explore ports and adapters](https://www.beignetjs.com/markdown/ports.md) Conventions you can check ## Keep the structure as you make changes If a use case imports a database adapter from `infra/`, `beignet lint` reports the dependency violation. Access storage through the feature's port and wire the adapter in infrastructure, so the business workflow can run with different dependencies in tests. `beignet check` runs architecture linting, strict wiring diagnostics, and the app's configured lint, typecheck, and test scripts. These checks catch specific boundary and setup mistakes; your tests verify the feature's behavior. [See what the CLI checks](https://www.beignetjs.com/markdown/cli.md#check) For developers and agents ### A shared way to understand and change the app Predictable file locations and dependency rules give an agent a structure to follow. The CLI can map the app, explain a feature, scaffold its next piece, and return check failures to work through. Versioned package guidance, generated app instructions, and MCP tools support the same workflow. Review the behavior and checks together. [Build with an agent](https://www.beignetjs.com/markdown/getting-started/agents.md) · [Explore agent tools](https://www.beignetjs.com/markdown/agents.md) Learn by building ## From an API to a feature you can use Build a Projects feature with persistent data, account ownership, and a React UI. Learn where each responsibility belongs through three chapters, with a working result and checks at every stage. [Build your first feature](https://www.beignetjs.com/markdown/learn.md) ### Build the API Generate the resource, add a field, and follow it into the database. ### Add ownership Enforce who can read and change each project, then test those rules. ### Connect the UI Create, list, edit, and delete projects through a typed client. ## Built for early explorers Beignet is alpha software. Evaluate it for TypeScript products with a REST API, persistent data, authorization, and workflows beyond a request. APIs can change between `0.0.x` releases. [Stability and releases](https://www.beignetjs.com/markdown/stability.md) [Upgrade guide](https://www.beignetjs.com/markdown/upgrading.md) [Packages and imports](https://www.beignetjs.com/markdown/package-reference.md)