# motioneye-project/motioneye architecture

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

- Interactive diagram: https://gitdiagram.com/motioneye-project/motioneye
- Repository: https://github.com/motioneye-project/motioneye

## Overview

motionEye is a web interface for configuring and operating motion-based video surveillance. A browser request enters the Tornado server, is dispatched to a handler, and can return the live interface or camera media; configuration and camera-control operations are distinct from media browsing and playback. The repository also includes peripheral capabilities for remote cameras, uploads, notifications, and system controls. The graph follows documented routes and sampled call sites; unsampled subsystem wiring is omitted where it cannot be established.

Main entry points: [`motioneye/server.py`](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/server.py) (HTTP server), [`motioneye/config.py`](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/config.py) (Camera configuration), [`motioneye/handlers/main.py`](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/main.py) (Main page), [`motioneye/handlers/picture.py`](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/picture.py) (Picture and movie API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_server["HTTP server<br/>[server.py]"]
  node_main_handler["Main page<br/>[main.py]"]
  node_config_handler["Configuration API<br/>[config.py]"]
  node_action_handler["Camera actions<br/>[action.py]"]
  node_frontend["Web UI<br/>[main.js]"]
end

subgraph group_camera["Camera runtime"]
  node_config["Camera configuration<br/>[config.py]"]
  node_motionctl["Motion process control<br/>[motionctl.py]"]
  node_mjpgclient["MJPEG client<br/>[mjpgclient.py]"]
end

subgraph group_media["Media management"]
  node_picture_handler["Picture and movie API<br/>[picture.py]"]
  node_movie_handler["Movie API<br/>[movie.py]"]
  node_playback_handler["Movie playback<br/>[movie_playback.py]"]
  node_mediafiles["Media files<br/>[mediafiles.py]"]
end

subgraph group_integrations["Integrations and controls"]
  node_remote["Remote cameras<br/>[remote.py]"]
  node_uploads["Upload services<br/>[uploadservices.py]"]
  node_notifications["Notifications<br/>[sendmail.py]"]
  node_telegram["Telegram notifications<br/>[sendtelegram.py]"]
  node_controls["Device controls"]
  node_webhook["Webhook caller<br/>[webhook.py]"]
end

node_browser(("Browser user"))
node_camera_feed(("Camera streams"))

node_browser -->|"HTTP requests"| node_server
node_server -->|"dispatches page"| node_main_handler
node_server -->|"dispatches config"| node_config_handler
node_server -->|"dispatches actions"| node_action_handler
node_server -->|"dispatches media"| node_picture_handler
node_server -->|"dispatches movies"| node_movie_handler
node_server -->|"dispatches playback"| node_playback_handler
node_main_handler -->|"renders interface"| node_frontend
node_main_handler -->|"reads structure"| node_config
node_main_handler -->|"queries motion"| node_motionctl
node_config_handler -->|"handles configuration"| node_config
node_action_handler -->|"reads camera settings"| node_config
node_action_handler -->|"controls motion"| node_motionctl
node_picture_handler -->|"checks cameras"| node_config
node_picture_handler -->|"reads or deletes media"| node_mediafiles
node_picture_handler -->|"requests remote media"| node_remote
node_frontend -->|"requests media"| node_server
node_server -->|"starts motion"| node_motionctl
node_server -->|"starts collector"| node_mjpgclient
node_mjpgclient -->|"reads streams"| node_camera_feed
node_controls -.->|"supports device settings"| node_config

click node_server "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/server.py"
click node_main_handler "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/main.py"
click node_config_handler "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/config.py"
click node_action_handler "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/action.py"
click node_frontend "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/static/js/main.js"
click node_config "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/config.py"
click node_motionctl "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/motionctl.py"
click node_mjpgclient "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/mjpgclient.py"
click node_picture_handler "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/picture.py"
click node_movie_handler "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/movie.py"
click node_playback_handler "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/movie_playback.py"
click node_mediafiles "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/mediafiles.py"
click node_remote "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/remote.py"
click node_uploads "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/uploadservices.py"
click node_notifications "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/sendmail.py"
click node_telegram "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/sendtelegram.py"
click node_controls "https://github.com/motioneye-project/motioneye/tree/dev/motioneye/controls"
click node_webhook "https://github.com/motioneye-project/motioneye/blob/dev/motioneye/webhook.py"

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_server,node_main_handler,node_config_handler,node_action_handler,node_frontend,node_browser toneBlue
class node_config,node_motionctl,node_mjpgclient toneAmber
class node_picture_handler,node_movie_handler,node_playback_handler,node_mediafiles toneMint
class node_remote,node_uploads,node_notifications,node_telegram,node_controls,node_webhook toneRose
class node_camera_feed toneIndigo
```

## Components

### Web interface

- [HTTP server](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/server.py): `motioneye/server.py`
- [Main page](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/main.py): `motioneye/handlers/main.py`
- [Configuration API](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/config.py): `motioneye/handlers/config.py`
- [Camera actions](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/action.py): `motioneye/handlers/action.py`
- [Web UI](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/static/js/main.js): `motioneye/static/js/main.js`

### Camera runtime

- [Camera configuration](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/config.py): `motioneye/config.py`
- [Motion process control](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/motionctl.py): `motioneye/motionctl.py`
- [MJPEG client](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/mjpgclient.py): `motioneye/mjpgclient.py`

### Media management

- [Picture and movie API](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/picture.py): `motioneye/handlers/picture.py`
- [Movie API](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/movie.py): `motioneye/handlers/movie.py`
- [Movie playback](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/handlers/movie_playback.py): `motioneye/handlers/movie_playback.py`
- [Media files](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/mediafiles.py): `motioneye/mediafiles.py`

### Integrations and controls

- [Remote cameras](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/remote.py): `motioneye/remote.py`
- [Upload services](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/uploadservices.py): `motioneye/uploadservices.py`
- [Notifications](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/sendmail.py): `motioneye/sendmail.py`
- [Telegram notifications](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/sendtelegram.py): `motioneye/sendtelegram.py`
- [Device controls](https://github.com/motioneye-project/motioneye/tree/dev/motioneye/controls): `motioneye/controls`
- [Webhook caller](https://github.com/motioneye-project/motioneye/blob/dev/motioneye/webhook.py): `motioneye/webhook.py`

### Other components

- **Browser user**
- **Camera streams**

## Connections

- Browser user → HTTP server: HTTP requests
- HTTP server → Main page: dispatches page
- HTTP server → Configuration API: dispatches config
- HTTP server → Camera actions: dispatches actions
- HTTP server → Picture and movie API: dispatches media
- HTTP server → Movie API: dispatches movies
- HTTP server → Movie playback: dispatches playback
- Main page → Web UI: renders interface
- Main page → Camera configuration: reads structure
- Main page → Motion process control: queries motion
- Configuration API → Camera configuration: handles configuration
- Camera actions → Camera configuration: reads camera settings
- Camera actions → Motion process control: controls motion
- Picture and movie API → Camera configuration: checks cameras
- Picture and movie API → Media files: reads or deletes media
- Picture and movie API → Remote cameras: requests remote media
- Web UI → HTTP server: requests media
- HTTP server → Motion process control: starts motion
- HTTP server → MJPEG client: starts collector
- MJPEG client → Camera streams: reads streams
- Device controls → Camera configuration: supports device settings
