Skip to content

A powerful CLI tool to create fully configured backend projects with your preferred settings. Similar to create-next-app, but for backend development.

License

Notifications You must be signed in to change notification settings

Basharkhan7776/Churn

Repository files navigation

Create Churn CLI

   ______                __          ________
  / ____/_______  ____ _/ /____     / ____/ /_  __  ___________ _
 / /   / ___/ _ \/ __ `/ __/ _ \   / /   / __ \/ / / / ___/ __ `/
/ /___/ /  /  __/ /_/ / /_/  __/  / /___/ / / / /_/ / /  / /_/ /
\____/_/   \___/\__,_/\__/\___/   \____/_/ /_/\__,_/_/  /\__,_/

Scaffold production-ready backend projects with ease

A powerful CLI tool to create fully configured backend projects with your preferred stack. Choose from multiple ORMs, databases, authentication methods, testing frameworks, and deployment configurationsβ€”all in one command.

Quick Start

npx create-churn@latest

Features

Database & ORMs

  • 6 ORM Options: Prisma, Drizzle, TypeORM, Sequelize, Mongoose, or None
  • 4 Databases: PostgreSQL, MySQL, SQLite, MongoDB
  • Auto-configured: Connection strings, models, and migrations

Authentication

  • JWT: Token-based authentication with middleware
  • OAuth: Google & GitHub integration
  • Session: Express session-based auth
  • Security: Environment-based secrets management

Testing

  • Jest: Full-featured testing with coverage
  • Vitest: Fast, Vite-powered testing
  • Pre-configured: Test examples for HTTP/WebSocket APIs

Code Quality

  • ESLint: Automatic linting with TypeScript support
  • Prettier: Consistent code formatting
  • Husky: Git hooks for pre-commit validation
  • lint-staged: Run linters on staged files

Docker & Deployment

  • Docker: Multi-stage builds with health checks
  • docker-compose: Database orchestration
  • CI/CD: GitHub Actions, GitLab CI, CircleCI

Developer Experience

  • Languages: TypeScript & JavaScript
  • Package Managers: Bun, npm, yarn, pnpm
  • Protocols: HTTP (REST API with optional CORS) & WebSocket
  • Path Aliases: TypeScript path mapping
  • Environment: Type-safe env variables with Zod
  • Zero Config: Ready-to-run projects out of the box

What You Get

my-project/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # Main entry point
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ database.ts       # Database connection (if ORM selected)
β”‚   β”‚   └── env.ts            # Environment validation
β”‚   β”œβ”€β”€ auth/                 # Authentication logic (if selected)
β”‚   β”œβ”€β”€ models/               # Database models (ORM-specific)
β”‚   └── entities/             # TypeORM entities (if TypeORM)
β”œβ”€β”€ __tests__/                # Test files (if testing selected)
β”œβ”€β”€ prisma/                   # Prisma schema (if Prisma)
β”œβ”€β”€ drizzle/                  # Drizzle migrations (if Drizzle)
β”œβ”€β”€ .github/workflows/        # GitHub Actions (if selected)
β”œβ”€β”€ .gitlab-ci.yml            # GitLab CI (if selected)
β”œβ”€β”€ .circleci/config.yml      # CircleCI (if selected)
β”œβ”€β”€ Dockerfile                # Docker config (if selected)
β”œβ”€β”€ docker-compose.yml        # Docker Compose (if selected)
β”œβ”€β”€ .eslintrc.json            # ESLint config (if linting)
β”œβ”€β”€ .prettierrc               # Prettier config (if linting)
β”œβ”€β”€ tsconfig.json             # TypeScript config (if TS)
β”œβ”€β”€ package.json              # Dependencies & scripts
β”œβ”€β”€ .env.example              # Environment template
β”œβ”€β”€ .gitignore                # Git ignore rules
└── README.md                 # Project documentation

Usage

Interactive Mode (Recommended)

The easiest way to get started. The CLI will guide you through all configuration options:

npx create-churn@latest

