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.
| App | Repo | Framework | API Endpoint (prod) |
|---|---|---|---|
| Candidate | studenthub-candidate | Angular 15 / Ionic 6 | https://student.api.studenthub.co/v1 |
| Staff | studenthub-staff | Angular 15 / Ionic 6 | https://staff.api.studenthub.co/v1 |
| Admin | studenthub-admin | Angular 15 / Ionic 6 | https://admin.api.studenthub.co/v1 |
| Company | studenthub-company | Angular 14 / Ionic 6 | https://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 config —
src/environments/environment*.tsholds theapiEndpoint, 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 module —
src/app/app.module.tsbootstrapsIonicModule.forRoot(), Auth0, Service Worker,IonicStorageModule, and runsAPP_INITIALIZERproviders (Auth + AWS) before the app becomes interactive.- Candidate:
- Staff: — storage DB name
__payroll_staff - Admin:
- Company:
- Routing —
src/app/app-routing.module.tsuses lazy-loadedloadChildrenimports throughout. All authenticated routes are guarded byAuthService. A customSelectiveLoadingStrategyhandles 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:
- Build stage —
node:14-alpineimage installs Ionic CLI globally and runsnpm run-script build:production. - Serve stage —
nginx:alpinecopies 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 .