0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
Elysia Plugin · Bun Runtime · Collection First

LUCENT

LUCENT

The code-first backend engine that ships as an Elysia plugin. Define collections in TypeScript and Lucent gives you CRUD, auth, migrations, auto-generated OpenAPI docs, realtime, and background jobs from one config.

bunx create-lucent my-api

OpenAPI

/api/docs on startup

Typegen

lucent-types.ts

Realtime

WS + SSE ready

scroll

// what it does

Define collections.
Everything else is generated.

Lucent is an Elysia plugin, not a standalone server.

Collections generate CRUD routes, auth, and uploads.

Realtime, queues, and generated docs are built in.

Filtering, sorting, pagination, and relationship depth are built in.

Fields, access rules, hooks, and endpoints stay in code.

Startup runs config validation and additive migrations.

Type generation keeps your API surface in sync.

lucent-types.ts keeps the API surface typed end to end.

// core features

Batteries included.
Opinions optional.

🛡️

Access Control

Per-operation and per-field access functions can return booleans or scoped filters, which keeps authorization next to the collection code.

Auto CRUD API

Define a collection and Lucent generates GET, POST, PATCH, and DELETE routes with pagination, filters, sorting, and relationship depth.

🗃️

Auto Migrations

Non-destructive schema changes run on startup. Tables are created, columns are added, and your code stays versioned instead of drifting.

🔐

Auth Built-In

JWT, session, and API key strategies resolve per request. Register, login, refresh, forgot, and reset ship from a single auth flag.

⚙️

Bun Queue Jobs

SQLite-backed background jobs are built into the core so email, heavy compute, and follow-up tasks leave your request handlers fast.

✉️

Email Flows

Welcome mail, verification, forgot password, and reset-success flows ship with configurable transports so auth can stay production-ready.

🪝

Lifecycle Hooks

Transform data before writes, trigger side effects after changes, and fan out events or queue jobs from hooks without scattering logic.

📝

OpenAPI + Docs

Scalar docs are auto-generated from your collections and routes, including documented success payloads, filters, and error responses.

🚦

Rate Limits + Cache

Built-in rate limiting and optional response caching help protect auth and collection endpoints without bolting on extra middleware later.

📡

Realtime

WebSockets and SSE plug into the same Lucent auth story, so broadcasts and subscriptions can stay collection-aware instead of ad hoc.

📦

Type Generation

lucent-types.ts is regenerated on startup so your API surface, collections, and local scripts keep a shared source of truth.

🗂️

Uploads + Storage

File uploads work through the same API with local or S3-backed storage, access control, and served asset URLs out of the box.

// define everything in code

TypeScript in.

Full backend out.

Generated backend

Collections and config from one Lucent setup

v0.13.0
lucent.config.ts
1import { defineLucentConfig } from "@codesordinatestudio/lucent";23export default defineLucentConfig({4  db: { adapter: "postgres", url: Bun.env.DATABASE_URL },5  auth: {6    strategies: ["jwt", "session", "apiKey"],7    jwt: { secret: Bun.env.JWT_SECRET! },8  },9  api: { prefix: "/api", cors: { origin: "*" } },10  openapi: { enabled: true, path: "/api/docs" },11  collections: Collections,12});

→ Generated output from the above

Lucent also generates an interactive OpenAPI + Scalar documentation UI at /api/docs, including documented 200, 201, and error payloads for your routes.

GET /api/posts
GET /api/posts/:id
POST /api/posts
PATCH /api/posts/:id
DELETE /api/posts/:id
POST /api/auth/register
POST /api/auth/login
POST /api/auth/refresh
GET /api/auth/me
GET /api/docs

// field types

14 field types.
Mapped to PostgreSQL automatically.

array

JSONB

boolean

BOOLEAN

date

TIMESTAMPTZ

email

TEXT

integer

INTEGER

json

JSONB

multiselect

TEXT[]

number

NUMERIC

password

TEXT (hashed)

relationship

UUID

richtext

JSONB

select

TEXT

text

TEXT

upload

JSONB

// query power

Filter. Sort. Paginate.
Out of the box.

PaginateGET /api/posts?page=2&limit=25
SortGET /api/posts?sort=-createdAt,title
FilterGET /api/posts?where={"status":{"eq":"published"}}
DepthGET /api/posts?depth=1
RelationshipsGET /api/posts?depth=1&where={"author":{"exists":true}}
CompoundGET /api/posts?where={"or":[{"status":{"eq":"published"}},{"author":{"eq":"me"}}]}

Operators: eq · neq · gt · gte · lt · lte · in · nin · exists · like — combinable with and/or.

Depth controls relationship population: depth=0 returns IDs, depth=1 includes related docs, and Lucent caps it at 2.

// built on

Proven stack.
Zero compromises.

Bun

Runtime ≥ 1.3.10

ElysiaJS

HTTP framework

PostgreSQL

Adapter

Redis

Queue storage

Zod

Validation

Pino

Structured logging

BullMQ

Job processing

Scalar

OpenAPI docs

// get started

Three commands.
Full backend.

$bunx create-lucent my-api
$cd my-api && bun install
$bun run dev
→ API at localhost:3000/api · Docs at localhost:3000/api/docs · WebSocket at localhost:3000/ws