Skip to content

codezelat/cca-student-onboarding-next

Repository files navigation

πŸŽ“ Codezela Career Accelerator - Student Onboarding Platform

Codezela Career Accelerator

A modern, full-stack student registration and management system for Codezela Career Accelerator programs.

Features β€’ Tech Stack β€’ Architecture β€’ Getting Started β€’ Deployment


πŸ“‹ Table of Contents


🎯 Overview

The Codezela Career Accelerator Student Onboarding Platform is a comprehensive web application designed to streamline the student registration process for career accelerator programs. It features a beautiful, animated public-facing registration form and a powerful admin dashboard for managing registrations, programs, payments, and user accounts.

Key Highlights

  • 🎨 Stunning UI/UX β€” Glassmorphism design with Three.js animated backgrounds
  • πŸ” Secure Authentication β€” Supabase Auth with Row Level Security (RLS)
  • πŸ“„ Document Management β€” Secure file uploads to Cloudflare R2
  • πŸ“Š Admin Dashboard β€” Comprehensive management tools with activity logging
  • 🌍 International Support β€” Multi-country support with localized fields
  • β™Ώ Accessibility First β€” WCAG compliant components
  • ⚑ Performance Optimized β€” Next.js 16 with streaming and edge capabilities

✨ Features

Public Portal

Feature Description
πŸ“ Multi-Step Registration Comprehensive form with program selection, personal info, contact details, qualifications, and document uploads
🎨 3D Animated Homepage Interactive Three.js geometric shapes with mouse-responsive animations
πŸ“Ž Secure File Uploads Direct-to-cloud uploads with presigned URLs (academic docs, ID proof, photo, payment slip)
πŸ›‘οΈ Spam Protection Cloudflare Turnstile integration
πŸ“± Responsive Design Mobile-first approach with Tailwind CSS
🌐 International Support Country selection with dynamic Sri Lankan province/district fields

Admin Dashboard

Feature Description
πŸ“Š Analytics Overview Real-time statistics on registrations, programs, and payments
πŸ‘₯ Registration Management View, search, filter, edit, and soft-delete student registrations
πŸ“š Program Management Create, edit, and manage accelerator programs and intake windows
πŸ’° Finance & Payments Track payments, generate financial reports, manage payment status
πŸ‘€ User Accounts Admin user management with role-based access
πŸ“œ Activity Logging Comprehensive audit trail for all admin actions
πŸ” Advanced Filtering Multi-criteria search and filtering capabilities
πŸ“₯ CSV Export Export registrations and payment data to CSV
πŸ–ΌοΈ Document Viewer Built-in image/PDF viewer with zoom and pan capabilities
πŸ’³ Payment Recording Record new payments and void existing ones
πŸ”” Toast Notifications Real-time feedback for all user actions

πŸ› οΈ Tech Stack

Core Framework

Database & Backend

Storage & File Handling

UI & Styling

  • Tailwind CSS 4 β€” Latest version with @import "tailwindcss" syntax
  • shadcn/ui β€” Beautiful, accessible components (30+ components)
  • Radix UI β€” Unstyled, accessible primitives
  • CSS Variables β€” Custom theming with HSL color system
  • Glassmorphism β€” Backdrop blur and transparency effects throughout
  • Framer Motion β€” Smooth animations
  • Three.js β€” 3D graphics and animations
  • Lucide React β€” Icon library

Forms & Validation

Animation & Effects

  • Framer Motion β€” Page transitions and micro-interactions
  • Three.js β€” 3D animated background on homepage
  • Tailwind CSS Animations β€” Blob animations, hover effects, transitions

Security


πŸ—οΈ Architecture

System Architecture Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              Client Layer                                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Public Pages  β”‚  β”‚   Admin Pages   β”‚  β”‚    API Routes           β”‚  β”‚
β”‚  β”‚                 β”‚  β”‚                 β”‚  β”‚                         β”‚  β”‚
β”‚  β”‚  / (Homepage)   β”‚  β”‚  /admin         β”‚  β”‚  /api/registrations     β”‚  β”‚
β”‚  β”‚  /cca-register  β”‚  β”‚  /admin/programsβ”‚  β”‚  /api/upload/presign    β”‚  β”‚
β”‚  β”‚                 β”‚  β”‚  /admin/finance β”‚  β”‚                         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚                    β”‚                       β”‚
            β–Ό                    β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Server Layer (Next.js)                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Server Actions β”‚  β”‚  Prisma Client  β”‚  β”‚  File Upload Service    β”‚  β”‚
