How dogukantopcu/iyte-gms works
Project Type and Purpose
• Full-stack web application for managing graduation processes (student records, transcripts, advisors, ceremonies).
• Built on Next.js with server-side rendering, REST API routes, Prisma ORM, and a PostgreSQL database.
• Integrates with UBYS (university back-office) via REST endpoints.
File Structure
• app/… – Next.js “app router” pages & layout components (login, student dashboard, advisor dashboard, student-affairs admin).
• app/api/… – Serverless REST API routes (auth, init, student, ubys/*).
• _components/ & app/(app)/_components – Shared React UI components (tables, cards, buttons, sidebar).
• lib/prisma.ts – Prisma client instantiation.
• prisma/schema.prisma & prisma/migrations – Database schema and migration history.
• context/AuthContext.tsx & middleware.ts – Authentication context and route protection.
• public/ – Static assets (logos, images).
• next.config.js, tailwind.config.js – Framework and styling configurations.
README for Additional Insights
• Tech stack: Next.js, Tailwind CSS, Prisma ORM, Neon PostgreSQL, Vercel hosting.
• UBYS API endpoints defined under /api/ubys.
• Authentication via JWT (see prisma migration for jwt_table).
Main Components & Relationships
A. Presentation Layer (Client Browser / React UI)
– Next.js pages (Login, Student Dashboard, Advisor Dashboard, Student Affairs Dashboard)
– React components (AdvisorInfoCard, StudentsTable, TranscriptCard, Sidebar, etc.)
– AuthContext – manages user session & injects JWT into requests
B. Application Layer (Next.js Server & API)
– Next.js server runtime handling page rendering & API routes
– API Routes:
• /api/auth – login, JWT issuance
• /api/init/* – seed and initialization endpoints (createInstitutions, admins, students, etc.)
• /api/student/* – internal student creation & existence checks
• /api/ubys/* – proxy/endpoints fetching data from the external UBYS system (admins, advisors, students, transcripts, outlierstudents)
C. Data Layer
– Prisma ORM (lib/prisma.ts)
– Neon PostgreSQL database
• Tables: users (admins, advisors, students), departments, faculties, units, transcripts, jwt_tokens
D. External Services
– UBYS external REST API (institution’s back-office system)
E. Deployment & Hosting
– Vercel (Next.js serverless functions, static asset hosting)
1. Client → Next.js Pages (HTTP/HTTPS)
2. Next.js Pages → API Routes (fetch/axios calls)
3. API Routes → Prisma Client → PostgreSQL (CRUD operations)
4. API Routes (/api/ubys) → External UBYS REST endpoints → API routes → Prisma (caching or mapping)
5. Authentication flow:
• LoginForm → /api/auth → JWT created & stored in jwt_table → JWT stored in client cookie → AuthContext reads JWT → authorizes page access
Architectural Patterns & Principles
• Folder-based routing (Next.js App Router) separating pages and API.
• React Context for cross-cutting concerns (authentication).
• Single ORM layer (Prisma) abstracting database schema & queries.
• RESTful API design for internal and external integrations.
• Serverless functions (API routes) isolating business logic.
Elements
• Data flow direction.
• Annotations for key technologies (Next.js, Tailwind, Prisma, PostgreSQL).
• Authentication flow (AuthContext, JWT, middleware).