Skip to content

mrap10/create-express-preset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express Prisma Starter

A modern, production-ready Express.js API starter kit and scaffolding CLI built with TypeScript, Prisma ORM, and a modular addon system.

npm version license downloads

Overview

This monorepo provides a complete solution for building Express.js APIs with best practices baked in. It includes:

  • CLI Tool - Interactive scaffolding for new projects
  • Starter Template - Production-ready Express + Prisma backend
  • Modular Addons - Optional features (Swagger, Jest, Docker, Email)
  • Documentation - Comprehensive guides and examples

Quick Start

Create a new Express.js project with one command:

npx create-express-preset my-api

Or with Bun: (recommended)

bunx create-express-preset my-api

Follow the interactive prompts to configure your project with the features you need.

Repository Structure

Click to expand
create-express-preset/
├── packages/
│   └── create-express-preset/    # Published npm CLI package
│       ├── src/                  # CLI source code (TypeScript)
│       ├── dist/                 # Compiled output
│       └── templates/            # Template files used by CLI
│
├── starter/                      # Reference implementation
│   ├── src/
│   │   ├── modules/             # Feature modules (auth, user)
│   │   ├── middleware/          # Express middleware
│   │   ├── routes/              # API routes
│   │   └── config/              # Configuration
│   ├── prisma/                  # Database schema & migrations
│   └── test/                    # Test suites
│
├── templates/                    # CLI templates
│   ├── base/                    # Core Express + Prisma setup
│   └── addons/                  # Optional feature modules
│       ├── swagger/             # API documentation
│       ├── tests/               # Jest + Supertest
│       ├── docker/              # Docker configuration
│       └── resend/              # Email password reset
│
└── docs/                        # Documentation & guides

Features

Core Stack

  • Express.js - Fast, minimalist web framework
  • TypeScript - Type safety and modern JavaScript features
  • Prisma ORM - Type-safe database client for PostgreSQL
  • Zod - Runtime validation and type inference
  • JWT - Secure authentication with access and refresh tokens
  • ESLint & Prettier - Code quality and formatting

Authentication

  • User registration and login
  • JWT token generation (access + refresh)
  • Password hashing with bcrypt
  • Protected route middleware
  • Token refresh endpoint

Modular Addon System

Enhance your project with optional addons:

Addon Description
Swagger OpenAPI documentation with interactive UI
Jest Complete testing setup with Supertest
Docker Containerization with multi-stage builds
Resend Email-based password reset flow

Each addon includes:

  • Pre-configured files and dependencies
  • Automatic integration with base template
  • Documentation and usage examples
  • Prisma schema extensions (if needed)

How It Works

The CLI uses a template merging system:

  1. Base Template (templates/base/) - Core Express + Prisma application
  2. Addon Selection - User chooses features during setup
  3. Smart Merging - Files, dependencies, and configs are merged
  4. Prisma Integration - Schema models from addons are combined
  5. Ready to Use - Fully configured project with all dependencies

Each addon contains:

addon-name/
├── files/                    # Files to copy into project
├── package.extend.json       # Dependencies and scripts to merge
├── addon.config.json         # Route and import injections
└── prisma/
    └── schema.extend.prisma  # Additional Prisma models

Development

Prerequisites

  • Node.js >= 18.0.0
  • npm or yarn or bun
  • Git

Setup

Clone the repository:

git clone https://github.com/mrap10/create-express-preset.git
cd create-express-preset

Install dependencies:

npm install

Building the CLI

cd packages/create-express-preset
npm run build

Testing Locally

npm run dev

Project Scripts

  • npm run build - Compile TypeScript and copy templates
  • npm run dev - Run CLI in development mode
  • npm test - Run test suite

Documentation

Comprehensive guides available in the /docs directory:

Contributing

Contributions are welcome and appreciated! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and test thoroughly
  4. Commit with clear messages (git commit -m 'Add amazing feature')
  5. Push to your fork (git push origin feature/amazing-feature)
  6. Open a Pull Request

Development Guidelines

  • Follow the existing code style
  • Add tests for new features
  • Update documentation as needed
  • Keep commits atomic and well-described

Examples

Creating a Project with All Features

npx create-express-preset my-api
# Select: Swagger, Jest, Docker, Password Reset, Git

Minimal Setup

npx create-express-preset my-api
# Select: None (base template only)

Starter Template Reference

The starter/ directory contains a fully configured reference implementation. Use it to:

  • Understand the project structure
  • See addon integration examples
  • Test new features before adding to templates
  • Learn best practices

Roadmap

  • MongoDB support
  • GraphQL integration
  • WebSocket support
  • Redis caching addon
  • Rate limiting addon
  • More authentication strategies (OAuth, etc.)

License

This project is licensed under the MIT License. See the LICENSE file for details.

You are free to use this in commercial and personal projects.

Support

  • Star the repository on GitHub
  • Share with other developers
  • Report bugs and suggest features via Issues

Acknowledgments

Built with modern tools and inspired by the Node.js community's best practices.


Built with TypeScript | Maintained by mrap10

About

A CLI tool to quickly scaffold Express.js projects with Prisma ORM, TypeScript, authentication, and addons (Swagger, Jest, Docker, Email Reset with Resend).

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors