- Routing, middleware, rendering, the request lifecycle — and it is good at all of it.
- The architecture is left to you: a dozen terms that every team, book and agent reads a little differently.
- The files go wherever you put them, and nothing checks that a dependency points the right way.
Not another framework.
The part frameworks leave to you.
Domain First does not replace Next.js, Nest or anything else, and it does not compete with them. It fills the gap they leave.
- One meaning for every term: aggregate, repository, use case, port — written down in the conventions.
- A scaffolder that puts each piece in its place and keeps the layers honest.
- A few small libraries that make domain code pleasant to write. Nothing more.
Keep the framework you have. We take care of everything that is not it.
Small parts.
One foundation.
Focused tools for the code inside your application — and one structure that holds them together.
-
Compact NPM libraries:
types,errors,wire,handlers. - Each one solves a single problem. Take the ones you need, leave the rest.
- Plain TypeScript at runtime — no framework to adopt, nothing to fight.
- The scaffolder gives every domain model, handler and endpoint a predictable home.
- Layers stay apart: domain, application, infrastructure, presentation.
- Wiring connects the pieces, so every part works with the rest.
Use one library or all of them. They were built to fit together.
How to start.
Three steps.
From an empty package to your first bounded context in less than a minute.
-
STEP 01 / INSTALL●
Add the CLI.
npm i -D @domain-first/project-structureProject Structure is a dev dependency: it generates code and never ships with your app.
-
STEP 02 / INITIALIZE■
Choose your packages.
npx df-psAnswer the setup questions. Pick the
@domain-firstpackages you need with space, or press a to select them all.THENCopy the install command the CLI prints for your selection and run it.
-
STEP 03 / SCAFFOLD▲
Generate the structure.
npx df-psRun it again to open the scaffolder menu: create a bounded context, pick a layer, generate one piece at a time.
That's the whole setup. Everything after is your domain.
Human first.
AI friendly.
Code you enjoy writing and maintaining — and that your agent finds its way around too.
-
Names come from the business:
Order,CancelOrder, not managers and utils. - Every component has one predictable home. You know where to look before you open the editor.
- Bounded contexts stay apart, so changing one never surprises you in another.
- Conventions instead of guesswork: the same rules you follow, written down where it can read them.
-
New files come from
df-ps, not improvisation. Every scaffold looks like the last one. - Skills teach the workflow: plan, get your approval, scaffold, implement.
Nothing here is written for the machine. That's exactly why it works for one.