How piotrpdev/oko works
Main System Components
• Frontend:
• Code is located in the “frontend” directory.
• Built using Svelte and Vite with multiple routes/pages (Home, Login, Cameras, NotFound).
• Contains various UI component libraries and styling (Tailwind, Prettier, ESLint).
• Backend:
• Located in the “backend” directory.
• Written in Rust using frameworks like Axum.
• Contains submodules for database interactions (in the “src/db” folder) and web routing (in “src/web”).
• Contains SQL migrations, fixtures, tests, and utilities (e.g., WS utilities and a “camera-impersonator” tool), indicating database operations and real-time communication (possibly via websockets).
• Camera Module:
• Found in the “camera” directory.
• A Rust-based application with ESP32 configurations (e.g., Cargo.toml, build.rs, espflash.toml, and evidence of an “esp-camera-rs” dependency).
• Likely responsible for capturing images/video input locally.
• Landing Page:
• The “landing” folder holds static assets and an index.html serving as a marketing or public-facing page.
• Database:
• While not represented as a dedicated service, the presence of migrations, SQLx queries, and fixtures in the backend shows that a relational database is part of the architecture.
• CI/CD and Build Infrastructure:
• Presence of the “.github/workflows” directory shows automated deployments, testing, and release pipelines.
• Auxiliary Scripts and Tools:
• The “make.sh” script and various testing files are used for development routines like seeding data, running tests, and simulating camera input.
Out Component Interactions
• Frontend ↔ Backend:
• The frontend communicates with the backend via REST API endpoints, authentication routes, and possibly websockets for real-time updates.
• Backend ↔ Database:
• The backend uses SQLx for queries and migrations, interacting with a database to manage users, cameras, videos, permissions, and settings.
• Backend ↔ Camera Module:
• Although the integration details are internal, the backend likely receives camera data (images/videos) from the camera module and may send commands back (or monitor incoming streams).
• CI/CD Pipeline:
• An external flow showing automated testing, building, and deployment, which integrates into all modules of the project.
Important Architectural Patterns and Technologies
• Separation of concerns:
• The project is clearly partitioned into frontend, backend, and camera components.
• Modular and layered design:
• Within the backend, distinct modules handle data layer (db), web routing (“web” folder), and testing.
• Real-time Communication:
• The inclusion of WS (websocket) utility modules indicates a push-based update mechanism likely used for live camera feeds or notifications.
• OpenCV Integration:
• The README mentions OpenCV prerequisites, suggesting that image processing might be a part of the backend functionality.
• Use of modern web technologies like Svelte for a responsive and modular UI.
Final Recommendations
• Be very detailed: Break down each major component and, if necessary, include further internal subdivisions (e.g., showing the “db” and “web” submodules within the backend).