How senqii/securejoin-server works
Project Type & Purpose
• This is a single-service backend (no frontend code).
• Its purpose is to provide secure, OTP-based joining and quiz data storage via a TypeScript API.
• It relies on Prisma migrations and a Supabase-hosted PostgreSQL database.
File Structure
• Top-level:
– package.json / pnpm-lock.yaml → Node.js/TypeScript service
– prisma/ → database schema + versioned migrations
– supabase/ → Supabase local config & migrations (remote schema)
– src/ → application code
• src/ layers:
– src/index.ts → HTTP server entry point
– src/auth/ → authentication & user models
– src/DB/ → Prisma client, OTP.ts, quizes.ts, index.ts
– src/words.ts → word-list utilities
– src/types/ → shared TypeScript types
README for Additional Insights
• Fully TypeScript for type safety
• Scalable architecture
• Assumes Node.js + npm/yarn
Main Components & Their Interactions
a. API Layer (src/index.ts)
• Listens for HTTP requests (e.g., Express/Fastify)
• Routes to controllers in auth/, DB/, words.ts
b. Auth Service (src/auth)
• Generates/validates one-time passwords (OTPs)
• Manages user registration/login
c. Quiz Service (src/DB/quizes.ts)
• CRUD operations for quiz data
• Tracks attempts & timestamps
d. ORM Layer (src/DB/index.ts & src/DB/client.ts)
• Exposes PrismaClient configured via prisma/schema.prisma
• Applies migrations (prisma/migrations)
e. Database (PostgreSQL via Supabase)
• Tables: User, OTP, Quiz, Attempts, etc.
• Supabase folder houses local config.toml and remote_schema migrations
f. Utility Layer (src/words.ts, src/types)
• Shared type definitions & word lists
Architectural Patterns & Design Principles
• Three-tier separation: API → Service/Business Logic → Data Access
• Modular code: each feature in its own directory (auth, DB, types)
• Infrastructure as code: Prisma migrations + Supabase migrations co-exist but serve the same PostgreSQL instance
• Type safety end-to-end: TS types in src/types reused across layers