β”‚  β”‚                 β”‚  β”‚                 β”‚  β”‚                         β”‚  β”‚
β”‚  β”‚  Dashboard      β”‚  β”‚  Database       β”‚  β”‚  Cloudflare R2          β”‚  β”‚
β”‚  β”‚  Actions        β”‚  β”‚  Queries        β”‚  β”‚  (S3-Compatible)        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚                    β”‚                       β”‚
            β–Ό                    β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        External Services                                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚    Supabase     β”‚  β”‚  Cloudflare R2  β”‚  β”‚   Cloudflare Turnstile   β”‚  β”‚
β”‚  β”‚                 β”‚  β”‚                 β”‚  β”‚                         β”‚  β”‚
β”‚  β”‚  PostgreSQL     β”‚  β”‚  Object Storage β”‚  β”‚   Bot Protection        β”‚  β”‚
β”‚  β”‚  Auth           β”‚  β”‚  CDN            β”‚  β”‚                         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Route Groups

app/
β”œβ”€β”€ (public)/          # Public routes (no auth required)
β”‚   β”œβ”€β”€ page.tsx       # Homepage with 3D animation
β”‚   └── register/      # Registration form
β”‚
β”œβ”€β”€ (admin)/           # Admin routes (auth required)
β”‚   └── admin/
β”‚       β”œβ”€β”€ login/     # Admin login
β”‚       └── (dashboard)/
β”‚           β”œβ”€β”€ page.tsx           # Dashboard home
β”‚           β”œβ”€β”€ programs/          # Program management
β”‚           β”œβ”€β”€ registrations/     # Registration management
β”‚           β”œβ”€β”€ finance/           # Payment tracking
β”‚           β”œβ”€β”€ accounts/          # User management
β”‚           └── activity/          # Activity logs
β”‚
└── api/               # API routes
    β”œβ”€β”€ registrations/ # Registration CRUD
    └── upload/        # File upload handlers

πŸ“ Project Structure

cca-student-onboarding-next/
β”œβ”€β”€ πŸ“ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ (admin)/                     # Admin route group
β”‚   β”‚   └── admin/
β”‚   β”‚       β”œβ”€β”€ (dashboard)/         # Dashboard layout
β”‚   β”‚       β”‚   β”œβ”€β”€ accounts/        # User management
β”‚   β”‚       β”‚   β”œβ”€β”€ activity/        # Activity logs
β”‚   β”‚       β”‚   β”œβ”€β”€ finance/         # Finance dashboard
β”‚   β”‚       β”‚   β”œβ”€β”€ programs/        # Program CRUD
β”‚   β”‚       β”‚   β”œβ”€β”€ registrations/   # Registration management
β”‚   β”‚       β”‚   β”œβ”€β”€ dashboard-actions.ts
β”‚   β”‚       β”‚   └── page.tsx
β”‚   β”‚       └── login/               # Admin login page
β”‚   β”œβ”€β”€ (public)/                    # Public route group
β”‚   β”‚   β”œβ”€β”€ page.tsx                 # Homepage
β”‚   β”‚   └── register/                # Registration form
β”‚   β”œβ”€β”€ api/                         # API routes
β”‚   β”‚   β”œβ”€β”€ registrations/           # Registration API
β”‚   β”‚   └── upload/                  # File upload API
β”‚   β”œβ”€β”€ globals.css
β”‚   └── layout.tsx
β”‚
β”œβ”€β”€ πŸ“ components/                   # React components
β”‚   β”œβ”€β”€ admin/                       # Admin-specific components
β”‚   β”œβ”€β”€ layout/                      # Layout components
β”‚   └── ui/                          # shadcn/ui components
β”‚
β”œβ”€β”€ πŸ“ lib/                          # Utility libraries
β”‚   β”œβ”€β”€ data/                        # Static data (countries, districts)
β”‚   β”œβ”€β”€ hooks/                       # Custom React hooks
β”‚   β”œβ”€β”€ services/                    # Business logic services
β”‚   β”œβ”€β”€ supabase/                    # Supabase clients
β”‚   β”œβ”€β”€ validations/                 # Zod schemas
β”‚   β”œβ”€β”€ prisma.ts                    # Prisma client
β”‚   └── utils.ts                     # Utility functions
β”‚
β”œβ”€β”€ πŸ“ hooks/                        # Global hooks
β”‚
β”œβ”€β”€ πŸ“ prisma/                       # Database schema
β”‚   └── schema.prisma
β”‚
β”œβ”€β”€ πŸ“ scripts/                      # Utility scripts
β”‚   β”œβ”€β”€ enable-rls.ts               # Enable Row Level Security
β”‚   β”œβ”€β”€ seed-admin.ts               # Seed admin user
β”‚   β”œβ”€β”€ seed-programs.ts            # Seed program data
β”‚   └── test-db.ts                  # Database connection test
β”‚
β”œβ”€β”€ πŸ“ public/                       # Static assets
β”‚   └── images/
β”‚
β”œβ”€β”€ .env.example                     # Environment template
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE                          # Proprietary license
β”œβ”€β”€ next.config.ts
β”œβ”€β”€ package.json
β”œβ”€β”€ postcss.config.mjs
β”œβ”€β”€ prisma.config.ts
β”œβ”€β”€ README.md
└── tsconfig.json

