create-ts-api
v2.1.0
Published
Interactive CLI tool to instantly scaffold production-grade Node.js TypeScript APIs in seconds
Maintainers
Readme
Built with ❤️ for TypeScript developers by Bineet Naidu
⚡ Quick Start
To start the interactive CLI prompt:
npx create-ts-api📋 Interactive Setup Workflow
When you run npx create-ts-api, the CLI walks you through an interactive sequence powered by @clack/prompts:
- Project Name: Choose your project folder name (validates directory existence and character formatting).
- Project Description: Set a custom description for your generated
package.json. - Template Architecture Selection: Pick your target API architecture from 6 modern starter options.
- Git Initialization: Choose whether to initialize a new Git repository.
- Dependency Installation: Choose whether to automatically install dependencies using your active package manager (
npm,pnpm,yarn, orbun).
🛠️ Starter Templates
create-ts-api comes with 6 starter templates:
⚡ REST API Templates (Express v5)
Express REST API(express-api): Express v5 REST API featuring a Layered N-Tier Architecture (Controllers, Services, Repositories), Constructor Dependency Injection, Zod validation,BaseAppErrordomain error hierarchy, and Vitest unit & integration tests.Express REST API + MongoDB(express-api-mongodb): Express v5 + Mongoose v8 REST API with a Tweet CRUD domain, Docker Compose setup, and in-memory MongoDB (mongodb-memory-server) Vitest integration test suite.Express REST API + PostgreSQL(express-api-postgres-with-drizzleorm): Express v5 + PostgreSQL (Drizzle ORM & Drizzle Kit) REST API with Docker Compose, dual DB setup (dev & test), and global PostgreSQL native error interceptors.
🚀 GraphQL API Templates (Apollo Server v5)
GraphQL API(gql): Standalone Apollo Server v5 + TypeGraphQL v2 GraphQL API withtsxhot reloading and Vitest integration tests.GraphQL API + MongoDB(gql-mongo): Apollo Server v5 + TypeGraphQL + Typegoose v12 + Mongoose v8 with globalCatchMongoErrorsmiddleware and in-memory test runner.GraphQL API + PostgreSQL(graphql-postgres-typeorm): Apollo Server v5 + TypeGraphQL + TypeORM v0.3+ + PostgreSQL with Docker Compose dual DBs andCatchPostgresErrorsglobal error interceptor.
💻 Package Manager Auto-Detection
The CLI automatically detects which package manager invoked the process (npm, pnpm, yarn, or bun) via environment context and system availability, installing dependencies and outputting matching next-step commands automatically.
🤝 Contributing
Contributions are welcome! Check out our Contributing Guide to get started.
Please adhere to our Code of Conduct.
👤 Author
- Bineet Naidu - @nobineetnaidu • GitHub
📄 License
This project is licensed under the MIT License.
