Skip to content

Architecture

v3.13.13jALPHA

System Overview

m1nd runs as a single Python process with two main subsystems — an asyncio scheduler for synthetic tests and a threaded Flask server for the web UI and API. All data lives in one SQLite file.

Request Flow

Every incoming request follows this path:

Frontend Architecture

The frontend uses a hybrid island architecture: Flask/Jinja renders the HTML shell, and Vue 3 components are mounted as independent "islands" for interactive UI elements.

Island Build System

Each island is built as a self-contained IIFE bundle via Vite. No shared runtime — each island includes its own Vue + Pinia:

vue-islands/
  vite.shared.config.ts      # islandConfig() factory
  vite.config.ts              # V1sion   (Pass 1 — clears dist)
  vite.monitors.config.ts     # Monitors (Pass 2)
  vite.settings.config.ts     # Settings (Pass 3)
  vite.synmon.config.ts       # Synmon   (Pass 4)
  vite.brain.config.ts        # Brain    (Pass 5)
  vite.dashboard.config.ts    # Dashboard (Pass 6)

Feature Flags

6 feature flags control the Vue rollout. When a flag is false, the legacy HTML/JS renders unchanged — Vue assets aren't loaded:

yaml
features:
  v1sion_vue: true
  brain_vue: true
  settings_vue: true
  monitors_vue: true
  synmon_vue: true
  dashboard_vue: true

Bridge Pattern

Vue and legacy JS communicate via CustomEvents:

What Stays Legacy (By Design)

AreaReason
D3 topology engineComplex canvas/SVG with 60fps physics simulation
Chart.js internalsStateful chart instances with live SSE updates
Tab switchingCore navigation pattern, low migration value
Scan engine (SSE)Tightly coupled to closure-scoped graph data

Backend Structure

/opt/m1nd/
├── main.py              # Entry point
├── config.yaml          # Configuration
├── baseline.py          # Baseline learning / anomaly detection
├── core/                # Core modules (config, models)
├── features/            # Feature modules
├── web/                 # Flask app, routes, templates
│   ├── app.py           # Main Flask application
│   ├── static/          # JS, CSS, dist assets
│   └── templates/       # Jinja2 templates
├── tools/               # Network diagnostic tools
├── llm_ssh/             # AI diagnostics (ReAct loop)
├── scripts/             # Install, update scripts
├── migrations/          # Database migrations
├── tests/               # Playwright E2E tests
└── data/                # SQLite DB, SSL certs, backups

Security Architecture

Data Flow

Database Schema (Key Tables)

Released under the MIT License.