Skip to content
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.

Next.js handles pages and rendering. Beignet connects your APIs, application behavior, and infrastructure. Start with Next.js or use the Web Fetch adapter.

Alpha software. 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

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

Who can read or change this?

Identify the caller at the request boundary and enforce ownership in the business workflow. Add resource ownership 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.

How do I handle files and messages?

Use shared application ports to send email, accept private uploads, and deliver notifications through configured providers.

How do I inspect failures and deploy changes?

Follow requests in devtools, test feature behavior, and deploy with migrations and readiness checks.

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.

Name limit
Maximum project name length
Try the form
Switch to 24 characters, then shorten the name to make it valid again.
Passes validation.
Validation runs in your browser. No project is saved.
features/projects/schemas.ts
The contract uses the shared schema to validate requests and describe the API.
Read the contract
features/projects/contracts.tsexcerpt
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

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

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

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

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 · Explore agent tools

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

  1. Build the API

    Generate the resource, add a field, and follow it into the database.

  2. Add ownership

    Enforce who can read and change each project, then test those rules.

  3. 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.