You'll be prompted to configure:

  1. Project name - Your project directory name
  2. Language - TypeScript or JavaScript
  3. Package manager - Bun, npm, yarn, or pnpm
  4. Protocol - HTTP (REST API) or WebSocket
  5. CORS - Enable/Disable (HTTP only)
  6. ORM/ODM - Prisma, Drizzle, TypeORM, Sequelize, Mongoose, or None
  7. Database - PostgreSQL, MySQL, SQLite, or MongoDB
  8. Path aliases - TypeScript path mapping (TS only)
  9. Authentication - JWT, OAuth, Session, or None
  10. Testing - Jest, Vitest, or None
  11. Linting - ESLint & Prettier with Husky
  12. Docker - Dockerfile & docker-compose
  13. CI/CD - GitHub Actions, GitLab CI, CircleCI, or None

Non-interactive Mode (CLI Flags)

Note: Coming in v1.2.0. Skip prompts by providing configuration via flags:

npx create-churn@latest [project-name] [options]

Basic Usage

# TypeScript + Bun + Prisma + PostgreSQL
npx create-churn@latest my-app --ts --bun --prisma --postgresql

# JavaScript + npm + MongoDB
npx create-churn@latest my-api --js --npm --mongoose --mongodb

# WebSocket server with testing
npx create-churn@latest realtime-app --ws --vitest --docker

All Available Flags

Flag Description Options Default
Language
--ts, --typescript Use TypeScript - βœ“ Default
--js, --javascript Use JavaScript -
Package Manager
--bun Use Bun - βœ“ Default
--npm Use npm -
--yarn Use Yarn -
--pnpm Use pnpm -
Protocol
--http HTTP/REST API - βœ“ Default
--ws, --websocket WebSocket server -
--cors Enable CORS (HTTP only) - βœ“ Default for HTTP
--no-cors Disable CORS -
ORM/ODM
--prisma Use Prisma - βœ“ Default
--drizzle Use Drizzle -
--typeorm Use TypeORM -
--sequelize Use Sequelize -
--mongoose Use Mongoose -
--no-orm Skip ORM setup -
Database
--postgresql, --postgres PostgreSQL database - βœ“ Default
--mysql MySQL database -
--sqlite SQLite database -
--mongodb MongoDB database - Auto with Mongoose
TypeScript Features
--aliases Enable path aliases - βœ“ Default for TS
--no-aliases Disable path aliases -
Authentication
--jwt JWT authentication -
--oauth OAuth (Google, GitHub) -
--session Session-based auth -
--no-auth Skip authentication - βœ“ Default
Testing
--jest Use Jest -
--vitest Use Vitest -
--no-testing Skip testing setup - βœ“ Default
Code Quality
--linting ESLint + Prettier + Husky - βœ“ Default
--no-linting Skip linting setup -
DevOps
--docker Add Docker support -
--no-docker Skip Docker - βœ“ Default
--github GitHub Actions CI/CD -
--gitlab GitLab CI -
--circleci CircleCI -
--no-cicd Skip CI/CD setup - βœ“ Default

Flag Examples

Full-stack TypeScript API:

npx create-churn@latest my-api \
  --ts \
  --bun \
  --http \
  --cors \
  --drizzle \
  --postgresql \
  --aliases \
  --jwt \
  --jest \
  --linting \
  --docker \
  --github

Minimal JavaScript REST API:

npx create-churn@latest simple-api --js --npm --http --no-orm --no-auth --no-testing --no-linting --no-docker

WebSocket Server with MongoDB:

npx create-churn@latest realtime-server --ts --bun --ws --mongoose --mongodb --session --vitest --docker

Microservice with TypeORM:

npx create-churn@latest user-service --ts --pnpm --http --typeorm --mysql --jwt --jest --linting --gitlab

Quick Reference - Common Combinations

