create-nan
v2.3.0
Published
The fast way to bootstrap a TypeScript backend, the way Nan builds them.
Readme
create-nan 🚀
An interactive backend scaffolding tool designed to generate clean, robust TypeScript projects pre-configured with Fastify, Prisma, PostgreSQL, Docker, and Clean Architecture in seconds.
⚡ Quick Start
No need to install globally! Simply run:
yarn create nanOr using your favorite package manager:
# npm
npm create nan@latest
# pnpm
pnpm create nan
# bun
bun create nanFollow the interactive prompt to set up your project name, and you're ready to build!
💡 What is create-nan?
Setting up a backend project from scratch often involves repeating tedious tasks: configuring TypeScript, setting up Fastify, writing boilerplate Prisma schema files, structuring Clean Architecture layers, and configuring Docker environments.
create-nan solves this by automating the boilerplate phase into a smooth, one-command CLI workflow.
🏗️ What Gets Generated?
The generated project follows Clean Architecture / Domain-Driven Design (DDD) principles, separating concerns into distinct layers:
my-app/
├── src/
│ ├── domain/ # Entities, value objects, and business rules
│ ├── application/ # Use cases and application logic
│ ├── infrastructure/ # External services, ORM/Prisma, database configs
│ ├── presentation/ # Fastify controllers, routes, and HTTP schemas
│ └── main/ # Server startup, dependency injection & app composition
├── prisma/
│ └── schema.prisma # Database schema and models
├── .env.example # Environment variables blueprint
├── compose.yml # Docker Compose setup for PostgreSQL
├── package.json # Configured dependencies and scripts
└── tsconfig.json # Optimized TypeScript configurationGenerated Project Tech Stack
- Runtime & Language: Node.js + TypeScript
- Web Framework: Fastify
- Database & ORM: PostgreSQL + Prisma ORM
- Architecture Pattern: Clean Architecture / DDD
- Containerization: Docker Compose
🛠️ CLI Built With
The scaffolding tool itself is built lightweight and fast using modern CLI libraries:
- @clack/prompts — Interactive, stylish CLI prompts
- execa — Process execution for automated setup tasks
- fs-extra — Enhanced file system management
- TypeScript — Compiled with
tsc
📋 Prerequisites
Before running create-nan, ensure you have the following installed on your machine:
- Node.js (v18.0.0 or higher recommended)
- Yarn (v1.x or v3+), npm, pnpm, or Bun
- Docker & Docker Compose (for running the local PostgreSQL database)
🔄 How It Works
- Interactive Prompt: Collects project details (such as the project name) interactively.
- Template Copying: Clones a battle-tested Clean Architecture template to the specified target directory.
- Placeholder Replacement: Automatically updates project variables across files (e.g., updating
package.jsonpackage names andcompose.ymlcontainer/volume tags). - Dependency Installation: Runs
yarn installinside the newly created project directory so you can jump right into coding.
🛣️ Roadmap
- [ ] Support for selecting modular features (e.g., JWT authentication, Redis caching, Swagger documentation).
- [ ] Choice of ORMs (Prisma, Drizzle, TypeORM).
- [ ] Option to add automated testing setups (Vitest / Jest) out of the box.
🤝 Contributing
Contributions, issues, and feature requests are welcome!
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
Distributed under the MIT License. See LICENSE for more details.
