University of Peradeniya crestSCS Documentation
University of Peradeniya crestSCS Documentation
Department website

Start here

Repository handbookRepository overviewDevelopment

System design

ArchitectureAuthentication and authorizationPublic dataAPI contractsSchemas
UI system

Applications

Department Web applicationPeople applicationProjects applicationPortal application
Application internals
Portal internalsPortal routing and accessPortal editor state and mutationsPortal data loading and failures

Services

API serviceGitHub App serviceMailer service

Shared packages

Schemas packageUI packageTypeScript configuration packageESLint configuration package

Development workflow

Testing and verificationDependency managementDocumentation authoringUI quality assurance

Operations

Continuous integrationEnvironment variablesOperationsSecurityTroubleshooting

Reference

Route referenceGlossary
Application internalsPortal internals

How Portal routes, session hints, server authorization, and navigation divide responsibility.

Portal routing and access

Portal access control is layered. A session cookie can improve navigation, but only an API-backed identity and permission decision can authorize data or an administrative surface.

Route families

Route familyPurpose
/login, /signupemail-code, OAuth, and passkey entry flows
/dashboard, /account/*signed-in landing page and current account settings
/user/me/*current member profile and publishing workflows
/user/projects/*member project editing and submission
/user/proxydelegated profile-management settings
/academic/courses/*course and offering editing
/admin/users/*user inspection and administration
/admin/projects/*administrative project editing
/admin/proxiesproxy relationship administration
/admin/academic-rulesstudent placement metadata
/privacy, /tospublic policy pages

Guard sequence

src/proxy.ts only checks for the Better Auth session-token cookie. It does not validate that cookie, load a user, or inspect a role. Treat it as an optimistic routing filter, never as an authorization boundary.

The /admin layout performs an additional server-side /api/me request and requires the super-admin role before it renders children. Individual API endpoints still enforce their own permissions. A hidden navigation item or a successful proxy check must never be treated as permission to read or mutate a resource.

Session navigation and logout

The shared Portal header renders signed-out entry actions or signed-in account actions from the current session state. The responsive menu carries the same destinations rather than creating a second navigation model.

GET and POST /logout expire every supported Portal session cookie at the host and configured cookie domain, then redirect to /login?error=invalid_session. Server fetches use this route when the API returns 401, ensuring stale cookies are cleared before another login attempt.

Better Auth client requests target NEXT_PUBLIC_BASE_API_URL, use the /api/auth base path, and include credentials. Public runtime configuration is safe for the browser; provider secrets and cookie-domain configuration remain server-side as documented in Environment variables.

Portal internals

Runtime map of Portal routes, trust boundaries, editor workflows, data loading, and failure handling.

Portal editor state and mutations

The shared editor state machine, form and JSON surfaces, validation, submission, and operation polling.

On this page

Portal routing and accessRoute familiesGuard sequenceSession navigation and logout