How sujithr07/ai-driven-firewall works
Project type & purpose (inferred from tree)
This looks like a hybrid local “full‑stack” app:
• Frontend: React + Vite (App.jsx, main.jsx, index.html, vite.config.js, tailwind.config.js, index.css, package.json).
• Backend / local agent: Python entrypoints (app.py, app.pyw) suggesting a local service/daemon or desktop-ish launcher (the .pyw is common on Windows to run without a console).
• Data store: A local SQLite database (firewall.db).
• Cloud backend (optional/secondary): Supabase indicated by SUPABASE_SETUP.md + supabase_migration.sql + .env. That implies remote Postgres schema + auth/log sync.
• Domain: UI screens include NetworkTrafficView.jsx, ImmutableLogsView.jsx, SettingsView.jsx, Login.jsx — so likely a network monitoring/firewall + immutable audit log viewer with user login and configurable settings.
React UI (Vite + Tailwind)
• Key UI modules (components/pages):
Login, NetworkTrafficView, ImmutableLogsView, SettingsView, App
Python Local Service (app.py/app.pyw)
• Likely responsibilities (confirm in code):
• Network traffic / events
• enforce firewall rules / interact with OS/network stack
• provide local HTTP API to UI
• persist local logs/settings
Local SQLite DB (firewall.db)
• Stores: events/logs, settings, maybe local user/session cache
Supabase (external)
• Auth (login/session management)
• Postgres (schema from supabase_migration.sql)
Operating System / Network stack (external system)
• Because “network traffic” and “firewall” imply OS-level integration, represent it explicitly as an external dependency the Python service talks to.
Optional/conditional containers to include only if they exist after inspection:
• Dev server / build pipeline: Vite dev server in development, static build output in production.
• Packaging/distribution: If app.pyw is used with something like PyInstaller, show a “Packaged Desktop App” boundary.
User → React UI
• Interaction: view traffic, view immutable logs, configure rules/settings
React UI → Python Local Service
• Protocol: likely HTTP (REST) or WebSocket (if streaming traffic)
• Data: traffic events, log queries, settings updates, firewall rule changes
Python Local Service → OS / Network stack
• “Capture traffic”, “apply firewall rules”, “read interface stats”
• This is crucial: it explains why Python exists vs a purely cloud web app.
Python Local Service → Local SQLite (firewall.db)
• Write: captured events/logs, immutable log entries, settings
• Read: historical logs, saved configuration
Dev/build flows (separate from runtime)
• Dev: React runs via Vite dev server and calls Python service on localhost (CORS, proxy config in vite.config.js).
• Prod: React is built to static assets and either:
• served by Python (Flask/FastAPI static files), or
Local-first architecture
• Local Python service + local SQLite are first-class components.
• Supabase is “cloud augmentation” (auth/sync/reporting) rather than the only backend.
Separation of concerns
• React = presentation + interaction
• Python = privileged operations (network/firewall) + persistence + API
Immutable/audit logging
• If “ImmutableLogsView” is truly immutable, annotate the data store interactions:
• “append-only”
• “no UPDATE/DELETE” policy (or RLS policies in Supabase)
Streaming vs request/response
• Purpose: communicate what this system is and what it integrates with.
• React component view:
• App.jsx as shell/router
• Login, NetworkTrafficView, ImmutableLogsView, SettingsView
• Python component view (requires opening app.py):
• API routes/controllers
• traffic capture module
• firewall/rules module
• persistence layer (SQLite access)
• supabase client/sync job
Annotate environments
• “Localhost” boundary: UI + Python + SQLite
• “Cloud” boundary: Supabase
• “OS privileged boundary”: network stack access
• SUPABASE_SETUP.md + supabase_migration.sql: show schema/migration path into Supabase (and note whether it’s used for logs, users, settings, or all).
• .env: show configuration inputs for Supabase URL/keys, local ports, etc.
• requirements.txt: determines Python framework + libs (pcap? scapy? fastapi? flask?). Add those technology labels once confirmed.
• vite.config.js: likely contains proxy settings; mention “UI proxies /api to localhost:<python-port>” if present.
• app.pyw: highlight a “desktop launcher” or “runs in background” execution mode if used.