Docs

Guide 01

Thesis

01. Thesis

Why Avelon exists, who it's for, and the 3 mechanisms that keep a codebase in the shape it was generated in.


The Problem

TypeScript gives you types and takes away opinions.

Every Next.js codebase reinvents the same decisions:

  • where models live
  • whether there's a service layer
  • how data gets from the database to a component
  • where authorization is checked
  • what belongs in lib/

None of those decisions are hard on their own. The cost is that:

  • every project answers them differently
  • every new hire relearns them
  • nothing enforces the answer after the person who made it moves on

6 months in:

  • lib/ is 4,000 lines of unrelated helpers
  • 3 files construct their own Supabase client
  • authorization happens in 2 different layers, depending on who wrote the route
  • finding the code that writes to a table means grepping for the table name

Opinionated server frameworks solved this socially and structurally:

  • one place for each kind of thing
  • a generator that puts it there
  • a community that agrees on the shape, because the framework shipped with an opinion instead of a configuration option

Who This Is For

Someone who wants a prescribed application shape in TypeScript, and who's building on Next because that's where the team, the host, or the client already is.

Next is good at rendering. It has no answer to "where does this go."

If you've used a framework that did, that silence reads as chaos. If you haven't, you still pay for it: every teammate invents a slightly different lib/.

If you can stay on a stack that already answers this, stay. Avelon is for when the app is going to live in TypeScript and you still want one place for each kind of thing.


What Success Looks Like

  • You clone an Avelon project and know where everything is without opening a single doc
  • You run 1 command and get a model, a migration, a factory, a controller, a policy, and a ward in the places the directory map promised
  • You write a controller that reads like a controller
  • 6 months later the codebase still looks like the day it was generated, because the linter wouldn't let it drift

The negative test matters more: if someone can create a mess in Avelon and CI stays green, that is a bug.


The 3 Mechanisms

Opinions in a README are advice. Opinions in tooling are decisions. Avelon carries the thesis in 3 shipped features.

1. Generators

There's exactly one way to create each kind of thing, and it's a command.

Nobody hand-creates a controller and puts it somewhere reasonable-looking, because reeve make:controller is faster than deciding.

2. Bailiff

An ESLint plugin plus a CLI. It enforces these rules:

  • views can't import models
  • database calls can't appear in components
  • there's no lib/
  • generated files can't be hand-edited
  • every model has a ward
  • every write validates through a Request

Violations show up as editor squiggles, so nobody has to remember to leave a code review comment.

3. Documentation Conventions

Packages in a living ecosystem read alike when the docs set a register and tooling enforces it:

  • reeve make:package scaffolds the structure
  • reeve docs:check fails a package whose README omits a public method or has a code block that doesn't parse

What Avelon Is Not

  • Not a boilerplate. A template is a snapshot you fork and diverge from. This is a dependency you upgrade
  • Not a Supabase wrapper. Supabase is the first driver. See 04-drivers.md
  • Not Next-only. Next is the first adapter. See 03-architecture.md
  • Not a theme pack of cute names. New ideas get their own words so they stay guessable. Controllers are still called controllers. See 10-conventions.md