Getting Started
Create your first StartXKit project and understand each prompt.
This tutorial creates a working backend API and explains the choices you make during setup.
Prerequisites
You need:
- Node.js installed
- One package manager:
pnpm,npm,yarn, orbun - A terminal in the folder where you want to create the project
Create A Project
Run:
npm create @startxkit@latestThe create command opens an interactive prompt. You can accept the defaults for a quick first project.
Recommended First Project
For a first run, choose:
| Prompt | Recommended value | Why |
|---|---|---|
| Framework | Express | Familiar and easy to inspect |
| Architecture | Modular | Clear feature folders without too much structure |
| API prefix | /api/v1 | Keeps API routes grouped |
| CORS | Yes | Useful for frontend development |
| Env config | Yes | Centralizes PORT and environment values |
| Validation | Zod | Gives generated modules a validation path |
| Logger | Pino or Console | Makes server activity visible |
| Error handler | Yes | Adds a predictable error response shape |
| Dependency injection | Yes | Makes generated modules easier to test |
| Testing | Vitest | Adds a test script |
| Docker | Optional | Choose yes only if you need container files |
Prompt Reference
The CLI currently asks for:
- Project name
- Language, currently TypeScript
- Framework: Express, Fastify, or Hono
- Architecture: Minimal, Modular, or Layered
- API prefix
- Package manager
- CORS
- Env config
- Request validation
- Logger
- Error handler
- Dependency injection
- Testing setup
- Docker
- Dependency installation
Run The Project
Move into the generated folder:
cd my-apiInstall dependencies if you did not install them during generation:
pnpm installStart the dev server:
pnpm devVisit:
http://localhost:4000/api/v1/healthYou should see a JSON response with success: true.
Add Your First Module
Inside the generated project, run:
npx @startxkit/cli add module usersChoose a layer depth. For a normal feature module, Route + Controller + Service is a good starting point.
Mental Model
project
|
+-- framework decides how HTTP is handled
|
+-- architecture decides where files live
|
+-- feature flags decide which support files are generated
|
+-- add module grows the project after creationIf the project feels too small for controllers and services, choose minimal. If it needs strict separation for a larger team, choose layered.