# aliberkarad/rc-remote architecture

> Architecture diagram of the GitHub repository aliberkarad/rc-remote, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aliberkarad/rc-remote
- Repository: https://github.com/aliberkarad/rc-remote

## Overview

RC Cloud is a browser-operated remote-control car platform. A user signs in, selects an available vehicle and rents driving time; the realtime server authorizes the session and relays driving commands to the Raspberry Pi, which drives motors and reports battery telemetry. Django handles accounts, credits, rentals and vehicle status; Redis carries session and live vehicle state. Go2RTC provides the video path from the car camera to the VPS. The README documents the wider deployment; edges reflect only relationships visible in excerpts or explicitly described there.

Main entry points: [`realtime/server.js`](https://github.com/aliberkarad/rc-remote/blob/main/realtime/server.js) (Socket.IO server), [`RPi/main.py`](https://github.com/aliberkarad/rc-remote/blob/main/RPi/main.py) (Vehicle controller), [`nginx/nginx.conf`](https://github.com/aliberkarad/rc-remote/blob/main/nginx/nginx.conf) (Nginx gateway), [`backend/core/views.py`](https://github.com/aliberkarad/rc-remote/blob/main/backend/core/views.py) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and accounts"]
  node_django["Web application<br/>[views.py]"]
  node_routes["HTTP routes<br/>[urls.py]"]
  node_templates["Web pages"]
  node_domain[("Accounts and rentals<br/>[models.py]")]
  node_sqlite[("Django database<br/>[settings.py]")]
end

subgraph group_realtime["Realtime control"]
  node_redis[("Redis state store")]
  node_socket["Socket.IO server<br/>[server.js]"]
end

subgraph group_vehicle["Vehicle hardware"]
  node_pi["Vehicle controller<br/>[main.py]"]
  node_motors["Motor driver<br/>[main.py]"]
  node_battery["Battery telemetry<br/>[main.py]"]
end

subgraph group_video["Video streaming"]
  node_camera["Camera stream<br/>[go2rtc.yaml]"]
  node_vehicle_video["Vehicle Go2RTC<br/>[go2rtc.yaml]"]
  node_server_video["VPS Go2RTC<br/>[go2rtc_server.yaml]"]
  node_browser_video["Browser video delivery<br/>[go2rtc_server.yaml]"]
end

node_operator(("Remote operator"))
node_gateway["Nginx gateway<br/>[nginx.conf]"]

node_operator -->|"opens platform"| node_gateway
node_gateway -->|"proxies HTTP"| node_django
node_routes -->|"dispatches requests"| node_django
node_django -->|"reads and updates"| node_domain
node_django -->|"reads and writes state"| node_redis
node_socket -->|"checks sessions; saves stats"| node_redis
node_pi -->|"registers and sends telemetry"| node_socket
node_socket -->|"relays control signals"| node_pi
node_pi -->|"applies drive commands"| node_motors
node_pi -->|"samples and estimates"| node_battery
node_battery -->|"sends telemetry"| node_socket
node_operator -->|"drives via realtime"| node_socket
node_camera -->|"produces stream"| node_vehicle_video
node_vehicle_video -->|"publishes RTSP feed"| node_server_video
node_server_video -->|"serves video"| node_browser_video
node_gateway -->|"proxies realtime"| node_socket
node_gateway -->|"proxies video API"| node_server_video

click node_django "https://github.com/aliberkarad/rc-remote/blob/main/backend/core/views.py"
click node_routes "https://github.com/aliberkarad/rc-remote/blob/main/backend/config/urls.py"
click node_templates "https://github.com/aliberkarad/rc-remote/tree/main/backend/core/templates"
click node_domain "https://github.com/aliberkarad/rc-remote/blob/main/backend/core/models.py"
click node_sqlite "https://github.com/aliberkarad/rc-remote/blob/main/backend/config/settings.py"
click node_socket "https://github.com/aliberkarad/rc-remote/blob/main/realtime/server.js"
click node_pi "https://github.com/aliberkarad/rc-remote/blob/main/RPi/main.py"
click node_motors "https://github.com/aliberkarad/rc-remote/blob/main/RPi/main.py"
click node_battery "https://github.com/aliberkarad/rc-remote/blob/main/RPi/main.py"
click node_camera "https://github.com/aliberkarad/rc-remote/blob/main/RPi/go2rtc.yaml"
click node_vehicle_video "https://github.com/aliberkarad/rc-remote/blob/main/RPi/go2rtc.yaml"
click node_server_video "https://github.com/aliberkarad/rc-remote/blob/main/go2rtc_server.yaml"
click node_gateway "https://github.com/aliberkarad/rc-remote/blob/main/nginx/nginx.conf"
click node_browser_video "https://github.com/aliberkarad/rc-remote/blob/main/go2rtc_server.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_django,node_routes,node_templates,node_domain,node_sqlite toneBlue
class node_redis,node_socket toneAmber
class node_pi,node_motors,node_battery toneMint
class node_camera,node_vehicle_video,node_server_video,node_browser_video toneRose
class node_operator toneIndigo
class node_gateway toneTeal
```

## Components

### Web and accounts

- [Web application](https://github.com/aliberkarad/rc-remote/blob/main/backend/core/views.py): `backend/core/views.py`
- [HTTP routes](https://github.com/aliberkarad/rc-remote/blob/main/backend/config/urls.py): `backend/config/urls.py`
- [Web pages](https://github.com/aliberkarad/rc-remote/tree/main/backend/core/templates): `backend/core/templates`
- [Accounts and rentals](https://github.com/aliberkarad/rc-remote/blob/main/backend/core/models.py): `backend/core/models.py`
- [Django database](https://github.com/aliberkarad/rc-remote/blob/main/backend/config/settings.py): `backend/config/settings.py`

### Realtime control

- **Redis state store**
- [Socket.IO server](https://github.com/aliberkarad/rc-remote/blob/main/realtime/server.js): `realtime/server.js`

### Vehicle hardware

- [Vehicle controller](https://github.com/aliberkarad/rc-remote/blob/main/RPi/main.py): `RPi/main.py`
- [Motor driver](https://github.com/aliberkarad/rc-remote/blob/main/RPi/main.py): `RPi/main.py`
- [Battery telemetry](https://github.com/aliberkarad/rc-remote/blob/main/RPi/main.py): `RPi/main.py`

### Video streaming

- [Camera stream](https://github.com/aliberkarad/rc-remote/blob/main/RPi/go2rtc.yaml): `RPi/go2rtc.yaml`
- [Vehicle Go2RTC](https://github.com/aliberkarad/rc-remote/blob/main/RPi/go2rtc.yaml): `RPi/go2rtc.yaml`
- [VPS Go2RTC](https://github.com/aliberkarad/rc-remote/blob/main/go2rtc_server.yaml): `go2rtc_server.yaml`
- [Browser video delivery](https://github.com/aliberkarad/rc-remote/blob/main/go2rtc_server.yaml): `go2rtc_server.yaml`

### Other components

- **Remote operator**
- [Nginx gateway](https://github.com/aliberkarad/rc-remote/blob/main/nginx/nginx.conf): `nginx/nginx.conf`

## Connections

- Remote operator → Nginx gateway: opens platform (evidence: `README.md`)
- Nginx gateway → Web application: proxies HTTP (evidence: `README.md`)
- HTTP routes → Web application: dispatches requests (evidence: `backend/config/urls.py`)
- Web application → Accounts and rentals: reads and updates (evidence: `backend/core/views.py`)
- Web application → Redis state store: reads and writes state (evidence: `backend/core/views.py`)
- Socket.IO server → Redis state store: checks sessions; saves stats (evidence: `realtime/server.js`)
- Vehicle controller → Socket.IO server: registers and sends telemetry (evidence: `RPi/main.py`)
- Socket.IO server → Vehicle controller: relays control signals (evidence: `realtime/server.js`)
- Vehicle controller → Motor driver: applies drive commands (evidence: `RPi/main.py`)
- Vehicle controller → Battery telemetry: samples and estimates (evidence: `RPi/main.py`)
- Battery telemetry → Socket.IO server: sends telemetry (evidence: `RPi/main.py`)
- Remote operator → Socket.IO server: drives via realtime (evidence: `README.md`)
- Camera stream → Vehicle Go2RTC: produces stream (evidence: `README.md`)
- Vehicle Go2RTC → VPS Go2RTC: publishes RTSP feed (evidence: `README.md`)
- VPS Go2RTC → Browser video delivery: serves video (evidence: `README.md`)
- Nginx gateway → Socket.IO server: proxies realtime (evidence: `README.md`)
- Nginx gateway → VPS Go2RTC: proxies video API (evidence: `README.md`)
