Guides
File-based APIs
Export HTTP methods from api/*.ts. The filename is the path.
Each file under api/ becomes a route. api/planets.ts serves /planets. Nested folders work the same way: api/v1/items.ts serves /v1/items.
Export get, post, put, patch, or delete as defineApi(...) handlers.
Handler context
- db — Drizzle client for the project's tenant database.
- query — parsed query string when you pass query.
- body — parsed JSON body when you pass body.
- headers — incoming request headers.
Swagger
After deploy, open /docs on the project host for the generated OpenAPI. The dashboard also embeds that page under a project's Swagger tab.