Scenario Command
Default setup npx create-churn@latest
TypeScript only npx create-churn@latest my-app --ts
JavaScript only npx create-churn@latest my-app --js
With authentication npx create-churn@latest my-app --jwt
With testing npx create-churn@latest my-app --jest
Production ready npx create-churn@latest my-app --jwt --jest --linting --docker --github
MongoDB stack npx create-churn@latest my-app --mongoose --mongodb --session
No database npx create-churn@latest my-app --no-orm
WebSocket npx create-churn@latest my-app --ws
Minimal setup npx create-churn@latest my-app --js --no-orm --no-auth --no-testing --no-linting --no-docker

Examples

1. Full-Stack TypeScript API

Production-ready API with authentication, testing, and deployment configuration.

Interactive:

npx create-churn@latest
# Select: TypeScript β†’ Bun β†’ HTTP β†’ CORS β†’ Drizzle β†’ PostgreSQL β†’
#         Path aliases β†’ JWT β†’ Jest β†’ Linting β†’ Docker β†’ GitHub Actions

CLI Flags (v1.2.0):

npx create-churn@latest production-api \
  --ts --bun --http --cors \
  --drizzle --postgresql \
  --aliases --jwt --jest \
  --linting --docker --github

What you get:

  • TypeScript with path aliases (@/config, @/models)
  • Drizzle ORM with PostgreSQL
  • JWT authentication with middleware
  • Jest testing with coverage
  • ESLint + Prettier + Husky
  • Docker multi-stage build
  • GitHub Actions CI/CD

2. Minimal JavaScript API

Lightweight Express server with no dependencies, ready to customize.

Interactive:

npx create-churn@latest
# Select: JavaScript β†’ npm β†’ HTTP β†’ No CORS β†’ No ORM β†’
#         No auth β†’ No testing β†’ No linting β†’ No docker β†’ No CI/CD

CLI Flags (v1.2.0):

npx create-churn@latest simple-api \
  --js --npm --http --no-cors \
  --no-orm --no-auth --no-testing \
  --no-linting --no-docker --no-cicd

What you get:

  • Plain JavaScript
  • Express HTTP server
  • No database (add your own)
  • Minimal dependencies
  • Quick prototyping setup

3. Real-time WebSocket Server

WebSocket server with database persistence and testing.

Interactive:

npx create-churn@latest
# Select: TypeScript β†’ Bun β†’ WebSocket β†’ Sequelize β†’ SQLite β†’
#         Path aliases β†’ No auth β†’ Vitest β†’ Linting β†’ Docker

CLI Flags (v1.2.0):

npx create-churn@latest realtime-server \
  --ts --bun --ws \
  --sequelize --sqlite \
  --aliases --no-auth \
  --vitest --linting --docker

What you get:

  • WebSocket server (ws library)
  • Sequelize ORM with SQLite
  • Vitest for testing WebSocket events
  • Docker with health checks
  • Linting and formatting

4. MongoDB Microservice

MongoDB-backed API with session authentication and CI/CD.

Interactive:

npx create-churn@latest
# Select: TypeScript β†’ pnpm β†’ HTTP β†’ CORS β†’ Mongoose β†’ MongoDB β†’
#         Path aliases β†’ Session β†’ Jest β†’ Linting β†’ CircleCI

CLI Flags (v1.2.0):

npx create-churn@latest user-service \
  --ts --pnpm --http --cors \
  --mongoose --mongodb \
  --aliases --session --jest \
  --linting --circleci

What you get:

  • Mongoose ODM with MongoDB
  • Session-based authentication
  • Express session configuration
  • Jest with MongoDB memory server
  • CircleCI pipeline
  • Environment validation (Zod)

5. Enterprise REST API

Full-featured API with Prisma, OAuth, and comprehensive tooling.

Interactive:

npx create-churn@latest
# Select: TypeScript β†’ yarn β†’ HTTP β†’ CORS β†’ Prisma β†’ MySQL β†’
#         Path aliases β†’ OAuth β†’ Jest β†’ Linting β†’ Docker β†’ GitLab CI

CLI Flags (v1.2.0):

npx create-churn@latest enterprise-api \
  --ts --yarn --http --cors \
  --prisma --mysql \
  --aliases --oauth --jest \
  --linting --docker --gitlab

