Docs

Avelon

A TypeScript framework for Next.js apps. Each kind of code has one home, generators write it there, and a linter fails the build when a file crosses a boundary.

bunx --package @avelonjs/cli reeve new my-app
cd my-app && bun install && bun run dev

Each kind of code has one home

One command writes a resource into the directory map, so the next developer finds every piece where the last one put it.

bunx --no-install reeve make:model Post -mfcp --resource
app/Models/Post.ts
the model
app/Wards/PostWard.ts
which rows each actor may reach
app/Policies/PostPolicy.ts
which actions each actor may take
app/Http/Controllers/PostController.ts
the seven resource actions
app/Http/Requests/PostRequest.ts
input validation for each write
resources/views/pages/posts.tsx
the pages the controller renders
database/migrations/…_create_posts_table.ts
the table
app/Providers/AppProvider.ts
registers the ward and the policy

A write, end to end

The route names the controller action.

The action validates through a Request before anything reaches the model. Bailiff fails a write that skips it.

The ward is added to every query on the table, so another user’s rows stay out of reach even when a query forgets its where clause.

// routes/web.ts
Route.resource('posts', PostController)

// app/Http/Controllers/PostController.ts
export class PostController {
  async store(request: HttpRequest) {
    const input = await PostRequest.validate(request)
    await Post.create({ id: crypto.randomUUID(), ...input })
    return redirect(route('posts.index'), 303)
  }
}

// app/Wards/PostWard.ts
export const PostWard: WardAbilities = {
  read: () => true,
  insert: (actor) => actor !== null,
  update: (actor) => (actor ? { user_id: actor.id } : false),
  delete: (actor) => (actor ? { user_id: actor.id } : false),
}

What keeps it that way

  • Generators write it

    reeve writes each file where the map says it goes and registers what needs registering. Every generated file passes the app’s bun run check.

    CLI guide
  • Bailiff holds the shape

    An ESLint plugin fails the build when a view imports a model, a write skips validation, or a model has no ward.

    Linting guide
  • Drivers keep vendors swappable

    Postgres, Neon, Supabase, and Resend sit behind one contract per service. A method the configured driver lacks is a compile error.

    Drivers guide
  • Wards scope every query

    Row access is declared once in TypeScript. Every model query on the table carries it, so a missing where clause cannot leak rows.

    Authorization guide

Look up a name

Each row maps a job to the Avelon name, path, or command you reach for.

CLI

18 names

CLI
reeve
Bare reeve opens a TUI; arguments skip it.
new project
reeve new my-app
A standalone app with routes, a form, and tests.
REPL
reeve tinker
Models loaded; await on any line.
about
reeve about
App, drivers, and package versions.
health check
reeve doctor
Bailiff, wards, config, and router in one exit code.
route list
reeve route:list
--json for scripts.
migrate
reeve migrate
Loads avelon.config.ts. Migrations are driver-owned.
seed
reeve db:seed
explain row access
reeve ward:explain Post
The SQL each ward rule adds, for a guest and an actor.
list listeners
reeve event:list
Event, listener, delivery, queue, and tries.
publish stubs
reeve stub:publish
Ejects generator templates.
make model
reeve make:model -mfcp --resource
Always writes a ward; -p adds a policy. Registers both.
make controller
reeve make:controller --resource
Seven actions, two requests, and four pages.
make request
reeve make:request
make policy
reeve make:policy
Registers it for its model.
make errand
reeve make:errand
Registers it.
make listener
reeve make:listener --event= --queued
--event registers it; --queued adds retries.
make auth
reeve make:auth

HTTP

11 names

web routes
routes/web.ts
Source of truth; codegen is one-way.
resource routes
Route.resource
Seven REST actions.
route binding
.bind('post', 'Post')
The kernel resolveBinding option loads the row; a miss is 404.
controllers
app/Http/Controllers
TypeScript classes in a fixed directory.
form requests
app/Http/Requests
Zod parse plus an authorize hook.
middleware
app/Http/Middleware
Kernel runs aliases, including auth.
serializers
app/Http/Views
Models never cross the view boundary.
views
view(ref, props)
Opaque view references; the adapter renders.
route helper
route(name, params)
Resolves from the registered routes.
typed URLs
url(name, params)
From framework/routing/urls.generated.ts; safe in client components.
writes
generated server actions
Writes leave the GET URL (D9).

Data

14 names

models
Scrivener (@avelonjs/orm)
Produces Query IR; never a vendor builder.
query IR
Query IR
Drivers compile it. Semantics are frozen.
transactions
database.transaction()
Only on driver types that declare transactions: true.
row access
Wards
Query predicates on every driver; RLS on Supabase.
soft deletes
softDeletes
fillable
static fillable
casts
static casts
eager load
with() → RelationLoad
Eager loads are explicit IR.
paginate
paginate()
Count mode plus a page of rows.
findOrFail
findOrFail
Raises NotFound, mapped to 404.
lifecycle hooks
ModelLifecycle events
migrations
driver-owned migrations
plan, apply, rollback, status (D13).
factories
assay defineFactory
seeds
database/seeds

Auth and authorization

7 names

policies
Policies
May this actor perform this action.
gate
Gate
can and authorize.
row access
Wards
Which rows may this actor reach.
identity
identity driver + reeve make:auth
social login
social driver
API tokens
tokens driver (Signet)
current user
Gate.actor()
Never call the identity vendor from app/.

Async work

8 names

background work
Errands
Three delivery modes: sync, after, queued.
queued delivery
delivery: 'queued'
drain worker
reeve errand:work
Drains errands queued in the same process.
failed jobs
reeve errand:failed
events
Events / Listeners
Sync and ordered by default (D16).
notices
Notices + notifications driver
mail
@avelonjs/resend
Mail driver; vendor stays in config.
queue dashboard
Vigil
Named, not built.

Frontend and runtime

7 names

pages
RSC via @avelonjs/next
Next is the first adapter, not the core.
bundler
Next bundler
Tailwind
Tailwind 4
No bundled UI kit (D20). The SaaS starter uses it; reeve new ships plain CSS.
files
storage driver
Signed uploads are deferred (D28).
cache
cache contract + fake
v1 ships the contract and a fake.
realtime
realtime contract + fake
v1 ships the contract and a fake.
local serve
bun + next dev
Node is the default deployed runtime (D27).

Tooling and packaging

15 names

package manager
bun / npm @avelonjs
The framework is a dependency (D19).
formatter
Prettier
Shipped config. Formatting is not a decision.
tests
bun test + Assay
typecheck
tsc strict
plus noUncheckedIndexedAccess.
architecture lint
Bailiff
Opinions in a linter, not a README.
service registry
typed registry + providers
No IoC container (D17).
providers
app/Providers/AppProvider.ts
registerApp(), called from avelon.config.ts. Generators add to it.
facades
capability-narrowed facades
Missing methods are compile errors.
config
avelon.config.ts
Drivers and boot. Vendor names live here and in drivers.
local environment
Hearth
The local environment name.
admin panel
Moot
Named, not built.
introspection
reeve doctor
Plus about, ward:explain, and event:list.
feature flags
flags contract + fake
v1 ships the contract and a fake.
search
search contract + fake
payments
payments contract + fake