Sistem monitoring CCTV untuk tracking proses packing. Merekam waktu mulai/selesai packing via barcode scan, memotong video dari Hikvision, dan upload ke Google Cloud Storage.
┌─────────┐ ┌─────────────────┐ ┌────────────┐
│ Web │ ───▶ │ API (Hono.js) │ ───▶ │ PostgreSQL │
└─────────┘ └─────────────────┘ └────────────┘
▲
│
┌─────────────────┐ │
│ Worker (Python) │ ────────────┘
└─────────────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
[Hikvision] [FFmpeg] [GCS]
| Component | Stack |
|---|---|
| API | Bun + Hono.js + Drizzle ORM + Zod |
| Worker | Python 3.10+ + SQLAlchemy 2.0 + FastAPI + FFmpeg |
| Web | React 19 + Vite + TanStack Query + shadcn/ui |
| Database | PostgreSQL 15 |
| Storage | Google Cloud Storage (S3-compatible) |
cctv-packing-monitoring/
├── api/ # Backend REST API
├── web/ # Frontend React SPA
├── worker/ # Video processing worker
├── docker/ # Docker volumes
├── database.dbml # Database schema definition
└── docker-compose.yml # Docker orchestration
- Bun >= 1.0
- Node.js >= 18 (untuk pnpm)
- pnpm >= 8
- Python >= 3.10
- uv (Python package manager)
- FFmpeg
- Docker & Docker Compose
- PostgreSQL 15
# Copy environment files
cp api/.env.example api/.env
cp web/.env.example web/.env
cp worker/.env.example worker/.env
# Edit each .env file with your configurationdocker-compose up -d dbcd api
bun install
bun run migrate
bun run seed
bun run devcd worker
uv sync
uv run python main.pycd web
pnpm install
pnpm dev| Command | Description |
|---|---|
cd api && bun run dev |
Start API server (port 8000) |
cd api && bun run migrate |
Run database migrations |
cd api && bun run seed |
Seed initial data |
cd worker && uv run python main.py |
Start worker (port 8001) |
cd web && pnpm dev |
Start web dev server (port 5173) |
docker-compose up -d |
Start all services |
1. [Scan START] → Create packing_item (status: PENDING)
2. [Scan END] → Update packing_item (status: READY_FOR_BATCH)
3. [Worker] → Download video from Hikvision
→ Cut & merge with FFmpeg
→ Upload to GCS
→ Create mini_clip (status: UPLOADED)
- Camera passwords: AES-256-GCM encrypted
- Authentication: JWT + HTTP-only cookie sessions
- Roles: SUPERADMIN (full access), OPERATOR (scan only)
- Video retention: 30 days (GCS Lifecycle)
DATABASE_URL=postgresql://user:pass@localhost:5432/cctv
JWT_SECRET=your-secret-key
JWT_EXPIRES_IN=15m
ENCRYPTION_KEY=32-byte-hex-keyDATABASE_URL=postgresql://user:pass@localhost:5432/cctv
GCS_BUCKET=your-bucket
GCS_ACCESS_KEY=your-access-key
GCS_SECRET_KEY=your-secret-key
ENCRYPTION_KEY=32-byte-hex-keyVITE_API_URL=http://localhost:8000Private - All rights reserved