UTT Report Maintenance adalah sistem dokumentasi infrastruktur kritikal profesional yang dirancang khusus untuk memfasilitasi pelaporan pemeliharaan data center bagi PT United Transworld Trading (UTT).
π Live Production: https://report-utt.web.app/
- Architecture
- Tech Stack
- Features
- Project Structure
- API Reference
- Security
- Getting Started
- Deployment
- License
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React + Vite) β
β β
β βββββββββββ ββββββββββββ ββββββββββββββ ββββββββββββββ β
β β Login β β MainApp β β AdminDash β β SiteMgr β β
β β Page β β Page β β board β β Dashboard β β
β ββββββ¬βββββ ββββββ¬ββββββ βββββββ¬βββββββ βββββββ¬βββββββ β
β βββββββββββ¬βββ΄βββββββββββββββ΄βββββββββββββββββ β
β β Firebase Auth Token (Bearer) β
βββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββ€
β βΌ β
β ββββββββββββββββ β
β β Firebase Edge β Cloud Functions / Hosting β
β ββββββββ¬ββββββββ β
β β β
β βββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ β
β β Go Backend (api/index.go) β β
β β β β
β β ββββββββββββ ββββββββββββ βββββββββββββββββββββ β β
β β βMiddleware β β Routes β β Controllers β β β
β β β Chain ββββ Dispatch ββββ β β β
β β β β β β β Report / User / β β β
β β ββ’ CORS β ββ’ Health β β Archive / Audit β β β
β β ββ’ Auth β ββ’ Auth β β Maintenance / β β β
β β ββ’ RateLimitβ ββ’ API β β Findings / HSE β β β
β β ββ’ Securityβ β β β β β β
β β ββ’ Logger β β β β β β β
β β ββββββββββββ ββββββββββββ ββββββββββ¬βββββββββββ β β
β β β β β
β β ββββββββββΌβββββββββββ β β
β β β Services Layer β β β
β β ββββββββββ¬βββββββββββ β β
β β ββββββββββΌβββββββββββ β β
β β β Repositories β β β
β β ββββββββββ¬βββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββ β
β β β
ββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββ€
β βΌ β
β ββββββββββββββββββββββββββββ β
β β Firebase / Firestore β β
β β β β
β β β’ Authentication β β
β β β’ Firestore Database β β
β β β’ Security Rules β β
β β β’ Cloud Storage β β
β ββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Technology | Purpose |
|---|---|
| React 18 + TypeScript | Antarmuka reaktif dengan type-safety |
| Vite 6 | Build tool generasi terbaru |
| Tailwind CSS v4 | Utility-first styling |
| Framer Motion | Micro-animations & transisi premium |
| Radix UI | Komponen aksesibel & berperforma tinggi |
| MUI (Material UI) | Komponen UI tambahan |
| jsPDF + ExcelJS | Export laporan ke PDF & Excel |
| html2canvas | Screenshot & capture komponen |
| Technology | Purpose |
|---|---|
| Go 1.23 (Golang) | High-performance API server |
| NVIDIA NIM API | Enterprise LLM Gateway & model orchestration |
| Firebase Admin SDK | Server-side auth & Firestore access |
| Firebase Functions | Deployment & serverless backend |
| Technology | Purpose |
|---|---|
| Firebase Authentication | User auth & session management |
| Cloud Firestore | NoSQL real-time database |
| Firebase Security Rules | Database-level access control |
| Firebase Hosting | CI/CD, SSL, & hosting |
| Firebase App Check | Request verification & anti-abuse |
| PWA Cache Strategy | Network-First strategy for reliable API data |
Sistem asisten AI interaktif tingkat korporat yang terintegrasi penuh untuk membantu teknisi data center:
- Interactive DC Chatbot β Floating widget chat (
AIChatWidget.tsx) dengan dukungan render markdown penuh, suggestion chip kontekstual, riwayat percakapan, dan fitur upload gambar. - Multimodal Visual Analyzer β Analisis visual cerdas panel listrik, grounding, dan thermal hotspot menggunakan model
models/gemini-3.1-flash-lite. - Telemetry Validator & Consolidator β Pengenalan otomatis parameter teknis dan pembuatan remarks (dalam Bahasa Indonesia) menggunakan model penalaran tingkat tinggi
models/gemini-3.1-flash-lite. - Dynamic Load Balancing β Algoritma round-robin key pool kustom pada backend Go (
ai_service.go) untuk mengatasi pembatasan rate limit API Google Gemini.
Sistem pengambilan foto dokumentasi pintar yang menyematkan metadata teknis secara presisi:
- Real-time GPS Integration β Koordinat Latitude/Longitude otomatis
- Dynamic Address Lookup β Reverse geocoding koordinat β alamat fisik
- "Burn-on-Apply" Technology β Sinkronisasi preview & hasil akhir foto
- Professional Branding β Watermark NEUTRADC dengan gradien khusus
- Multi-Template Support β VRV, AHHU, LV ATS Trafo, dan template custom
- Fluid Photo Upload β Dokumentasi intuitif dengan preview instan
- Professional Export β Excel (.xlsx) dan PDF (A4) siap cetak
- Auto-pagination β 9 foto per halaman untuk laporan PDF
- Draft System β Simpan draft laporan yang belum selesai
Sistem manajemen izin kerja terintegrasi untuk kontrol operasional yang aman:
- Strict Validation β Kewajiban upload file PTW yang sudah ditandatangani oleh TDE.
- Week 5 Dynamic Intervals β Pembagian per 7 hari untuk Minggu 1-4 (Tanggal 1-7, 8-14, 15-21, 22-28) dan pembuatan otomatis Minggu 5 (Hari 29 hingga melintasi batas awal bulan berikutnya) agar semua data tercatat utuh.
- Professional PDF & Excel Report β Layout PDF yang dioptimalkan (tanpa potongan teks legend / tumpang tindih lane garis chart) serta export Excel dinamis.
- Smart Sorting β Pengurutan otomatis berdasarkan nomor urut (Sequence Number) untuk kemudahan pelacakan.
- Large Data Handling β Optimalisasi untuk menangani ratusan data PTW dengan performa tinggi.
- Secure Attachments β Sistem penyimpanan lampiran file (PDF/Image) berbasis Firebase Storage dengan integrasi Firestore.
- Smooth Navigation & UI β Fitur Quick Scroll (Top & Bottom) untuk navigasi cepat pada daftar data yang panjang serta sticky headers
opaqueagar teks tidak menumpuk saat di-scroll. - Data Integrity β Proteksi penghapusan data dengan sistem konfirmasi ganda dan auto-closed untuk izin yang melebihi masa berlaku.
Modul khusus untuk mendokumentasikan perbaikan dan pemeliharaan korektif dengan workflow terstruktur.
Modul pelaporan K3 terintegrasi dengan photo editor dan export PDF profesional.
- Dual-Module Architecture β Input Temuan (data entry) & Arsip Temuan (history)
- Advanced Filter β Pencarian berdasarkan bulan & tahun
- Multi-Format Export β PDF dan Microsoft Word (.docx)
- Interactive Photo Gallery β Cropping & editing deskripsi foto
- Quarterly Progress Tracking β Q1, Q2, Q3, Q4
- Maintenance Progress Monitoring β Real-time status update
- End-of-Day Reports β Summary harian otomatis
- Role-Based Access Control (RBAC) β 16+ role types
- Admin Dashboard β User management, audit logs, analytics
- Notification Center β Real-time notifications
- Equipment Borrowing β Request & approval workflow
- Status Tracking β Borrowing status list dengan approval chain
utt-report-maintenance/
βββ api/ # Cloud API entry point
β βββ index.go # Main serverless handler (Go runtime)
β
βββ backend/
β βββ cmd/api/ # Local development server entry
β βββ core/
β β βββ config/ # Firebase, security, app config
β β βββ controllers/ # HTTP handlers (Report, User, Auth, etc.)
β β βββ middlewares/ # Auth, CORS, rate limiter, security headers
β β βββ models/ # Data models & DTOs
β β βββ repositories/ # Firestore data access layer
β β βββ routes/ # API routing & middleware chain
β β βββ services/ # Business logic layer
β βββ pkg/
β βββ helpers/ # Response helpers, validators, IP utils
β βββ logger/ # Structured logging
β βββ sanitizer/ # Input sanitization (XSS/injection prevention)
β
βββ frontend/
β βββ api/ # Firebase client config
β βββ assets/ # Images, logos, templates
β βββ components/ # React components
β β βββ AuthContext.tsx # Authentication provider
β β βββ ReportForm.tsx # Main report form
β β βββ HSEReportForm.tsx # HSE report module
β β βββ PTWManagement.tsx # PTW Management module (New)
β β βββ CorrectiveMaintenance.tsx # Corrective maintenance module
β β βββ CameraModal.tsx # Smart camera with watermarking
β β βββ FindingManagement.tsx # Findings input
β β βββ FindingArchive.tsx # Findings archive & export
β β βββ DocumentList.tsx # Report listing & management
β β βββ ui/ # Reusable UI primitives
β βββ config/ # Report templates configuration
β βββ hooks/ # Custom React hooks
β βββ pages/ # Page-level components
β β βββ Login.tsx # Authentication page
β β βββ MainApp.tsx # Engineer dashboard
β β βββ AdminDashboard.tsx # Admin control panel
β β βββ SiteManagerDashboard.tsx # Site manager dashboard
β β βββ HSEApp.tsx # HSE module page
β β βββ InventoryApp.tsx # Inventory management
β β βββ DivisionApp.tsx # Division-specific views
β βββ themes/ # UI theme configuration
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utilities (PDF export, image compression, etc.)
β
βββ firebase/
β βββ firestore.rules # Firestore security rules
β βββ firestore.indexes.json # Firestore composite indexes
β
βββ firebase.json # Firebase hosting & CSP configuration
βββ vercel.json # Vercel deployment & CORS configuration
βββ vite.config.ts # Vite build configuration
βββ docker-compose.yml # Docker setup (optional)
βββ package.json # Dependencies & scripts
Base URL: https://report-utt.web.app/api
All API endpoints (except health checks) require authentication via one of:
- Firebase Auth Token:
Authorization: Bearer <firebase_id_token>(Strict Enforcement)
| Method | Endpoint | Description | Auth |
|---|---|---|---|
GET |
/api/health |
Liveness check | β |
GET |
/api/ready |
Readiness check | β |
GET |
/api/metrics |
System metrics | β |
| Method | Endpoint | Description | Throttle |
|---|---|---|---|
POST |
/api/auth/login |
User login | Global |
POST |
/api/auth/logout |
User logout | Global |
GET |
/api/auth/me |
Get current user | Global |
| Method | Endpoint | Description | Throttle |
|---|---|---|---|
POST |
/api/report |
Create report with photos | π΄ Heavy (5 rps) |
GET |
/api/reports |
List all reports | π’ Standard (20 rps) |
GET |
/api/report/:id |
Get single report | π’ Standard |
DELETE |
/api/report/:id |
Delete report | π΄ Heavy |
| Method | Endpoint | Description | Throttle |
|---|---|---|---|
GET |
/api/users |
List all users | π’ Standard |
GET |
/api/users/:id |
Get user profile | π’ Standard |
PATCH |
/api/users/:id/role |
Update user role | π΄ Heavy |
DELETE |
/api/users/:id |
Deactivate user | π΄ Heavy |
| Method | Endpoint | Description | Throttle |
|---|---|---|---|
GET |
/api/archive |
List archives | π’ Standard |
GET |
/api/archive/:id |
Get archive detail | π’ Standard |
DELETE |
/api/archive/:id |
Permanent delete | π΄ Heavy |
| Method | Endpoint | Description | Throttle |
|---|---|---|---|
GET |
/api/audit |
All audit logs | π’ Standard |
GET |
/api/audit/me |
My audit logs | π’ Standard |
| Method | Endpoint | Description | Throttle |
|---|---|---|---|
GET |
/api/maintenance-progress |
List all progress | π’ Standard |
POST |
/api/maintenance-progress |
Create progress entry | π΄ Heavy |
GET |
/api/maintenance-progress/summary |
Get summary | π’ Standard |
POST |
/api/maintenance-progress/end-day |
End-of-day report | π΄ Heavy |
PATCH |
/api/maintenance-progress/:id |
Update progress | π΄ Heavy |
DELETE |
/api/maintenance-progress/:id |
Delete progress | π΄ Heavy |
| Method | Endpoint | Description | Throttle |
|---|---|---|---|
POST |
/api/findings |
Create finding | π΄ Heavy |
GET |
/api/findings |
List findings | π’ Standard |
DELETE |
/api/findings/:id |
Delete finding | π΄ Heavy |
| Tier | Limit | Burst | Applied To |
|---|---|---|---|
| π Global | 20 rps | 40 | All requests |
| π’ Standard | 20 rps | 40 | GET (read operations) |
| π΄ Heavy | 5 rps | 10 | POST/DELETE/PATCH (write operations) |
- Strict Authentication β Mandatory Firebase ID Token validation for all sensitive operations.
- Role-Based Access Control (RBAC) β 16+ roles with granular Firestore & Storage security rules.
- Infrastructure Hardening β Deprecated legacy
X-API-Secretbypass to prevent unauthorized API access. - Anti-Enumeration β Transitioned to high-entropy UUIDs for critical maintenance records.
- Resource Protection β Semaphore-based Worker Pools (Concurrent Limit: 5) to prevent function timeouts and database exhaustion.
- Scoped Data Deletion β Pengamanan proses penghapusan data massal (Batch Operations) untuk menjaga integritas database.
| Header | Value |
|---|---|
X-Frame-Options |
DENY |
X-Content-Type-Options |
nosniff |
X-XSS-Protection |
1; mode=block |
Referrer-Policy |
strict-origin-when-cross-origin |
Strict-Transport-Security |
max-age=31536000; includeSubDomains; preload |
Content-Security-Policy |
Strict whitelist (No unsafe-inline / unsafe-eval) |
Permissions-Policy |
Camera, microphone, geolocation restricted |
Cache-Control |
PWA-optimized NetworkFirst for /api |
- Input Sanitization β DOMPurify-based sanitizer for XSS/injection prevention
- CORS Whitelisting β Only
report-utt.web.appallowed - Firestore Security Rules β Document-level access control with field validation
- Default Role Enforcement β New users forced to
engineerrole (prevents privilege escalation) - No Client-Side Secrets β API secrets never exposed in frontend bundles
- Error Masking β Internal errors never leaked to clients
- Git History Cleaned β Sensitive files purged from all commits via
git-filter-repo - Environment Isolation β Separate secrets for Production, Preview, and Development
- Credential Rotation β Service account keys and API secrets regularly rotated
- Request ID Tracking β Every request tagged with unique ID for audit trail
Request β RequestID β Logger β PanicRecovery β SecurityHeaders β CORS β RateLimiter β Auth β Route
- Node.js v18+
- Go v1.23+
- Firebase CLI (
npm install -g firebase-tools) - npm or pnpm
# Clone repository
git clone https://github.com/gariiriana/utt-report-maintenance.git
cd utt-report-maintenance
# Install frontend dependencies
npm install
# Build backend binary
npm run backend:buildCreate .env.development in the project root:
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.firebasestorage.app
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_FIREBASE_MEASUREMENT_ID=your_measurement_id
VITE_RECAPTCHA_SITE_KEY=your_recaptcha_site_key
VITE_API_URL=http://localhost:8080/apiCreate .env for backend:
BACKEND_API_SECRET=your_secret_here
FIREBASE_SERVICE_ACCOUNT={"type":"service_account",...}
# AI Model Configuration (Google Gemini API - using backward compatible env names)
NVIDIA_NIM_API_KEYS=your_gemini_api_key_1,your_gemini_api_key_2
NVIDIA_NIM_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
NVIDIA_NIM_VISION_MODEL=models/gemini-3.1-flash-lite
NVIDIA_NIM_REASONING_MODEL=models/gemini-3.1-flash-lite
NVIDIA_NIM_CHAT_MODEL=models/gemini-3.1-flash-lite# Start both frontend (Vite) and backend (Go) concurrently
npm run devThis runs:
- Frontend: Vite dev server at
http://localhost:5173 - Backend: Go API server at
http://localhost:8080
# Frontend build
npm run build:prod
# Backend build
npm run backend:buildThe project is deployed on Firebase with the following setup:
- Frontend β Static build served via Firebase Hosting
- Backend β Go serverless functions / Cloud Functions
- SSL & Domain β Managed automatically by Firebase
# Build frontend
npm run build
# Deploy to Firebase
firebase deploy# Deploy security rules
firebase deploy --only firestore:rules
# Deploy hosting (if using Firebase Hosting)
firebase deploy --only hostingdocker-compose up -d| Command | Description |
|---|---|
npm run dev |
Start frontend + backend dev servers |
npm run build |
Build frontend for production |
npm run build:prod |
Build with production env |
npm run build:dev |
Build with development env |
npm run backend |
Run Go backend server |
npm run backend:build |
Compile Go backend to server.exe |
| Role | Access Level | Description |
|---|---|---|
admin |
π΄ Full | Semua akses + user management |
site_manager |
π High | Dashboard + maintenance progress |
manager |
π High | Dashboard + maintenance progress |
engineer |
π’ Standard | Report creation + findings |
standby_engineer |
π’ Standard | Report creation + inventory borrowing |
hse |
π‘ Module | HSE reports only |
tde |
π‘ Module | Division-specific access |
cbre |
π‘ Module | Division-specific access |
pmo |
π‘ Module | Division-specific access |
sales |
π‘ Module | Division-specific access |
presales |
π‘ Module | Division-specific access |
purchasing |
π‘ Module | Division-specific access |
inventory |
π‘ Module | Inventory management |
dirut |
π£ Executive | Read-only executive view |
direksiSDM |
π£ Executive | Read-only executive view |
DireksiKeuangan |
π£ Executive | Read-only executive view |
Sistem ini bersifat privat dan dikembangkan eksklusif untuk kebutuhan operasional PT United Transworld Trading (UTT). Source code dan dokumentasi ini merupakan properti perusahaan yang dilindungi.
*Built with β€οΈ by Gari Iriana