How the-lord-buddha-club/lord_buddha_club works
Project Type & Purpose
• This is a full-stack, monolithic Next.js application using the App Router.
• Purpose: a community platform for blog/event management, role-based dashboards, and user profiles.
File Structure & Tech Stack
• Frontend:
• app/ directory contains React Server Components (pages, layouts, API routes).
• components/ holds reusable UI pieces (shadcn/ui & custom).
• Backend/API:
• Next.js API Routes under app/api/* implement REST endpoints (auth, posts, events, roles, users).
• lib/ contains business logic: lib/auth (NextAuth config), lib/db (Drizzle ORM schema & DB utilities), lib/github, lib/utils.
• Data Store:
• PostgreSQL (Neon) accessed via Drizzle ORM.
• External Services:
• NextAuth.js OAuth with GitHub
• Resend (email)
• Docker Compose orchestration
• DevOps / Config:
• docker-compose.yml, .env.example, next.config.js, drizzle.config.ts
Main Components & Their Roles
A. Client / UI Layer
• Browser ↔︎ Next.js pages (app/*/page.tsx) & React components (components/*).
• Theme & layout via components/theme-provider.tsx, app/layout.tsx.
B. API / Server Layer (Next.js Serverless Functions)
• Authentication: app/api/auth/[...nextauth]/route.ts backed by NextAuth.
• Content Management:
• Posts: app/api/posts/*/route.ts
• Events: app/api/events/*/route.ts
• Users & Roles: app/api/users/*, app/api/roles/transfer/*
C. Business Logic & Utilities
• lib/auth/*: session, roles, config
• lib/db/*: Drizzle schema, connectors
• lib/github.ts: GitHub-related utilities
• lib/utils.ts: shared helpers
D. Database
• PostgreSQL instance (Neon)
• Drizzle ORM for query building & migrations
E. External Services
• GitHub OAuth Provider (NextAuth)
• Resend Email Service
F. DevOps & Infrastructure
• Docker Compose: database container, app container
• Environment variables for secrets & URLs
Relationships & Data Flows
• User (Browser) → HTTP(S) requests → Next.js Frontend pages/components
• Pages invoke client-side data fetch or form submissions → Next.js API Routes
• API Routes → Drizzle ORM → PostgreSQL
• NextAuth callbacks → GitHub OAuth endpoints → NextAuth session store → user cookies
• Email triggers (e.g., verification) → Resend API
• Static assets served from public/
Architectural Patterns & Design Principles
• Monorepo / Monolithic Full-Stack: Single Next.js project containing both UI and API.
• MVC-like separation: pages (views), API routes (controllers), Drizzle + schema (model).
• Serverless micro-endpoints: each API folder under app/api is isolated.
• Reusable UI libs: shadcn/ui + custom components.
• Environment-driven config for secrets & URLs.
Essential Details to Capture
• Separation of concerns: UI vs API vs Data.
• Role-based dashboards: note Admin/Owner/Member flows under the Dashboard UI component.
• Authentication flow: user ↔ NextAuth ↔ GitHub ↔ Session store.
• Email sending path via Resend.
• Database migrations & ORM connections.