Skip to content
All projects
In progressNext.js web application

PDP School Platform

My most modern codebase. A Next.js 14 app with TypeScript, Tailwind and Zustand, where the foundation comes first: typed models, one API layer with token handling, and stores for the session and courses. Screens are being built on top of it.

No live demo yet(No live demo for this project yet) GitHub

Technologies

  • Next.js 14
  • TypeScript
  • Tailwind CSS
  • Zustand
  • Axios
  • React Hook Form
  • Zod

Problem

Managing students, teachers and courses needs more than pages. It needs typed data, an authentication flow, and one place where every API call lives.

Solution

An axios client attaches the access token to each request and deals with expired ones, Zustand stores keep the session and course state across reloads, and TypeScript types describe users and courses for the whole app.

Architecture

Where a request goes, and where the token is attached along the way.

  1. Next.js app

    React 18 + TypeScript + Tailwind

    • /auth
    • /dashboard
    • /courses
    • /schedule
  2. Stores

    Zustand, persisted

    • authStore
    • courseStore
  3. API client

    Axios with interceptors

    • Bearer token
    • 401 refresh
    • error handling
  4. Services

    One module per domain

    • authService
    • courseService
  5. REST API

    Backend endpoints

    • /auth/login
    • /auth/refresh
    • /courses

The auth flow

Logging in is the easy part. Staying logged in without re-typing a password is the interesting one.

  1. Log in

    Credentials are posted to the API

  2. Tokens stored

    Access and refresh tokens in the persisted store

  3. Request

    The interceptor attaches the access token

  4. 401 expired

    The client refreshes once, then retries

  5. Refresh fails

    The store logs the user out

  • Admin

    • Manage users and roles
    • Create courses and groups
    • Build the timetable
  • Teacher

    • Manage own courses
    • Mark attendance and results
    • View own schedule
  • Student

    • Browse and join courses
    • See results and attendance
    • View the timetable

Planned routes

RoutePagePurpose
/authAuthLogin and register; stores the access and refresh tokens.
/dashboardDashboardRole-aware overview of courses and progress.
/coursesCoursesCourse list, details and enrolment.
/studentsStudentsStudent records for admins and teachers.
/teachersTeachersTeacher profiles and their courses.
/scheduleScheduleWeekly timetable per group and per teacher.

Key features

  • Typed data models for users and courses
  • Axios API client with request and response interceptors
  • JWT access token and refresh token handling
  • Auth store persisted across reloads
  • Course service and store
  • Tailwind design tokens and shared navigation constants

What I learned

  • Interceptors keep authentication logic out of every component
  • What belongs in a persisted store — and what definitely doesn't
  • Designing types and services before building screens saves rewrites
Next projectShopCo