How gxjakkap/cc36staffapp works
Project Type and Purpose
• This is a full-stack web application.
• Its primary purpose is managing applicants and participant data. It includes features for admin management (adding/editing/deleting staff), user authentication, and various dashboards.
• The README and file structure indicate integration with migration management (drizzle-staff) and authentication via Better-Auth.
Main Components
a. Frontend Layer:
• Next.js Pages and Components: Represented by the “src/app”, “src/components”, and “src/pages (if any)” directories.
• Separate routing logic for authenticated (“(authed)”) versus unauthenticated (“(unauth)”) views.
• UI elements, shared components, and layout files – highlight that there’s a heavy use of React components and UI primitives (found in src/components/ui).
b. Backend/API Layer:
• API Endpoints: Found in “src/app/api/…” using Next.js API routes (such as “[...all]/route.ts” under auth).
• Server-side business logic (e.g., authentication actions, migrations) including integration with Better-Auth.
• Utilization of server actions within "src/app/(authed)" directories.
c. Data Access and Database Layer:
• Database configuration and schema: The “src/db” directory holds code related to setting up the database schema and performing queries.
• Drizzle ORM and migration scripts: The “drizzle.config.ts”, “drizzle.staff.config.ts”, and the “drizzle-staff” directory (with SQL migration files and meta snapshots) are key parts that manage database migrations for live and development DBs.
• The local development database is managed via Docker (using compose-db.yml and docker-compose.yml) and Supabase is used in production.
d. Authentication & External Services:
• Better-Auth integration: Noted by environment variables in the README and migration commands related to @better-auth/cli.
• External storage and services (Supabase and S3) for storage and database connectivity.
e. DevOps and CI/CD:
• GitHub workflows (in .github/workflows) and Docker-related files (Dockerfile, docker-compose.yml) to manage build, deployment, and development processes.
Relationships and Data Flow
• End-users interacting with the frontend (different flows for unauthenticated (login) and authenticated users).
• The frontend (Next.js client and server components) communicating with API endpoints for tasks such as authentication, data management, and performing actions on staff/student data.
• The API layer interacting with the database through the Drizzle ORM abstraction and migrations managed by the “drizzle-staff” scripts.
• External authentication services (via Better-Auth) and storage/database provided by Supabase and S3.
• CI/CD pipelines triggering tests and builds via GitHub Workflows.
Architectural Patterns & Design Principles
• Separation of concerns is evident: the UI is clearly separated from business logic and database access.
• The file-based routing of Next.js is used to segregate authenticated routes from unauthenticated ones.
• MVC/MVP-like principles can be inferred; while not explicitly strictly model-view-controller, clear boundaries are maintained between views (React components), controllers (Next.js API routes and server actions), and models (database schema and migration scripts).