Main Website CMS - Documentation
| Document Status | ||
|---|---|---|
| Document Owner | Product Engineering 2026 | Product Engineering 2026 |
| Contributors | Ari Darrell Muljono | Ari Darrell Muljono |
| Project Links | https://github.com/BikunApp/bikuntracker-frontend-v2 | https://github.com/BikunApp/bikuntracker-frontend-v2 |
| Project Links | cms.ristek.cs.ui.ac.id | cms.ristek.cs.ui.ac.id |
| Team | Theodore Kevin Himawan | theodore.kevin@ristek.cs.ui.ac.id |
| Team | Ari Darrell Muljono | darrell@ristek.cs.ui.ac.id |
| Team | Grace Karina | gracekarin@ristek.cs.ui.ac.id |
| Team | Yeshua Marco G. Manurung | marco@ristek.cs.ui.ac.id |
π Background
Overviewβ
This project is the Content Management System (CMS) for RISTEK's Main Website, built with Next.js, NextAuth.js for authentication, RTK Query for client-side data fetching, and shadcn/ui for most of the components.
Stakeholdersβ
- Users: UI students and staff (monitoring real-time bus locations), Bikun Administrators (accessing reporting dashboards and schedules).
- Upstream Dependencies: Bikun Tracker Backend V2 (providing REST API endpoints and /ws WebSocket), UI SSO (for authentication).
- Downstream Consumers: End-user devices (Mobile and desktop web browsers).
Scope & Boundariesβ
In Scope
- Real-time interactive map rendering using Leaflet.
- Maintaining continuous WebSocket connections to receive live bus GPS coordinates.
- User interface for bus schedule management and reporting.
- Client-side authentication integration utilizing UI CAS SSO.
- Local state management for bus movement interpolation.
Out of Scope
- Heavy computational processing for lane detection or lap history (strictly backend responsibility).
- Relational data storage or direct interaction with PostgreSQL.
- Ingesting raw hardware GPS data from Damri.
βοΈ Architecture & Design
System Diagramβ
Architecture Decisions (ADRs)β
- Language/Framework: React 19 + TypeScript built with Vite
- Routing: TanStack React Router
- State Management: Zustand
- Styling & UI: Tailwind CSS v4
- Map Visualization: Leaflet
π»Technical Specifications
API Documentationβ
Data Model/Schemaβ
Project Structureβ
main-website-cms
β£ .git
β β£ hooks
β β£ info
β β β exclude
β β£ logs
β β β HEAD
β β£ objects
β β β£ info
β β β pack
β β£ refs
β β β£ heads
β β β β main
β β β£ remotes
β β β β origin
β β β β β HEAD
β β β tags
β β£ config
β β£ description
β β£ HEAD
β β£ index
β β packed-refs
β£ .github
β β workflows
β β β£ deploy.yaml
β β β preview.yaml
β£ .husky
β β pre-commit
β£ public
β β£ decorators
β β£ logo
β£ src
β β£ app
β β β£ (routes)
β β β β£ (auth)
β β β β β£ signin
β β β β β β£ components
β β β β β β β£ auth-form.tsx
β β β β β β β decorator.tsx
β β β β β β£ layout.tsx
β β β β β β page.tsx
β β β β β signout
β β β β β β page.tsx
β β β β (base)
β β β β β£ achievement
β β β β β β£ components
β β β β β β β£ achievement-category
β β β β β β β β£ columns.tsx
β β β β β β β β table.tsx
β β β β β β β achivement
β β β β β β β β£ columns.tsx
β β β β β β β β table.tsx
β β β β β β£ edit
β β β β β β β [id]
β β β β β β β β page.tsx
β β β β β β£ new
β β β β β β β page.tsx
β β β β β β page.tsx
β β β β β£ client
β β β β β β£ components
β β β β β β β columns.tsx
β β β β β β page.tsx
β β β β β£ event
β β β β β β£ components
β β β β β β β£ event
β β β β β β β β£ columns.tsx
β β β β β β β β table.tsx
β β β β β β β event-category
β β β β β β β β£ columns.tsx
β β β β β β β β table.tsx
β β β β β β£ edit
β β β β β β β [id]
β β β β β β β β page.tsx
β β β β β β£ new
β β β β β β β page.tsx
β β β β β β page.tsx
β β β β β£ member
β β β β β β£ components
β β β β β β β columns.tsx
β β β β β β£ edit
β β β β β β β [id]
β β β β β β β β page.tsx
β β β β β β£ new
β β β β β β β page.tsx
β β β β β β page.tsx
β β β β β£ partnership
β β β β β β£ components
β β β β β β β columns.tsx
β β β β β β page.tsx
β β β β β£ product
β β β β β β£ components
β β β β β β β columns.tsx
β β β β β β£ edit
β β β β β β β [id]
β β β β β β β β page.tsx
β β β β β β£ new
β β β β β β β page.tsx
β β β β β β page.tsx
β β β β β£ program
β β β β β β£ components
β β β β β β β columns.tsx
β β β β β β£ edit
β β β β β β β [id]
β β β β β β β β page.tsx
β β β β β β£ new
β β β β β β β page.tsx
β β β β β β page.tsx
β β β β β£ project
β β β β β β£ components
β β β β β β β£ project
β β β β β β β β£ columns.tsx
β β β β β β β β table.tsx
β β β β β β β tags
β β β β β β β β£ columns.tsx
β β β β β β β β table.tsx
β β β β β β£ edit
β β β β β β β [id]
β β β β β β β β page.tsx
β β β β β β£ new
β β β β β β β page.tsx
β β β β β β page.tsx
β β β β β£ sig
β β β β β β£ components
β β β β β β β columns.tsx
β β β β β β£ edit
β β β β β β β [id]
β β β β β β β β page.tsx
β β β β β β£ new
β β β β β β β page.tsx
β β β β β β page.tsx
β β β β β£ layout.tsx
β β β β β£ loading.tsx
β β β β β page.tsx
β β β£ api
β β β β£ auth
β β β β β [...nextauth]
β β β β β β route.ts
β β β β s3
β β β β β upload-image
β β β β β β route.ts
β β β£ favicon.ico
β β β£ globals.css
β β β£ layout.tsx
β β β£ not-found.tsx
β β β robots.txt
β β£ components
β β β£ atoms
β β β β£ Button
β β β β β logout-button.tsx
β β β β£ Form
β β β β β£ DateSelect.tsx
β β β β β£ ImageUpload.tsx
β β β β β£ MultipleSelect.tsx
β β β β β£ Select.tsx
β β β β β£ Switch.tsx
β β β β β TextField.tsx
β β β β£ ImageGallery
β β β β β index.tsx
β β β β£ Loading
β β β β β£ LoadingSkeleton.tsx
β β β β β LoadingSuspense.tsx
β β β β£ RetainAspectImage
β β β β β index.tsx
β β β β index.ts
β β β£ organisms
β β β β£ Form
β β β β β£ Achievement.tsx
β β β β β£ AchievementCategory.tsx
β β β β β£ Event.tsx
β β β β β£ EventCategory.tsx
β β β β β£ Member.tsx
β β β β β£ Product.tsx
β β β β β£ Program.tsx
β β β β β£ Project.tsx
β β β β β£ SIG.tsx
β β β β β£ Tag.tsx
β β β β β types.ts
β β β β£ RowDetails
β β β β β£ client
β β β β β β index.tsx
β β β β β partnership
β β β β β β index.tsx
β β β β£ TableDataAction
β β β β β index.tsx
β β β β index.ts
β β β£ templates
β β β β index.ts
β β β£ ui
β β£ config
β β β index.ts
β β£ constant
β β β£ general.ts
β β β£ image.ts
β β β£ navlinks.ts
β β β tables.ts
β β£ features
β β β£ cms
β β β β£ achievement
β β β β β£ api.ts
β β β β β type.ts
β β β β£ client
β β β β β api.ts
β β β β£ event
β β β β β£ api.ts
β β β β β type.ts
β β β β£ member
β β β β β£ api.ts
β β β β β type.ts
β β β β£ partnership
β β β β β api.ts
β β β β£ product
β β β β β£ api.ts
β β β β β type.ts
β β β β£ program
β β β β β£ api.ts
β β β β β type.ts
β β β β£ project
β β β β β£ api.ts
β β β β β type.ts
β β β β£ sig
β β β β β api.ts
β β β β£ tag
β β β β β api.ts
β β β β£ api.ts
β β β β type.ts
β β β£ s3
β β β β£ api.ts
β β β β type.ts
β β β types.ts
β β£ hooks
β β β£ useCounter.ts
β β β£ useCreateTableData.ts
β β β£ useDeleteTableData.ts
β β β useUpdateTableData.ts
β β£ lib
β β£ providers
β β β£ index.ts
β β β£ redux-provider.tsx
β β β session-provider.tsx
β β£ schema
β β β£ achivement
β β β£ auth
β β β£ client
β β β£ event
β β β£ member
β β β£ partnership
β β β£ product
β β β£ program
β β β£ project
β β β£ sig
β β β index.ts
β β types
β£ .env.example
β£ .eslintignore
β£ .eslintrc.json
β£ .gitignore
β£ .prettierignore
β£ .prettierrc.json
β£ components.json
β£ favicon.ico
β£ next.config.mjs
β£ package-lock.json
β£ package.json
β£ postcss.config.js
β£ README.md
β£ tailwind.config.ts
β tsconfig.json
Key Componentsβ
main.go β Application Bootstrap
- Reads config from .env via Viper
- Creates pgxpool connection to PostgreSQL
- Wires all handlers, services, repositories, and middlewares
- Registers HTTP routes via utils.HandleRoute
- Starts WebSocket broadcaster at /ws
- Exposes webhook endpoint at /wh for GPS ingestion
app/bus/container.go β Runtime State Manager
- Holds in-memory maps: busCoordinates, previousHalte, activeLaps, storedBuses, currentPlates
ApplyExternalCoordinates() β the main pipeline called by webhook: updates colours, detects lanes, tracks halte visits, detects lap start/end
- DQ_SIZE = 50: rolling deque per bus for lane detection sampling
InitRuntimeState() β hydrates runtime caches from DB on startup
app/bus/halte.go β Geofence Proximity
- 22 named haltes (bus stops) with fixed coordinates
- nearestHalte(lat, lng) returns the closest halte name + distance in metres
Threshold: 45 metres β bus must be within 45m to register a halte visit
app/bus/route.go β Route Definitions
- 4 route arrays: blueNormal, blueMorning, redNormal, redMorning
- Pre-built halte-pair sets for O(1) lookup
- detectRouteColorFromPair() returns blue / red / grey
app/auth/ β Authentication
- SSO Login: validates CAS ticket with sso.ui.ac.id, auto-creates user in DB on first login
- JWT pair (access + refresh) signed with HS256; expiry is configurable via env vars
- Admin protection: API_KEY header is checked against ADMIN_API_KEY env var
βοΈ Operational Playbook
Infrastructureβ
- Cloud Provider: AWS ECR + Pusilkom instance
- Container Registry: 638207107223.dkr.ecr.ap-southeast-1.amazonaws.com
- Image Name: bikun-tracker-v2-backend
- Production Tag: stable (deployed from main branch)
- Staging Tag: latest (deployed from staging branch)
- Region: ap-southeast-1 (Singapore)
Environment Variablesβ
| Key | Description | Default (Dev) | Sensitive? |
|---|---|---|---|
| DAMRI_API | Damri GPS API base URL | https://api-damri.istsolutions.co.id | No |
| DAMRI_LOGIN_USERNAME | Damri API username | β | Yes |
| DAMRI_LOGIN_PASSWORD | Damri API password | β | Yes |
| WS_URL | External GPS WebSocket URL | ws://localhost:8000/status | No |
| RM_API | RM lane-detection service URL | https://eta-bikun-tracker-production.up.railway.app | No |
| PRINT_CSV_LOGS | Enable CSV log POST to port 4040 | FALSE | No |
| PORT | Port the server listens on | 8080 | No |
| DB_HOST | PostgreSQL host address | localhost | No |
| DB_NAME | Database name | bikun_tracker | No |
| DB_USER | Database username | postgres | No |
| DB_PASSWORD | Database password | β | Yes |
| DB_PORT | Database port | 5043 | No |
| WS_UPGRADE_WHITELIST | Allowed WebSocket origins (comma-separated) | localhost:5173 | No |
| JWT_EXPIRY_IN_DAYS | Access token validity in days | 1 | No |
| JWT_REFRESH_EXPIRY_IN_DAYS | Refresh token validity in days | 30 | No |
| JWT_SECRET_KEY | HMAC secret for JWT signing | β | Yes |
| ADMIN_API_KEY | API key for admin-protected endpoints | β | Yes |
πQuestions
π List of frequently asked questions or question that need to be answered that is related to this initiative ..