> For AI agents: the complete documentation index is available at https://dotpress.dev/llms.txt, the full documentation bundle is available at https://dotpress.dev/llms-full.txt.

# Examples

Runnable apps, from one feature to a complete API. Each one is tested by the CI of the repository, and its code is imported in these pages when the site is built: what you read is what runs.

| Example                                                 | What it shows                                                              | Server  |
| ------------------------------------------------------- | -------------------------------------------------------------------------- | ------- |
| [Express](https://dotpress.dev/examples/express.md)     | Routes, validation, returned errors, OpenAPI and Scalar                    | Express |
| [Fastify](https://dotpress.dev/examples/fastify.md)     | Dotpress routes on an existing Fastify instance, on Node.js and AWS Lambda | Fastify |
| [Hono](https://dotpress.dev/examples/hono.md)           | One app on Node.js and AWS Lambda, with native Hono middlewares            | Hono    |
| [Authentication](https://dotpress.dev/examples/auth.md) | Sign-up, login, token rotation, cookie sessions, roles, logout             | Express |
| [Events](https://dotpress.dev/examples/events.md)       | Events emitted by an API, listeners run by a worker through Redis          | Fastify |
| [Mailer](https://dotpress.dev/examples/mailer.md)       | A contact form sending multilingual MJML emails, with previews and SMTP    | Hono    |
| [Cache](https://dotpress.dev/examples/cache.md)         | Memo and batching per request, cache with tags and grace period, Redis     | Express |
| [Tasks API](https://dotpress.dev/examples/tasks-api.md) | A team task manager: every package in one app, organized by feature        | Fastify |

Start with the example of your server, then the one of the feature you need. The [Tasks API](https://dotpress.dev/examples/tasks-api.md) shows how they fit together in a real project.

## Run an example

Every example requires Node.js 22.18 or later, which runs the TypeScript sources directly. Copy it with [degit](https://github.com/Rich-Harris/degit), then install it with your package manager:

```sh
npx degit dotpressjs/dotpress/examples/express my-api
cd my-api
npm install
npm run dev
```

In every example, `npm test` runs the tests and `npm run typecheck` checks the types. The examples that use Redis or an SMTP server work without them: their `compose.yaml` starts them for development.
