How munuchapterhkn/hkrecruitment works
Project Type and Purpose
• This is a full-stack web application built with Next.js (app directory structure) that serves as a recruitment platform for the Mu Nu Chapter of Eta Kappa Nu.
• It provides candidate management (dashboards, candidate details, stage transitions), authentication, database-backed storage, and integrates with Google Drive and an n8n workflow engine.
File Structure
• src/app/: Next.js “app” routes and pages (frontend + server-side).
• /api/auth/[...all]/route.ts – NextAuth (or custom) API for authentication.
• /dashboard/* – Protected UI routes for candidate workflows.
• src/components/ & src/components/ui/: Reusable React UI components (modals, buttons, layouts).
• src/db/: Drizzle ORM config, schema, seed/reset scripts.
• src/lib/: Business-logic layers:
• /lib/server/auth.ts – server-side auth utilities
• /lib/google/drive/* – Google Drive integration
• /lib/models/* – Data access layer wrappers over the ORM
• n8n/: JSON workflow definitions (automations).
• docker-compose.yml, initdb.sh: Local dev containers (Postgres, n8n).
• drizzle.config.ts, pnpm-workspace.yaml, next.config.ts: Configuration and build orchestration.
README for Additional Insights
• Confirms Next.js dev flow (pnpm dev), internal contributors, GNU GPL v3.
• References docs/README for setup (likely includes DB and n8n container definitions).
a. Main Components
• Client Browser (React/Next.js) – UI layer served via SSR/SSG.
• Next.js Server (Frontend + API) – Handles page rendering and REST/Route handlers under /api.
• Authentication Service – NextAuth engine within Next.js, connecting to database/session store + OAuth providers.
• Database (PostgreSQL) – stores users, candidates, stages via Drizzle ORM.
• n8n Workflow Engine – runs JSON-defined automations (e.g., notifications, data sync).
• External Services – Google Drive API for file storage; Email/SMTP; OAuth identity providers.
• DevOps/Infrastructure – Docker Compose orchestrating containers; PNPM workspace; CI/CD.
b. Relationships & Data Flow
1. User → Browser UI → Next.js page rendering
2. UI invokes Next.js API routes → Business logic in src/lib → Drizzle ORM → PostgreSQL
3. Auth flows: UI redirects to OAuth provider → Next.js Auth API → DB session storage
4. Backend triggers n8n workflows via webhooks or direct HTTP calls
5. n8n connects to Google Drive for file operations (folders/files)
6. n8n can push updates back to the Next.js API or send emails
c. Architectural Patterns & Principles
• Monorepo with PNPM – unified dependency management.
• Modular Frontend – React components, hooks, contexts for ability-based rendering.
• Layered Backend – API routes → server utilities (lib/server) → data models → DB.
• Infrastructure-as-Code – Docker Compose + init scripts.
• Workflow-Oriented Services – n8n handles asynchronous tasks, decoupling them from user requests.
d. Key Technologies & Frameworks
• Next.js (React, SSR/SSG, App Router)
• TypeScript, Drizzle ORM, PostgreSQL
• NextAuth or custom auth handlers
• n8n (workflow engine)
• Google Drive API integration
• Tailwind/PostCSS, ESLint, Prettier, Husky
Detail without Overthinking
• Data models and seed/reset scripts as part of the DB layer.
• Docker Compose as the orchestration layer that brings up DB + n8n + Next.js.
• Every node that moves or transforms data: UI → API → ORM → DB → workflows → external.