Skip to content

Seizuree/cctv-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCTV Packing Monitoring System

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.

Architecture

┌─────────┐      ┌─────────────────┐      ┌────────────┐
│   Web   │ ───▶ │  API (Hono.js)  │ ───▶ │ PostgreSQL │
└─────────┘      └─────────────────┘      └────────────┘
                                                 ▲
                                                 │
                 ┌─────────────────┐             │
                 │ Worker (Python) │ ────────────┘
                 └─────────────────┘
                         │
           ┌─────────────┼─────────────┐
           ▼             ▼             ▼
      [Hikvision]    [FFmpeg]       [GCS]

Tech Stack

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)

Project Structure

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

Prerequisites

Quick Start

1. Clone & Setup Environment

# 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 configuration

2. Start Database

docker-compose up -d db

3. Setup API

cd api
bun install
bun run migrate
bun run seed
bun run dev

4. Setup Worker

cd worker
uv sync
uv run python main.py

5. Setup Web

cd web
pnpm install
pnpm dev

Development Commands

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

Workflow

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)

Security

  • 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)

Environment Variables

API (.env)

DATABASE_URL=postgresql://user:pass@localhost:5432/cctv
JWT_SECRET=your-secret-key
JWT_EXPIRES_IN=15m
ENCRYPTION_KEY=32-byte-hex-key

Worker (.env)

DATABASE_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-key

Web (.env)

VITE_API_URL=http://localhost:8000

License

Private - All rights reserved

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors