@samarthchavda/create-auth-backend
v1.0.1
Published
Scaffold a production-ready login/signup backend (JWT, RBAC, rate limiting) in one command — FastAPI+PostgreSQL or Express+MongoDB
Maintainers
Readme
create-auth-backend
A one-command scaffolder for a production-ready login/signup backend — JWT access + refresh tokens, bcrypt password hashing, role-based middleware, rate limiting on auth routes, and Docker setup, in either FastAPI + PostgreSQL or Express + MongoDB.
Try it locally right now (no publishing needed)
cd create-auth-backend
npm link
create-auth-backend myapp --stack fastapi
# or
create-auth-backend myapp --stack expressnpm link registers this folder as a global command on your machine, so create-auth-backend works from anywhere.
Usage
create-auth-backend <project-name> --stack <fastapi|express>Example:
create-auth-backend taskflow-auth --stack express
cd taskflow-auth
cp .env.example .env
npm install
npm run devEvery run also generates fresh random JWT secrets into your .env.example — no more copy-pasting the same secret across projects.
What gets generated
POST /api/auth/signup— register (email/password validated, password hashed with bcrypt)POST /api/auth/login— returns access token (short-lived) + refresh token (long-lived)POST /api/auth/refresh— exchange refresh token for a new pairPOST /api/auth/logout— blacklists the current access tokenGET /api/auth/me— current user, requires valid access token- Example protected + role-restricted routes showing the middleware pattern
- Rate limiting on all auth endpoints (default: 5 attempts / 5 min per IP)
- Dockerfile + docker-compose.yml with the matching database container
Publish it so you can run it with npx from anywhere (any machine)
npm login
npm publishOnce published:
npx create-auth-backend myapp --stack fastapiExtending it
Both templates follow controller → routes → middleware separation, so adding
new protected features (e.g. a /api/tasks resource in a TaskFlow-style app)
means just importing requireAuth / get_current_user and building on top —
auth is already solved.
