QorelySofts
Store/Auth & RBAC Boilerplate — Express + TypeScript + Prisma
🔐 Backend Architecture
Auth & RBAC Boilerplate — Express + TypeScript + Prisma
v1.0.0🔐 Backend Architecture

Auth & RBAC Boilerplate — Express + TypeScript + Prisma

Production-grade role-based access control with dual-token JWT rotation and Prisma ORM adapter.

Production-grade role-based access control (RBAC) system for Node.js and Express. Features dual-token JWT access + refresh rotation, Prisma ORM database persistence (PostgreSQL/MySQL/SQLite), bcrypt password hashing, token blacklisting, Admin/Editor/User hierarchy, route authorization middleware, brute-force rate limiters, and demo accounts.

Key Capabilities & Architecture

Dual-Token Lifecycle

Short-lived access tokens (15m) paired with long-lived refresh tokens (7d) with automatic rotation.

Drop-in Prisma ORM Persistence

Includes complete PostgreSQL, MySQL, and SQLite schema and adapter replacing prototype RAM stores.

Hierarchical RBAC Middleware

Express middleware factory: authorize(Role.ADMIN, Role.EDITOR) to safeguard sensitive endpoints.

Anti-Brute Force Protection

Integrated bcrypt password hashing (12 salt rounds), token revocation blacklist, and rate limiters.

Quick Setup & Installation Instructions

  1. npm install
  2. Copy .env.example to .env and set JWT_SECRET, JWT_REFRESH_SECRET, and DATABASE_URL
  3. Run npx prisma db push to apply migrations to your database
  4. Start development server with npm run dev or build with npm run build && npm start

Verified Compatibility & Requirements

✓ Node.js 18+ LTS✓ Express 4+ / 5✓ TypeScript 5+✓ Prisma ORM 5+✓ PostgreSQL, MySQL, SQLite, CockroachDB
₹10

One-time purchase • Unlimited commercial use • Instant download

Instant ZIP package delivery after checkout
Encrypted token download link (active 48h)
Verified secure checkout via Razorpay
Full source code with zero obfuscation
Secured by Razorpay Payment Gateway
Supports UPI (GPay, PhonePe, Paytm), Cards & NetBanking
🔒 256-bit encrypted transaction • Official QorelySofts digital license

Included in Your Download ZIP

  • └─prisma/schema.prisma
  • └─src/adapters/prisma-adapter.ts
  • └─src/middleware/authenticate.ts
  • └─src/middleware/authorize.ts
  • └─src/middleware/rate-limiter.ts
  • └─src/services/auth-service.ts
  • └─src/services/token-service.ts
  • └─src/routes/auth.routes.ts
  • └─src/routes/protected.routes.ts
  • └─src/types/index.ts
  • └─src/index.ts
  • └─README.md
Using Auth & RBAC
typescript
import { Router } from 'express';
import { authenticate, authorize, Role } from './auth-rbac-boilerplate';

const router = Router();

// Protected: Admin and Editor only
router.post('/articles', authenticate, authorize(Role.ADMIN, Role.EDITOR), (req, res) => {
  res.json({ success: true, createdBy: req.user.email });
});

Frequently Asked Questions

Technical specifics and licensing details for this product.

Does it support database migrations?

Yes. Run npx prisma db push or npx prisma migrate dev with the included schema.prisma.

How does token invalidation work on logout?

The token service records revoked tokens into an active blacklist cache with automatic TTL eviction.