What you get:

  • Prisma ORM with MySQL
  • OAuth (Google + GitHub)
  • Prisma Studio for database GUI
  • Jest with Supertest
  • Docker Compose with MySQL service
  • GitLab CI/CD pipeline

6. Quick Prototype (30 seconds)

Fastest way to get a running server.

Interactive:

npx create-churn@latest
# Just press Enter for all defaults

CLI Flags (v1.2.0):

npx create-churn@latest my-prototype
# Uses all defaults: TS + Bun + HTTP + CORS + Prisma + PostgreSQL

What you get:

  • TypeScript + Bun (fastest runtime)
  • HTTP REST API with CORS
  • Prisma with PostgreSQL
  • Path aliases enabled
  • No auth, testing, or Docker
  • ESLint + Prettier by default

Supported Combinations

ORMs & Databases

ORM PostgreSQL MySQL SQLite MongoDB
Prisma [x] [x] [x] [ ]
Drizzle [x] [x] [x] [ ]
TypeORM [x] [x] [x] [ ]
Sequelize [x] [x] [x] [ ]
Mongoose [ ] [ ] [ ] [x]

Package Managers

Language Bun npm yarn pnpm
TypeScript [x] [x] [x] [x]
JavaScript [x] [x] [x] [x]

Testing Frameworks

Framework TypeScript JavaScript
Jest [x] [x]
Vitest [x] [x]

Generated Scripts

Your project comes with useful npm scripts:

{
  "scripts": {
    "dev": "Start development server with watch mode",
    "build": "Build for production",
    "start": "Start production server",
    "test": "Run tests",
    "test:coverage": "Run tests with coverage",
    "lint": "Lint and fix code",
    "format": "Format code with Prettier",
    "db:generate": "Generate database client/types",
    "db:migrate": "Run database migrations",
    "db:studio": "Open database GUI (Prisma/Drizzle)"
  }
}

Documentation

  • ORM Guides: Each ORM comes with configured examples
  • Auth Examples: JWT tokens, OAuth flows, session management
  • Testing: Pre-configured test suites
  • Docker: Multi-stage builds with database services
  • CI/CD: Automated workflows for testing and deployment

Development

Clone & Setup

git clone https://github.com/Basharkhan7776/Churn.git
cd Churn
bun install

Run Locally

bun run dev

Test

# Run all tests
bun test

# Run specific test
bun test-cli.ts

# Deep validation
bun deep-test.ts

# CORS verification
bun verify-cors.ts

Build

bun run build

Testing

All features are thoroughly tested:

  • [+] 5/5 CLI tests passed
  • [+] 62/62 Deep validation checks passed
  • [+] 0 TypeScript errors
  • [+] 0 Build errors

Roadmap

v1.1.0 (Current)

  • Multiple ORMs (Prisma, Drizzle, TypeORM, Sequelize, Mongoose)
  • Multiple databases (PostgreSQL, MySQL, SQLite, MongoDB)
  • Authentication (JWT, OAuth, Session)
  • Testing frameworks (Jest, Vitest)
  • Linting & formatting (ESLint, Prettier, Husky)
  • Docker support
  • CI/CD templates
  • Optional CORS

v1.2.0 (Next)

  • CLI flags (non-interactive mode)
  • GraphQL support
  • API documentation (Swagger/OpenAPI)
  • More auth providers (Auth0, Supabase)
  • Deployment templates (Vercel, Railway, Fly.io)

v2.0.0 (Future)

  • Plugin system
  • Custom templates
  • GUI interface
  • Migration tool

Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for your changes
  5. Ensure all tests pass (bun test)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Areas for Contribution

  • New ORM integrations
  • New CI/CD platforms
  • Deployment templates
  • Documentation improvements
  • Bug fixes

License

MIT License - Copyright (c) Bashar Khan

Acknowledgments

Built with:

Support


Made with <3 by Bashar Khan

Note: This CLI is under active development. More features coming soon!

About

A powerful CLI tool to create fully configured backend projects with your preferred settings. Similar to create-next-app, but for backend development.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published

Contributors 2

  •  
  •  

Languages