A modern, high-performance specialized system for managing vehicle entries with OCR license plate recognition. Upgraded to a robust microservices architecture using Next.js, FastAPI, and PocketBase, all orchestrated via Docker.
The system utilizes Docker with Profiles to seamlessly switch between Development and Production workflows.
| Component | Technology | Role |
|---|---|---|
| Frontend | Next.js 16 + Chakra UI v3 | Modern UI with Dark Mode. |
| Backend | FastAPI + uv | High-performance Python API. |
| State Management | Zustand + React Query | Advanced sync & state patterns. |
| Database | PocketBase | Real-time Database & Auth. |
| Statistics | Recharts + @chakra-ui/charts | Visual analytics dashboard. |
| Backup | Alpine + Cron | Automated production backups. |
| Environment | Host Port | Database Host | Purpose |
|---|---|---|---|
| Development | 3000 / 8000 / 8090 | localhost |
Local dev with .env.dev |
| Production | 3001 / 8001 / 8091 | pocketbase-prod |
Full Docker with .env.prod |
Run the apps directly on your terminal for the fastest development cycle, but use Docker for the Cloudflare Tunnel.
Step 1: Configure Environment
# Set development variables
copy .env.dev .envStep 2: Start Backend (Terminal)
cd backend
uv sync
uv run main.py # Runs on port 8000Step 3: Start Frontend (Terminal)
cd frontend
npm install
npm run dev # Runs on port 3000Run the entire stack in isolated containers.
✅ Pre-Deployment Checklist
- Frontend Lint:
cd frontend && npm run lint(Must pass) - Frontend Build:
cd frontend && npm run build(Ensures zero compilation errors) - Backend Sync:
cd backend && uv sync(Ensures dependencies are locked) - Env Config: Production variables are automatically loaded from
.env.prodvia Docker Compose profiles.
Deployment Commands
# Stop dev containers/tunnels
docker compose down --remove-orphans
# Start Production Stack (Uses .env.prod automatically)
docker compose --profile prod up -d --buildAccess App at http://localhost:3001 (or your production domain) (Auto-backups run every 2 hours)
To stop only the production containers while keeping your Development environment running:
docker compose --profile prod down- Why this is safe: Because we use Docker Profiles,
down --profile prodwill only target production services. Yourpocketbase-devcontainer and youruv run/npm devprocesses will remain completely untouched. - Data Safety: Your production data is stored in the
pb_datavolume and is NOT deleted by thedowncommand.
- Statistics Dashboard: Real-time visual tracking of volume distribution, vehicle counts, and entry patterns.
- Advanced State Management: Sub-second UI reactivity using Zustand and server-state synchronization with TanStack Query.
- Unified UI: Perfectly consistent design system built on Chakra UI v3 with full Dark Mode support.
backend/: FastAPI application (Python).frontend/: Next.js application (React).docs/:technical/: Architecture & Docker guides.planning/: Future roadmap.archive/: Phase 1 docs.USER_GUIDE.md: User manual.
docker-compose.yml: Main orchestration file..env: Global configuration (Ports, Credentials).
- Development: Copy
.env.devto.envfor local terminal runs. - Production: Docker Compose automatically uses
.env.prodviaenv_filedirectives indocker-compose.yml. - Secrets: Both
.env.devand.env.prodshould be kept secure. Individual local overrides can be made in a root.env(git-ignored).
The project uses APP_VERSION in your .env files to tag Docker images.
- To increment: Change
APP_VERSION=1.0.0toAPP_VERSION=1.0.1in.env.prod. - To build: Run
docker compose --profile prod up -d --build. - To rollback: Simply change the version back in
.env.prodand run the command again. Docker will use the previously built image for that version instantly.
Created with ❤️ for Advanced Vehicle Management.