A modern digital twin management system for Apple products and services. This project uses a high-performance Qwik frontend and a robust FastAPI backend with MongoDB.
The easiest way to develop this project is using the automated workflows or manual local setup.
If you are using an AI agent (like Antigravity), you can trigger pre-defined workflows located in:
/.agent/workflows/
/dev-local: Starts the entire stack (DB, API, Frontend) with hot-reload enabled./lint: Runs project-wide linting and formatting (Ruff for Backend, ESLint/Prettier for Frontend).
To start the environment with hot-reload enabled for both frontend and backend:
Terminal 1 (Database):
docker-compose up -d mongodbTerminal 2 (Backend):
cd server
pip install -r requirements.txt
uvicorn main:app --reloadTerminal 3 (Frontend):
cd client
npm install
npm run devTo stop all running services and clean up:
- Press
Ctrl+Cin the Backend and Frontend terminals. - Run the following to stop the database:
docker-compose down- Frontend Dashboard: http://localhost:5173
- API Documentation (Swagger): http://localhost:8000/docs
- Backend Health Check: http://localhost:8000/api/v1/twins
- Framework: Qwik City
- Real-time: Socket.IO Client
- Styling: Apple Design System (Glassmorphism)
- Framework: FastAPI
- Real-time: Python-SocketIO
- Message Broker: RabbitMQ
- Database: MongoDB (via Motor)
graph TD
UI[Qwik Frontend] <--> |WebSocket| SIO[Socket.IO Server]
UI --> |REST API| API[FastAPI Backend]
API --> |Command| RMQ[RabbitMQ]
RMQ --> |Action| SIM[Device Simulator]
SIM --> |Telemetry| RMQ
RMQ --> |Update| CON[Telemetry Consumer]
SCH[Analytics Scheduler] --> |Job| RMQ
RMQ --> |Job| WRK[Analytics Worker]
CON --> |Broadcast| SIO
CON --> |Persist| DB[(MongoDB)]
WRK --> |Results| DB
API <--> |CRUD| DB
PokeCake/
├── .agent/workflows/ # Automated dev scripts
├── client/ # Qwik Frontend
├── server/ # FastAPI Backend
│ ├── simulation/ # Hardware simulator logic
│ ├── services/ # RabbitMQ & Persistent Connections
│ ├── routes/ # API Endpoints
│ └── models/ # Pydantic Schemas
└── docker-compose.yml # Infrastructure Orchestration
- Event-Driven Telemetry: Live stream of CPU, Temperature, and Battery metrics, triggered only during active hardware windows.
- Hardware Command & Control: Bi-directional communication via RabbitMQ for diagnostics and updates.
- Active Registry Simulation: Highly efficient "Active Registry" pattern that only simulates hardware for devices with recent activity (Diagnostics/Updates).
- Multi-Sale Architecture: Support for recording multiple sale records across different regions and segments for a single twin.
- Predictive Analytics: Integrated ML models (Linear Regression) for temperature forecasting and anomaly detection.
- Premium Aesthetics: Glassmorphic UI inspired by macOS with real-time fleet-wide sales aggregation.
- Hot Reloading: Integrated developer experience for all components including RabbitMQ and MongoDB.