@effect/platform’s HTTP API modules and mount them onto Convex’s HTTP router. It includes built-in interactive API documentation powered by Scalar.
Defining endpoints
Define your API groups and endpoints using@effect/platform.
confect/http/notes.ts
Implementing handlers
Implement your endpoint handlers in the same file usingHttpApiBuilder. All Confect action services (QueryRunner, MutationRunner, ActionRunner, Scheduler, Auth, StorageReader, StorageWriter, StorageActionWriter) are available in handlers.
confect/http/notes.ts (continued)
Creating the router
Create the Convex HTTP router inconfect/http.ts using HttpApi.make from @confect/server. Each key is a path prefix that must be either "/" or end with a trailing slash (e.g. "/api/").
confect/http.ts
| Property | Description |
|---|---|
apiLive | A Layer providing HttpApi.Api, built with HttpApiBuilder.api |
middleware | Optional middleware function (e.g. HttpMiddleware.cors(), HttpMiddleware.logger) |
scalar | Optional Scalar configuration to customize the interactive API docs |
API documentation
Interactive API docs are automatically served at{pathPrefix}docs (e.g. /api/docs). The docs are powered by Scalar and generated from your endpoint definitions and OpenApi annotations.