πŸš€ Getting Started

Prerequisites

  • Node.js 20.x or later
  • npm 10.x or later
  • PostgreSQL database (Supabase recommended)
  • Cloudflare R2 bucket (for file storage)
  • Supabase project (for auth and database)

1. Clone the Repository

git clone <repository-url>
cd cca-student-onboarding-next

2. Install Dependencies

npm install

3. Configure Environment Variables

cp .env.example .env

Edit .env with your credentials. See Environment Variables for details.

4. Set Up the Database

# Generate Prisma client
npx prisma generate

# Run database migrations
npx prisma migrate dev --name init

# (Optional) Seed programs
npx tsx scripts/seed-programs.ts

# (Optional) Create admin user
npx tsx scripts/seed-admin.ts

# (Optional) Enable RLS
npx tsx scripts/enable-rls.ts

5. Start Development Server

npm run dev

Open http://localhost:3000 in your browser.


πŸ” Environment Variables

Required Variables

Variable Description Source
NEXT_PUBLIC_SUPABASE_URL Supabase project URL Supabase Dashboard
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY Supabase anon key Supabase Dashboard
SUPABASE_SECRET_KEY Supabase service role key Supabase Dashboard
DATABASE_URL PostgreSQL connection URL (with PgBouncer) Supabase Dashboard
DIRECT_URL Direct PostgreSQL connection URL Supabase Dashboard
AUTH_SECRET NextAuth.js secret Generate with openssl rand -base64 32

Turnstile Configuration

Variable Description Source
NEXT_PUBLIC_TURNSTILE_SITE_KEY Turnstile site key Cloudflare Dashboard
TURNSTILE_SECRET_KEY Turnstile secret key Cloudflare Dashboard
TURNSTILE_ALLOWED_HOSTNAME Optional hostname pin for server validation Your deployment hostname

Cloudflare R2 Configuration

Variable Description Source
R2_ACCESS_KEY_ID R2 access key ID Cloudflare R2 Dashboard
R2_SECRET_ACCESS_KEY R2 secret key Cloudflare R2 Dashboard
R2_BUCKET Bucket name Cloudflare R2 Dashboard
R2_ENDPOINT R2 endpoint URL Cloudflare R2 Dashboard
R2_PUBLIC_URL Public access URL Cloudflare R2 Dashboard

Admin Seeding

Variable Description Example
SEED_ADMIN_EMAIL Initial admin email admin@example.com
SEED_ADMIN_PASSWORD Initial admin password ChangeMe123!
SEED_ADMIN_NAME Initial admin name Admin User

