StartXKit docs

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, or bun
  • A terminal in the folder where you want to create the project

Create A Project

Run:

npm create @startxkit@latest

The create command opens an interactive prompt. You can accept the defaults for a quick first project.

For a first run, choose:

PromptRecommended valueWhy
FrameworkExpressFamiliar and easy to inspect
ArchitectureModularClear feature folders without too much structure
API prefix/api/v1Keeps API routes grouped
CORSYesUseful for frontend development
Env configYesCentralizes PORT and environment values
ValidationZodGives generated modules a validation path
LoggerPino or ConsoleMakes server activity visible
Error handlerYesAdds a predictable error response shape
Dependency injectionYesMakes generated modules easier to test
TestingVitestAdds a test script
DockerOptionalChoose yes only if you need container files

Prompt Reference

The CLI currently asks for:

  1. Project name
  2. Language, currently TypeScript
  3. Framework: Express, Fastify, or Hono
  4. Architecture: Minimal, Modular, or Layered
  5. API prefix
  6. Package manager
  7. CORS
  8. Env config
  9. Request validation
  10. Logger
  11. Error handler
  12. Dependency injection
  13. Testing setup
  14. Docker
  15. Dependency installation

Run The Project

Move into the generated folder:

cd my-api

Install dependencies if you did not install them during generation:

pnpm install

Start the dev server:

pnpm dev

Visit:

http://localhost:4000/api/v1/health

You should see a JSON response with success: true.

Add Your First Module

Inside the generated project, run:

npx @startxkit/cli add module users

Choose 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 creation

If the project feels too small for controllers and services, choose minimal. If it needs strict separation for a larger team, choose layered.