Loading...
Loading...
Expert guide for building APIs with the Elysia framework, including routing, validation, plugins, error handling, and type-safe handlers. Use when building APIs with Elysia framework, defining routes, plugins, or type-safe handlers.
npx skill4agent add pedronauck/skills elysiareferences/patterns.mdnew Elysia({ prefix })src/modules/<feature>/index.tssrc/modules/<feature>/service.tssrc/modules/<feature>/model.tstsrc/utils/*.use()model.tst.Object(...)typetypeof schema.staticservice.tsabstract classindex.tsguard()import { t } from 'elysia'typeof schema.staticexport type SignInBody = typeof signInBody.static.guard({ ... })schema: 'standalone'fileTypebody/query/params/headers/cookie/responset.Objectt.Arrayt.Uniont.Literalguard().onError(({ code, error, path, request }) => { ... }){ ok: false, error: { code, message, details } }throw status(code, messageOrPayload)onErrorreturn status(...)onErrorx-request-idonError{ ok: true, data }src/plugins/error.ts.onError(...)src/plugins/logging.tsonResponseonError@elysiajs/openapi@elysiajs/jwtuser.guard({ headers: t.Object({ authorization: t.String() }) })@elysiajs/cors@elysiajs/server-timing@elysiajs/opentelemetrysrc/plugins/openapi.tssrc/plugins/auth.tssrc/app.tsindex.tsserver.ts--minify--externalprocess.env.PORT0.0.0.0CMD ["./server"]src/index.tssrc/server.tsDockerfilevitestapp.handle(new Request(url, options))bodyAuthorization.state().decorate(){ store, getDate }.ws().onParse()model.tsservice.tsindex.ts.onError()app.handle(new Request(...))pnpm run typecheckpnpm run testreferences/patterns.md