DocumentsBAWES Universe
Frontend Architecture
Frontend Architecture
Type
Topic
Status
Published
Created
Jul 7, 2026
Updated
Jul 7, 2026

StudentHub Frontend Architecture#

StudentHub uses a multi-app frontend architecture: four separate Ionic/Angular applications, each deployed independently for a distinct user type, all talking to a single PHP/Yii2 backend.

AppRepoFrameworkAPI Endpoint (prod)
Candidatestudenthub-candidateAngular 15 / Ionic 6https://student.api.studenthub.co/v1
Staffstudenthub-staffAngular 15 / Ionic 6https://staff.api.studenthub.co/v1
Adminstudenthub-adminAngular 15 / Ionic 6https://admin.api.studenthub.co/v1
Companystudenthub-companyAngular 14 / Ionic 6https://employer.api.studenthub.co/v1

Each app is an independent SPA. The backend (studenthub) exposes a separate /v1 API module per user type, with distinct ports for local development: Admin (21080), Candidate (22080), Company (23080), Staff (25080), plus Inspector (24080) and Verification (26080) .


Per-App Entry Points#

Each app shares a consistent internal structure:

  • Environment configsrc/environments/environment*.ts holds the apiEndpoint, Cloudinary URL, and S3 bucket. Multiple configs exist: dev, prod, docker, and per-developer overrides (khalid, krushn, etc.). The Angular build swaps files at compile time .
  • App modulesrc/app/app.module.ts bootstraps IonicModule.forRoot(), Auth0, Service Worker, IonicStorageModule, and runs APP_INITIALIZER providers (Auth + AWS) before the app becomes interactive.
    • Candidate:
    • Staff: — storage DB name __payroll_staff
    • Admin:
    • Company:
  • Routingsrc/app/app-routing.module.ts uses lazy-loaded loadChildren imports throughout. All authenticated routes are guarded by AuthService. A custom SelectiveLoadingStrategy handles preloading.
    • Candidate routes — work logging, wallet, chat, profile completion
    • Staff routes — candidates, companies, stores, teams, transfers, expenses, leave
    • Admin routes — dashboard, staff, company, university, transfer management
    • Company routes — contracts, work logs, invoices, chat

Authentication#

All four apps use Auth0 (bawes.us.auth0.com) for identity, configured at the Angular module level . The Auth0 token is passed to the Yii2 backend as an HTTP Bearer token. The backend validates it via a custom JWT component that supports HS256/RS256 algorithms . Initial login uses HTTP Basic Auth to exchange credentials for a bearer token; subsequent requests use Authorization: Bearer <token> .


Deployment#

Every app uses the same two-stage Docker build pattern:

  1. Build stagenode:14-alpine image installs Ionic CLI globally and runs npm run-script build:production .
  2. Serve stagenginx:alpine copies the compiled output from /app/www/ and serves it as static files .

See Dockerfiles: candidate, staff, admin, company.

CORS on the backend is handled per controller via Yii's Cors filter. Allowed origins come from Yii::$app->params['allowedOrigins']; both dev and production configs currently set this to '*' . Pagination metadata is exposed via X-Pagination-* headers .


Architecture Diagram#

Loading diagram...