Better-TS-Stack

Getting Started

Quick start guide for better-ts-stack, an interactive CLI for scaffolding TypeScript projects

What is better-ts-stack?

better-ts-stack is an interactive CLI that generates TypeScript projects. You choose the framework, database, authentication, and Docker setup from a few prompts, and the CLI writes a project that is ready to install and run.

Good for

  • Starting a new TypeScript backend or full-stack project
  • Prototyping an API with Express or NestJS
  • Learning how a TypeScript project is structured
  • Using the same project setup across a team

Quick Start

Run the CLI

npx better-ts-stack

Answer the prompts

The CLI asks, in order (every prompt can also be answered with a flag):

  1. Project name - becomes your folder name and package.json name
  2. Application type - Backend API or Full-stack
    • Backend: select a framework (Express or NestJS)
    • Full-stack: select a frontend framework (Next.js 16 or TanStack Start)
  3. Database type - none, PostgreSQL, or MongoDB
  4. ORM/ODM (only shown when a database is selected)
    • PostgreSQL -> Prisma or Drizzle
    • MongoDB -> Mongoose
  5. Package manager - npm, pnpm, or bun
  6. Docker - include Docker configuration?
  7. Authentication - add auth?
    • Express / NestJS: JWT-based auth (always available when asked)
    • Next.js / TanStack: Better Auth (only prompted if a database was selected)
  8. Rate limiting - Express / NestJS only: limit requests per IP?
  9. CI - add a GitHub Actions workflow?
  10. AI agents - add an AGENTS.md for coding agents?
  11. VS Code - add workspace settings and recommended extensions?
  12. Git - initialize a repository?
  13. Install dependencies - run the install command now?

The CLI does not ask for a port number. The server port defaults to 3000 via the PORT environment variable.

Start developing

cd your-project-name
npm install   # skip if you chose to install during setup
npm run dev

What's Included

Backend API

Express or NestJS server with TypeScript, security headers, CORS, and a health check endpoint

Full-stack App

Next.js 16 or TanStack Start with React 19, Tailwind CSS v4, and file-based routing

Type-safe Database

PostgreSQL with Prisma or Drizzle, or MongoDB with Mongoose - your choice

Authentication

JWT + bcrypt for Express and NestJS, Better Auth (with Prisma, Drizzle, or MongoDB adapter) for Next.js and TanStack Start

Docker Ready

Multi-stage Dockerfile and docker-compose.yml generated on request

Developer Tooling

ESLint 10, Prettier, TypeScript strict mode, and hot reload already set up

Requirements

  • Node.js 24.0.0 or higher
  • Package manager - npm, pnpm, or bun

Check your Node.js version before running: node --version

Next Steps


Need Help?

On this page