create-express-dex
v0.1.5
Published
A fast CLI to scaffold Express.js backend projects with TypeScript or JavaScript
Maintainers
Readme
Dex - Fast Express Backend Scaffolding CLI
Features
Instant Project Setup
- Interactive CLI prompts for project configuration
- Choose between JavaScript or TypeScript
- Optional MongoDB with Mongoose integration
- Support for npm, pnpm, yarn, and bun package managers
Smart Configuration
- Pre-configured Express server with best practices
- CORS and body parsing middleware included
- Environment variable management with
.envfiles - Dynamic MongoDB connection strings based on project name
Production-Ready Structure
- Clean, organized project structure
- Separate database configuration files
- Ready-to-use server entry point
- Proper
.gitignoreconfiguration
Developer Experience
- Fast development server with
nodemon(like Vite for backend!) - TypeScript support with proper configuration
- Automatic dependency installation
- Clear next-steps instructions after setup
Not a Framework
Dex is a scaffolding tool, not a framework. It generates a clean Express.js project with sensible defaults, giving you full control over your code without any lock-in or abstraction layers.
Prerequisites
- Node.js 18 or higher
- npm, pnpm, yarn, or bun (your choice!)
Quick Start
npm create express-dex
or
npx create-express-dexThat's it! The CLI will guide you through the setup process.
Usage
When you run npm create express-dex, you'll be prompted with the following questions:
- Project Name: Enter your project name (default:
my-dex-project) - Language: Choose between
JavaScriptorTypeScript - Package Manager: Select
npm,pnpm,yarn, orbun - MongoDB: Choose whether to include MongoDB with Mongoose
Example Session
$ npm create express-dex
Welcome to Dex!
██████╗ ███████╗██╗ ██╗
██╔══██╗██╔════╝╚██╗██╔╝
██║ ██║█████╗ ╚███╔╝
██║ ██║██╔══╝ ██╔██╗
██████╔╝███████╗██╔╝ ██╗
╚═════╝ ╚══════╝╚═╝ ╚═╝
? What is the name of your project? : my-awesome-api
? Which language do you want to use? TypeScript
? Which package manager do you want to use? npm
? Do you want to use MongoDB with Mongoose? Yes
Scaffolding project in /path/to/my-awesome-api...
Setting up MongoDB...
Installing dependencies...
Success! Created my-awesome-api at /path/to/my-awesome-api
Inside that directory, you can run:
npm run dev
Starts the development server.
We suggest that you begin by typing:
cd my-awesome-api
npm run devGenerated Project Structure
JavaScript Project
my-project/
├── src/
│ ├── db/ # MongoDB connection (if selected)
│ │ └── index.js
│ └── server.js # Express server entry point
├── .env # Environment variables
├── .gitignore
├── package.jsonTypeScript Project
my-project/
├── src/
│ ├── db/ # MongoDB connection (if selected)
│ │ └── index.ts
│ └── server.ts # Express server entry point
├── .env # Environment variables
├── .gitignore
├── package.json
└── tsconfig.jsonEnvironment Variables
Dex automatically generates a .env file with the following variables:
Without MongoDB
PORT=5000
CORS_ORIGIN=*With MongoDB
PORT=5000
CORS_ORIGIN=*
MONGODB_URI=mongodb://localhost:27017/my-projectPackage Manager Support
Dex supports all major package managers:
| Package Manager | Installation Command | Run Dev Server |
| --------------- | -------------------- | -------------- |
| npm | npm install | npm run dev |
| pnpm | pnpm install | pnpm run dev |
| yarn | yarn | yarn run dev |
| bun | bun install | bun run dev |
The CLI will automatically use your selected package manager for installation and display the correct commands in the success message.
Project Structure (CLI Source)
dex/
├── src/
│ └── index.ts # Main CLI logic
├── templates/
│ ├── js/ # JavaScript templates
│ │ ├── src/
│ │ ├── package.json
│ │ └── _gitignore
│ └── ts/ # TypeScript templates
│ ├── src/
│ ├── package.json
│ ├── tsconfig.json
│ └── _gitignore
├── bin/
│ └── index.js # Compiled output
├── package.json
└── tsconfig.jsonContributing
Contributions are welcome! Please feel free to submit a Pull Request.
