Examples Index

Docs Home | Previous: createApp Config Reference | Next: Production Checklist

Runnable examples are under the repository examples/ directory. They are numbered in order of increasing complexity.

ExampleFocus
01_hello-worldMinimal single-route server
02_crudCRUD endpoints, DTOs, exceptions, Swagger UI, error formatter
03_multi-controllerMultiple controllers and metadata decorators
04_dependency-injectionProviders, token injection, and service decorators
05_modulesModule imports/exports and visibility
06_guardsGuards, security guard mapping, role checks, @Security decorator
07_interceptorsResponse transformation and short-circuiting
08_loggingAsyncLocalStorage request context and caller tags
09_complexMulti-module composition
10_mvcServer-side rendering with @Render and Handlebars
11_jwt-authJWT Bearer API auth with TypeORM, DataSource DI, Bun.password, and jose
12_form-authForm-based web auth with JWT-in-cookie, DataSource DI, and Handlebars views
13_typeorm-relationsTypeORM one-to-many / many-to-one relations with DataSource DI
14_session-authStateful server-side sessions with HttpOnly cookie, DataSource DI, and Handlebars

How To Run An Example

cd examples/01_hello-world bun server.ts