@charan7/auth-kit-backend
v1.0.5
Published
Express JWT auth backend — scaffolded by charan-auth-kit
Readme
charan-auth-kit
Scaffold a complete full-stack JWT auth system in seconds. Express backend + React frontend — zero config, works with any Node ≥ 14.
Usage
npx charan-auth-kit my-appThat's it. You get:
my-app/
├── AUTH-KIT-backend/ ← Express · JWT · bcrypt · role-based access
└── AUTH-KIT-frontend/ ← React · Vite · Axios · protected routesRun it
# Backend
cd my-app/AUTH-KIT-backend
npm install
node examples/app.js # → http://localhost:3000
# Frontend (new terminal)
cd my-app/AUTH-KIT-frontend
npm install
npm run dev # → http://localhost:5173API endpoints (auto-registered)
| Method | Path | Auth required | |--------|----------------|---------------| | POST | /auth/register | ✗ | | POST | /auth/login | ✗ | | GET | /auth/me | ✔ Bearer JWT |
Storage adapters
| Value | Requires |
|------------|------------------|
| memory | nothing (default)|
| mongo | npm i mongoose |
| postgres | npm i pg |
setupAuth(app, { storage: 'mongo', mongoUri: process.env.MONGO_URI });Protect your own routes
const { setupAuth, authMiddleware, roleMiddleware } = require('./index');
setupAuth(app, { jwtSecret: process.env.JWT_SECRET });
app.get('/dashboard', authMiddleware, (req, res) => {
res.json({ user: req.user });
});
app.delete('/admin', authMiddleware, roleMiddleware.requireRole('admin'), handler);Node version
Works on Node 14, 16, 18, 20, 22 — no engine restrictions.
License
MIT © charan
