An interactive CLI that scaffolds TypeScript backend and full-stack projects.
Answer a few prompts to pick a framework, database, authentication, and Docker setup. The CLI writes a project that is ready to install and run.
- Interactive prompts, no flags or subcommands
- Only the modules you select are added
- Backend API template (Express.js with TypeScript)
- Full-stack templates (Next.js 16 or TanStack Start with React)
- Database integration: PostgreSQL (Prisma or Drizzle) or MongoDB (Mongoose)
- Authentication: JWT for Express, Better Auth for Next.js and TanStack Start (requires a database)
- Optional Docker support with multi-stage builds
- TypeScript with strict mode enabled
- ESLint + Prettier pre-configured
- Hot reload for development
# Using npx (recommended)
npx better-ts-stack
# Or install globally
npm install -g better-ts-stack
better-ts-stackAnswer the prompts and the CLI creates the project folder.
The CLI guides you through these questions in order:
- Project name — becomes the folder name and
package.jsonname - Application type —
Backend APIorFull-stack- Backend: prompts for framework (Express; NestJS coming soon)
- Full-stack: prompts for frontend framework (
Next.jsorTanStack Start)
- Database type —
none,PostgreSQL, orMongoDB - ORM/ODM (if a database is selected):
- PostgreSQL →
PrismaorDrizzle - MongoDB →
Mongoose
- PostgreSQL →
- Package manager —
npm,pnpm, orbun - Docker — include Docker configuration? (yes/no)
- Authentication — add auth?
- Express: JWT-based auth (always available)
- Next.js / TanStack Start: Better Auth (only prompted when a database is selected)
- Git — initialize a git repository? (yes/no)
- Install dependencies — run the install command now? (yes/no)
Note: The CLI does not ask for a port. The server port defaults to
3000via thePORTenvironment variable.
A generated project includes:
- TypeScript in strict mode across all generated files
- ESLint and Prettier configuration
- Environment variable setup (
.env.example/.env) - A health check endpoint (
GET /health) for backend projects - Database connection and ORM setup (if selected)
- Authentication scaffolding (if selected)
- Docker files (if selected)
- Optional git repository initialization
- Express.js server with TypeScript
- Middleware:
cors,helmet,morgan - Health check route at
/health dev,build,start,lint,format,type:checkscripts
- Next.js 16 with React 19 and App Router
- Tailwind CSS v4
dev,build,start,lintscripts- A proxy configuration file (
proxy.ts) rendered from a Handlebars template
- TanStack Start (React) with TanStack Router, React Query, and SSR
- Tailwind CSS v4
- Vite-based build (no Nitro) producing
dist/server/server.js+dist/client - Production serving via
srvx(startscript, also used in Docker) ~/*path alias andcomponents.json(shadcn-style) configured for UI componentsdev,build,start,preview,type:check,lintscripts- Auth routes use server functions (
createServerFn) with cookie-based sessions
| Combination | Template files generated |
|---|---|
| PostgreSQL + Prisma (Express) | prisma/schema.prisma, src/lib/prisma.ts |
| PostgreSQL + Prisma (Next.js / TanStack) | prisma/schema.prisma, lib/prisma.ts / src/lib/prisma.ts, prisma.config.ts |
| PostgreSQL + Drizzle (Express / Next.js / TanStack) | src/lib/schema.ts / lib/schema.ts, database helper, drizzle.config.ts |
| MongoDB + Mongoose (Express / Next.js / TanStack) | src/lib/db.ts / lib/db.ts, src/models/User.ts / models/User.ts |
| Context | Implementation | Generated files |
|---|---|---|
| Express backend | JWT + bcrypt | src/lib/jwt.ts, src/middleware/requireAuth.ts, src/services/userStore.ts, src/routes/auth.ts, src/controllers/authController.ts |
| Next.js fullstack | Better Auth (requires database) | lib/auth.ts, lib/auth-client.ts, app/api/auth/[...all]/route.ts |
| TanStack fullstack | Better Auth (requires database) | src/lib/auth.ts, src/lib/auth-client.ts, src/lib/auth-functions.ts, src/routes/api/auth/$.ts |
| Files generated |
|---|
Dockerfile (multi-stage, framework-aware) |
docker-compose.yml |
.dockerignore |
Scripts added: docker:build, docker:up, docker:down, docker:logs
| Layer | Technology |
|---|---|
| Runtime | Node.js 24+ with TypeScript 6.0 |
| Backend framework | Express.js 5 |
| Frontend framework | Next.js 16 / TanStack Start / React 19 |
| Database ORMs | Prisma, Drizzle, Mongoose |
| Auth | JWT (jsonwebtoken + bcrypt) / Better Auth |
| Hot reload | tsx watch (Express) / next dev (Next.js) / vite dev (TanStack) |
| Linting | ESLint 10 with TypeScript plugin |
| Formatting | Prettier |
Contributions are welcome. Please open an issue or submit a pull request.
MIT