How ns-matrix/codeguard-ai works
CodeGuard AI is a browser-based code validation and review platform. A user submits code from the Validator page; the frontend store calls the REST API, where the validation service combines language detection, deterministic syntax/security checks, and local Ollama analysis, then persists results for history and reporting. The UI also exposes focused AI actions, formatting, model/settings controls, history, and dashboard analytics. The README documents the overall REST and storage integrations; edges into unsampled implementation details are limited to relationships shown by the source index or README.
Main entry points: main.py FastAPI app · validation_service.py Validation orchestrator · database.py Database access · App.tsx App routing
Components 25
Browser application
- App routing
frontend/src/App.tsx - Validator page
frontend/src/pages/Validator.tsx - Action results
frontend/src/components/ValidationPanel/ValidationPanel.tsx - Validation state
frontend/src/stores/validationStore.ts - REST client
frontend/src/services/api.ts - Dashboard
frontend/src/pages/Dashboard.tsx - History views
frontend/src/pages/History.tsx - Settings page
frontend/src/pages/Settings.tsx
Backend API
- FastAPI app
backend/app/main.py - Validation routes
backend/app/api/validation.py - Model routes
backend/app/api/models.py - Project routes
backend/app/api/projects.py - History routes
backend/app/api/history.py - Statistics routes
backend/app/api/stats.py
Validation engine
- Validation orchestrator
backend/app/services/validation_service.py - Language detector
backend/app/services/language_detector.py - Syntax validator
backend/app/services/syntax_validator.py - Security scanner
backend/app/services/security_scanner.py - Code formatter
backend/app/services/formatter.py - LLM service
backend/app/services/ollama_service.py
Persistence and integrations
- Database access
backend/app/db/database.py - Validation records
backend/app/models/validation.py - PostgreSQL / Supabase
- Ollama server
Other components
- Developer
Connections 34
- Developer → App routing: uses
README.md - App routing → Validator page: routes to
frontend/src/App.tsx - App routing → Dashboard: routes to
frontend/src/App.tsx - App routing → History views: routes to
frontend/src/App.tsx - App routing → Settings page: routes to
frontend/src/App.tsx - Validator page → Action results: renders
frontend/src/pages/Validator.tsx - Validator page → Validation state: dispatches
frontend/src/pages/Validator.tsx - Action results → Validation state: dispatches
frontend/src/components/ValidationPanel/ValidationPanel.tsx - Validation state → REST client: calls
frontend/src/stores/validationStore.ts - REST client → FastAPI app: REST requests
README.md - Dashboard → REST client: loads analytics
frontend/src/pages/Dashboard.tsx - History views → REST client: loads history
- Settings page → Validation state: reads and updates
frontend/src/pages/Settings.tsx - FastAPI app → Validation routes: registers
backend/app/main.py - FastAPI app → Model routes: registers
backend/app/main.py - FastAPI app → Project routes: registers
backend/app/main.py - FastAPI app → History routes: registers
backend/app/main.py - FastAPI app → Statistics routes: registers
backend/app/main.py - Validation routes → Validation orchestrator: invokes
backend/app/api/validation.py - Validation orchestrator → Language detector: detects language
backend/app/services/validation_service.py - Validation orchestrator → Syntax validator: checks syntax
backend/app/services/validation_service.py - Validation orchestrator → Security scanner: scans security
backend/app/services/validation_service.py - Validation orchestrator → LLM service: requests analysis
backend/app/services/validation_service.py - Validation orchestrator → Code formatter: formats code
backend/app/services/validation_service.py - Validation orchestrator → Validation records: creates records
backend/app/services/validation_service.py - Validation routes → Database access: gets session
backend/app/api/validation.py - History routes → Database access: queries
backend/app/api/history.py - Statistics routes → Database access: queries
backend/app/api/stats.py - Project routes → Database access: uses session
backend/app/api/projects.py - Model routes → LLM service: lists models
backend/app/api/models.py - Database access → PostgreSQL / Supabase: reads and writes
README.md - LLM service → Ollama server: HTTP analysis
backend/app/services/ollama_service.py - FastAPI app → Database access: initializes
backend/app/main.py - FastAPI app → LLM service: checks connection
backend/app/main.py