How smakosh/roll-your-own-auth works
Project Type Analysis
This is an authentication framework/boilerplate project that provides different authentication implementation examples using various tech stacks. The project includes both client and server-side implementations with different authentication strategies (JWT, Sessions, SSO).
Main System Components
A. Documentation System
• Next.js-based documentation site (under /apps/docs)
• Authentication strategy guides (JWT, Sessions, SSO)
B. Example Implementations
REST API Examples
• Express + Prisma + JWT + SQLite
• Express + Prisma + Sessions + SQLite
• NestJS + Prisma + JWT + PostgreSQL
• Next.js + JWT
• Next.js + Sessions
C. CLI Tool
• Package for automation/scaffolding (under /packages/cli)
┌─────────────────────────────────────────────────┐
• Roll Your Own Auth │
• ┬─────────────────┬───────────────┤
• Documentation │ Examples │ CLI Tool │
• ┴─────────────────┴───────────────┘
┌─────────────────────┐
• Auth Strategies │
• ┤
• JWT │
• Sessions │
• SSO │
• 2FA │
• ┘
┌─────────────────┐ ┌─────────────────┐
• Client Side │ │ Server Side │
• ┤ ├─────────────────┤
• Next.js │ │ - Express │
• NestJS │
• ┘ └─────────────────┘
Important Elements
User → Client → Auth Middleware → Server → Database
b. Database Connections:
• SQLite and PostgreSQL database connections
• Prisma as ORM layer
c. Feature Components:
• Login/Signup flows
• Session management
• Token handling
• Middleware implementation
• Validation layers
Specific Implementation Details
For each example implementation, show:
• Route handlers
• Authentication middleware
• Database schema
• API endpoints
• Security measures
• Security boundaries and trust zones
• Error handling flows