create-swayapp
v1.1.0
Published
A CLI tool to scaffold Express.js projects with JWT authentication
Maintainers
Readme
create-swayapp
A CLI tool to quickly scaffold Express.js projects with JWT authentication boilerplate. Get started with a production-ready Express.js API in seconds!
Features
✨ Zero Configuration - Get started immediately with a working Express.js + JWT setup
🔒 JWT Authentication - Pre-configured authentication with best practices
📦 Clean Scaffold - No git history, ready for your own repository
✅ Validation - Smart project name validation and directory checks
🎨 Beautiful CLI - Interactive prompts with colored output
🚀 Modern Stack - Built with ES modules and latest Node.js features
Quick Start
npx create-swayappThat's it! The CLI will guide you through the setup process.
Usage
Basic Usage
Run the command and follow the interactive prompts:
npx create-swayappYou'll be asked for:
- Project name - The name of your new project (e.g.,
my-api) - Target directory - Where to create the project (defaults to current directory)
Example
$ npx create-swayapp
🚀 Welcome to create-swayapp!
? Enter your project name: › my-awesome-api
? Enter target directory (leave empty for current directory): › ./projects
📦 Creating project: my-awesome-api...
Location: /Users/you/projects/my-awesome-api
✅ Project created successfully!
Git history has been removed - you have a fresh scaffold
Next steps:
cd projects/my-awesome-api
npm install
npm run devWhat's Included?
The scaffolded project includes:
- 🔐 JWT Authentication - Complete auth setup with token generation and verification
- 🛣️ Express.js Server - Configured with best practices and middleware
- 📁 Organized Structure - Clean, modular folder structure
- 🔧 Environment Config - dotenv setup for environment variables
- 📝 Documentation - Starter README with API documentation
Project Name Rules
Project names must:
- Only contain letters (a-z, A-Z)
- Numbers (0-9)
- Hyphens (-)
- Underscores (_)
❌ Invalid: my app, my@app, my.app
✅ Valid: my-app, my_app, myapp, MyApp123
Features in Detail
Directory Existence Check
The CLI checks if a directory already exists and prompts you to confirm before overwriting.
Graceful Cancellation
Press Ctrl+C or cancel any prompt to safely exit without creating partial files.
Custom Target Directory
Specify where you want to create your project:
.- Current directory (default)./projects- In a subdirectory../sibling- In a sibling directory/absolute/path- Absolute path
Clean Git History
The scaffolded project has no git history from the template. You get a fresh start, ready to initialize your own git repository:
cd my-awesome-api
git init
git add .
git commit -m "Initial commit"Requirements
- Node.js 14.x or higher
- npm 6.x or higher
Template
This CLI clones the express-jwt-scaffold template, which provides a solid foundation for building REST APIs with Express.js and JWT authentication.
Troubleshooting
Permission Errors
If you encounter permission errors, try running with sudo (not recommended) or fix your npm permissions:
npm config set prefix ~/.npm-globalNetwork Errors
If cloning fails, check your internet connection and ensure GitHub is accessible.
Directory Already Exists
The CLI will prompt you to confirm before overwriting. Choose "No" to cancel or "Yes" to proceed.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT © Swayam Prajapat
Links
Made with ❤️ by Swayam Prajapat