Application

Variable Description Default
NEXT_PUBLIC_APP_URL Public app URL http://localhost:3000

πŸ—„οΈ Database Schema

Entity Relationship Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      User       β”‚     β”‚  ProgramIntakeWindowβ”‚     β”‚     Program     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€     β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€     β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ id (PK)         β”‚     β”‚ id (PK)             β”‚     β”‚ id (PK)         β”‚
β”‚ name            β”‚     β”‚ programId (FK)      │────▢│ code (Unique)   β”‚
β”‚ email (Unique)  β”‚     β”‚ windowName          β”‚     β”‚ name            β”‚
β”‚ password        β”‚     β”‚ opensAt             β”‚     β”‚ yearLabel       β”‚
β”‚ role            β”‚     β”‚ closesAt            β”‚     β”‚ durationLabel   β”‚
β”‚ createdAt       β”‚     β”‚ priceOverride       β”‚     β”‚ basePrice       β”‚
β”‚ updatedAt       β”‚     β”‚ isActive            β”‚     β”‚ currency        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚ createdAt           β”‚     β”‚ isActive        β”‚
         β”‚              β”‚ updatedAt           β”‚     β”‚ createdBy (FK)  │◀──┐
         β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚ updatedBy (FK)  │◀───
         β”‚                                          β”‚ createdAt       β”‚   β”‚
         β”‚                                          β”‚ updatedAt       β”‚   β”‚
         β”‚                                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
         β”‚                                                                β”‚
         β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                          β”‚
         β”‚              β”‚  CCARegistration    β”‚                          β”‚
         β”‚              β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€                          β”‚
         β”‚              β”‚ id (PK)             β”‚                          β”‚
         β”‚              β”‚ registerId (Unique) β”‚                          β”‚
         β”‚              β”‚ programId (FK)      β”‚β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚              β”‚ fullName            β”‚
         β”‚              β”‚ emailAddress        β”‚
         β”‚              β”‚ ...                 β”‚
         β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                         β”‚
         β”‚                         β”‚
         β–Ό                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       RegistrationPayment             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ id (PK)                               β”‚
β”‚ ccaRegistrationId (FK)                β”‚
β”‚ paymentNo                             β”‚
β”‚ amount                                β”‚
β”‚ paymentMethod                         β”‚
β”‚ status (active/void)                  β”‚
β”‚ createdAt                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Models

CCARegistration

Core registration model storing student application data:

  • Personal information (name, DOB, gender)
  • Contact details (address, email, phone)
  • Identification (NIC/Passport)
  • Qualifications and documents
  • Payment information
  • Document URLs (stored as JSON)

Program

Career accelerator programs:

  • Program code, name, and metadata
  • Pricing and currency
  • Active/inactive status
  • Display ordering

ProgramIntakeWindow

Enrollment periods for programs:

  • Opening and closing dates
  • Price overrides for specific windows
  • Active status

RegistrationPayment

Payment tracking for registrations:

  • Payment history with sequential numbers
  • Void capability with audit trail
  • Receipt reference tracking

AdminActivityLog

Comprehensive audit logging:

  • Actor identification (user snapshots)
  • Action categorization
  • Before/after data storage
  • IP address and user agent tracking

⚑ Server Actions

The application uses Next.js Server Actions for all data mutations:

Dashboard Actions (dashboard-actions.ts)

Action Description
getDashboardStats() Get registration statistics (active, trashed, total, by tags)
getRegistrations() Fetch registrations with filtering and search
getActivePrograms() List all programs for filters
toggleRegistrationTrash() Soft-delete or restore a registration
purgeRegistration() Permanently delete a registration
getRegistrationById() Fetch single registration with payments
updateRegistration() Update registration details

Program Actions (programs-actions.ts)

Action Description
getAllPrograms() List all programs with counts
getProgramById() Fetch program with intake windows
toggleProgramStatus() Activate/deactivate a program
upsertProgram() Create or update a program
deleteProgram() Delete program (if no registrations)
getProgramIntakes() List intake windows for a program
upsertIntakeWindow() Create or update intake window
toggleIntakeStatus() Activate/deactivate intake window
deleteIntakeWindow() Delete an intake window

