SIWES 360 is a role-based Next.js frontend for managing the Student Industrial Work Experience Scheme workflow across students, supervisors, administrators, and super administrators.
The application supports a live backend integration mode and a mock-first local mode. In live mode, browser requests go through a same-origin API proxy and session cookies. In mock mode, feature services fall back to simulated data so UI work can continue without a backend.
- Public landing and authentication flows
- Student workspace for profile setup, report upload, report status, workflow progress, and student-safe assessment visibility
- Supervisor workspace for student search, submission review, and score entry
- Admin workspace for departmental monitoring, report oversight, and grading
- Super admin workspace for global oversight, department management, administrator visibility, and department-scoped reporting
- Role-protected routing for
student,supervisor,admin, andsuperadmin
- Next.js 16 with the App Router
- React 19
- TypeScript with
strictmode
- Tailwind CSS 4
tw-animate-css- Radix UI primitives
lucide-reactclass-variance-authority,clsx,tailwind-merge- Shared design primitives in
components/ui/
- TanStack Query
- Axios
- React Hook Form
- Zod
@hookform/resolvers- Sonner
- ESLint 9 with Next.js rules
- PostCSS with
@tailwindcss/postcss
- Node.js 20+
- npm
npm installCreate .env.local from .env.example:
cp .env.example .env.localCurrent environment variables:
NEXT_PUBLIC_API_BASE_URL=
NEXT_PUBLIC_API_TIMEOUT_MS=15000Behavior:
- Leave
NEXT_PUBLIC_API_BASE_URLempty to run in mock mode - Set
NEXT_PUBLIC_API_BASE_URLto the backend base URL to enable live API mode
Example:
NEXT_PUBLIC_API_BASE_URL=https://your-backend.example.com/
NEXT_PUBLIC_API_TIMEOUT_MS=60000npm run devOpen http://localhost:3000.
npm run lint
npm run build
npm run startThe README was previously outdated here. The app no longer uses localStorage for access or refresh tokens.
- Login and authenticated requests go through the same-origin API proxy at
app/api/[...path]/route.ts - Access and refresh tokens are stored in cookies, not browser local storage
- Protected layouts validate the session on the server through
lib/auth/server-session.ts proxy.tshandles route gating and auth-page redirects- The client Axios instance sends cookie-backed requests with
withCredentials
- Mock services still work when
NEXT_PUBLIC_API_BASE_URLis not configured - Mock auth keeps only lightweight role state for local development
- Login infers role from the identifier:
- identifiers containing
superadminenter the super admin workspace - identifiers containing
adminenter the admin workspace - identifiers containing
supervisorenter the supervisor workspace - all other identifiers default to the student workspace
- identifiers containing
/student/*/supervisor/*/admin/*/superadmin/*
Relevant files:
- app/api/[...path]/route.ts
- lib/api/client.ts
- lib/auth/server-session.ts
- lib/auth/session-config.ts
- features/auth/actions/auth-session-actions.ts
- features/auth/utils/mock-session.ts
- proxy.ts
- Landing page
- Login
- Registration
- Forgot password
- Reset password
- Invited-user password setup
- Dashboard and workflow checklist
- Profile management
- Report upload
- Report status and validation feedback
- Student assessment progress page
- Student score outputs are intentionally hidden; the UI now shows progress and workflow state instead of final marks
- Dashboard
- Profile management
- Student search
- Submission review
- Score entry
- Dashboard
- Profile management
- Student and supervisor management views
- Department-scoped report oversight
- Score entry
- PDF and CSV exports
- Operational settings shortcuts
- Dedicated route group and navigation
- Global dashboard-style access
- Administrators and departments views
- Department-gated report workflow
- Department switcher for report actions
The app uses App Router route groups to separate public and role-specific layouts without affecting public URLs.
app/(public)app/(student)app/(supervisor)app/(admin)app/(superadmin)
//auth/login/auth/register/auth/forgot-password/auth/reset-password/reset-password/student/student/profile/student/upload/student/report-status/student/scores/supervisor/supervisor/profile/supervisor/search/supervisor/submissions/supervisor/score-entry/[matricNo]/admin/admin/profile/admin/students/admin/reports/admin/settings/admin/score-entry/[matricNo]/superadmin/superadmin/profile/superadmin/students/superadmin/students/[matricNo]/superadmin/supervisors/superadmin/administrators/superadmin/departments/superadmin/reports/superadmin/settings/superadmin/score-entry/[matricNo]
The codebase uses a feature-based architecture on top of the App Router.
Each domain generally owns:
componentsservicesqueriesschemastypesutilsor constants where needed
This structure keeps route files thin and keeps transport logic, UI, and validation grouped by domain.
Typical flow:
- A route in
app/renders a feature component. - The component uses a query or mutation hook from
features/*/queries. - The hook calls a service from
features/*/services. - In live mode, the service uses the shared client in
lib/api/client.ts. - Requests are proxied through
app/api/[...path]/route.ts. - In mock mode, the service falls back to simulated local behavior.
- TanStack Query manages caching and invalidation.
siwes360/
|-- app/ # App Router entrypoints, route groups, layouts, API proxy
|-- components/
| `-- ui/ # shared reusable UI primitives
|-- features/
| |-- admin/
| |-- auth/
| |-- layout/
| |-- marketing/
| |-- student/
| `-- supervisor/
|-- lib/
| |-- api/ # API config, client, endpoints
| `-- auth/ # session config and server-side guards
|-- providers/ # app-wide providers
|-- public/
|-- proxy.ts # route protection and redirect rules
|-- backend_handoff.md
`-- frontend_feature_checklist.md
app/layout.tsxsets global providers and root layout concerns- route files are intentionally thin
app/api/[...path]/route.tsis the live-mode proxy boundary between browser requests and the backend
features/auth: auth screens, session behavior, reset-password flowfeatures/student: dashboard, upload, report status, workflow, student-safe assessment viewsfeatures/supervisor: search, review, scoring, profilefeatures/admin: dashboard, reporting, grading, departments, administratorsfeatures/layout: shell, header, navigation, role-aware layout behaviorfeatures/marketing: public landing page
- lib/api/config.ts reads environment-backed API settings
- lib/api/client.ts creates the shared cookie-based Axios client
- lib/api/endpoints.ts centralizes endpoint paths
- providers/app-providers.tsx
- providers/auth-session-provider.tsx
- providers/query-provider.tsx
- providers/toast-provider.tsx
All live feature services should use the shared client:
- requests are sent to the app-origin API proxy
- cookies carry the authenticated session
- the browser client does not read auth tokens directly
- timeout is environment-configurable
Many feature services still support:
- live backend behavior when the API base URL is configured
- mock behavior when it is not
That allows UI development without blocking on backend availability while keeping the call sites stable.
The app now includes endpoint handling for more than the original auth/profile surface, including:
- authentication
- password recovery and reset
- profile reads and updates
- report upload and status
- student workflow progress
- supervisor scoring
- admin scoring and reports
- finalize preview
- PDF and CSV exports
- department and administrator management
See lib/api/endpoints.ts for the current registry.
Handled with TanStack Query.
Default behavior is configured in providers/query-provider.tsx.
Handled through:
- cookie-backed session state in live mode
- server-validated role lookup for protected layouts
- a lightweight client session provider for role-aware UI
- mock-only role state when running without a backend
Forms consistently use:
- React Hook Form
- Zod
zodResolver- Sonner toasts
This keeps validation close to each feature and aligns typed payloads with UI behavior.
The app uses a custom visual system built on Tailwind and shared primitives.
- tokens live in
app/globals.css - surfaces, borders, and colors are driven by CSS variables
- the authenticated shell uses a shared sidebar and top header
- role workspaces reuse common shell patterns while keeping feature-specific screens separate
The root layout uses:
- Geist Sans
- Geist Mono
The repository uses the @/* alias from tsconfig.json.
- routes in
app/ - domain logic in
features/<domain>/ - shared low-level UI in
components/ui/ - cross-cutting infrastructure in
lib/andproviders/
- Add or update the route in
app/ - Add the feature component in
features/<domain>/components/ - Add or update types in
types/ - Add validation in
schemas/where needed - Add service logic in
services/ - Wrap reads and writes in TanStack Query hooks in
queries/ - Reuse shared UI primitives instead of rebuilding low-level components
This repository is no longer purely mock-session driven, but it still supports mock mode.
Current realities:
- live backend mode is supported through the app proxy and cookie-backed auth
- some features still keep mock fallbacks for local development
- route protection expects role semantics for
student,supervisor,admin, andsuperadmin - report and grading flows are increasingly aligned with the backend contract
The cleanest backend integration path remains:
- keep feature services as the integration seam
- preserve response shapes where possible
- let
lib/api/endpoints.tsremain the central path registry - keep role naming aligned with the frontend route model
- No automated test suite is present yet
- Mock mode still exists for parts of the product and should not be treated as production auth
- Some documentation outside this README may still lag behind recent changes
- Build behavior can still depend on external font fetching in restricted environments
If you are onboarding to the current codebase, start with:
- package.json
- app/layout.tsx
- app/api/[...path]/route.ts
- proxy.ts
- lib/auth/server-session.ts
- features/layout/config/navigation.ts
- providers/app-providers.tsx
- lib/api/endpoints.ts
- backend_handoff.md
SIWES 360 is now a four-role Next.js frontend with a feature-based structure, cookie-backed live auth flow, super admin support, department-gated reporting, and mock fallbacks for local development. The codebase is organized so that backend integration, role-specific expansion, and UI iteration can continue without rewriting the overall architecture.