Finance Actions (finance-actions.ts)

Action Description
getFinanceStats() Get total revenue and payment counts
getPaymentLedger() List all payment transactions
addPayment() Record a new payment
voidPayment() Void a payment with reason

Admin Actions (actions.ts)

Action Description
loginAction() Authenticate admin user with Turnstile
logoutAction() Sign out current user
getAdminUsers() List all admin users
createAdminUser() Create new admin account
deleteAdminUser() Delete an admin account

πŸ”Œ API Routes

/api/registrations

Method Endpoint Description
POST /api/registrations Create new registration

Request Body:

{
  turnstile_token: string;
  program_id: string;
  full_name: string;
  name_with_initials: string;
  gender: "male" | "female";
  date_of_birth: string;
  // ... other fields
  academic_urls: string;      // JSON string of URLs
  nic_urls: string;           // JSON string of URLs
  passport_urls: string;      // JSON string of URLs
  photo_url: string;
  payment_url: string;
}

/api/upload/presign

Method Endpoint Description
POST /api/upload/presign Get presigned URL for file upload

Request Body:

{
  filename: string;
  contentType: string;
  directory: "documents" | "receipts" | "avatars";
}

Response:

{
  success: true;
  data: {
    url: string;        // Presigned upload URL
    key: string;        // Storage key
    publicUrl: string;  // Public access URL
  }
}

πŸ› οΈ Scripts

Database Setup

# Test database connection
npx tsx scripts/test-db.ts

# Enable Row Level Security on all tables
npx tsx scripts/enable-rls.ts

# Seed programs data
npx tsx scripts/seed-programs.ts

# Create initial admin user
npx tsx scripts/seed-admin.ts

Utility Scripts

Script Purpose
test-db.ts Verify database connectivity
enable-rls.ts Enable RLS policies on all tables
seed-programs.ts Seed 30+ career programs
seed-admin.ts Create initial admin user

πŸ“¦ Deployment

Vercel (Recommended)

  1. Push to GitHub

    git push origin main
  2. Connect to Vercel

    • Import project from GitHub
    • Framework preset: Next.js
  3. Configure Environment Variables

    • Add all variables from .env.example
  4. Deploy

    • Vercel will build and deploy automatically

Docker (Alternative)

# Dockerfile
FROM node:20-alpine AS base

FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package*.json ./
RUN npm ci

FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npx prisma generate
RUN npm run build

FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]

πŸ”’ Security

Implemented Security Measures

Feature Implementation
Row Level Security (RLS) PostgreSQL RLS policies on all tables
Authentication Supabase Auth with session management
File Upload Security Presigned URLs with 5-minute expiration
Bot Protection Cloudflare Turnstile on public submissions
Input Validation Zod schema validation on all inputs
SQL Injection Prevention Prisma ORM with parameterized queries
XSS Protection React's built-in escaping + CSP headers
CSRF Protection SameSite cookies + origin validation

Security Best Practices

  1. Never commit .env files β€” Always use .env.example as template
  2. Rotate credentials regularly β€” Especially service account keys
  3. Enable RLS β€” Run scripts/enable-rls.ts after migrations
  4. Validate file types β€” Server-side validation on uploads
  5. Rate limiting β€” Implement on API routes for production

πŸ“„ License

This project is proprietary software owned by Codezela Technologies (Pvt) Ltd.

Copyright (c) 2026 Codezela Technologies (Pvt) Ltd
All Rights Reserved.

Unauthorized copying, distribution, modification, public display, or public
performance of this Software is strictly prohibited.

For licensing inquiries, please contact Codezela Technologies (Pvt) Ltd.

See LICENSE for full terms.


🀝 Support


Built with ❀️ by Codezela Technologies (Pvt) Ltd

Β© 2026 Codezela Technologies (Pvt) Ltd. All rights reserved.

About

Student registration and management system for Career Accelerator Programs by CodeZela written in NextJS 16

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages