How kyan9400/opsmind works
OpsMind is a multi-tenant operations platform combining document-grounded answers, document indexing, KPI analytics and anomaly summaries. The main user flow is browser → API: users upload documents for asynchronous indexing, then ask questions and receive cited answers; the analytics dashboard shows KPI trends and anomalies. The API also handles identity, tenant/role checks, audit and exports. The README documents the API/worker/AI-service boundaries and storage, but several route and web implementations were not sampled, so some documented links use the README as evidence.
Main entry points: main.py AI service endpoints · db.ts Postgres and pgvector · app.ts Express API · metrics.ts KPI and reports
Components 25
Web experience
- Next.js dashboard
apps/web/app/dashboard/page.tsx - Documents view
apps/web/app/dashboard/documents/page.tsx - Ask view
apps/web/app/dashboard/ask/page.tsx - Analytics view
apps/web/app/dashboard/analytics/page.tsx - Sign-in view
apps/web/app/login/page.tsx
API and tenancy
- Authentication routes
apps/api/src/routes/auth.ts - Auth and role checks
apps/api/src/middleware/auth.ts - Document routes
apps/api/src/routes/documents.ts - Question routes
apps/api/src/routes/ask.ts - KPI and reports
apps/api/src/routes/metrics.ts - Express API
apps/api/src/app.ts
Document indexing
- Ingest worker
apps/api/src/worker.ts - Ingest orchestration
apps/api/src/lib/ingest.ts - Job queue
apps/api/src/lib/queue.ts
AI and analytics
- AI service endpoints
services/ai/app/main.py - Text extraction
services/ai/app/extract.py - Text chunking
services/ai/app/chunking.py - Embedding providers
services/ai/app/embeddings.py - Hybrid retrieval
services/ai/app/retrieval.py - Cited answer generation
services/ai/app/llm.py - Anomaly and summaries
services/ai/app/insights.py
Shared state
- Postgres and pgvector
apps/api/src/lib/db.ts - Redis
apps/api/src/lib/redis.ts
Other components
- Business user
- LLM and embedding providers
Connections 34
- Business user → Next.js dashboard: uses
- Next.js dashboard → Express API: calls REST API
- Business user → Sign-in view: signs in
- Sign-in view → Authentication routes: authenticates
- Express API → Authentication routes: mounts
apps/api/src/app.ts - Express API → Document routes: mounts
apps/api/src/app.ts - Express API → Question routes: mounts
apps/api/src/app.ts - Express API → KPI and reports: mounts
apps/api/src/app.ts - Authentication routes → Postgres and pgvector: reads and writes
apps/api/src/routes/auth.ts - Authentication routes → Auth and role checks: protects profile
apps/api/src/routes/auth.ts - Auth and role checks → Postgres and pgvector: checks membership
apps/api/src/middleware/auth.ts - Document routes → Job queue: enqueues uploads
apps/api/src/routes/documents.ts - Document routes → Postgres and pgvector: stores document state
apps/api/src/routes/documents.ts - Job queue → Ingest worker: dispatches jobs
apps/api/src/worker.ts - Ingest worker → Ingest orchestration: runs ingestion
apps/api/src/worker.ts - Ingest orchestration → AI service endpoints: posts ingest request
apps/api/src/lib/ingest.ts - AI service endpoints → Text extraction: extracts text
services/ai/app/main.py - AI service endpoints → Text chunking: chunks text
services/ai/app/main.py - AI service endpoints → Embedding providers: embeds chunks
services/ai/app/main.py - AI service endpoints → Postgres and pgvector: stores chunks and vectors
- Ask view → Question routes: submits questions
- Question routes → AI service endpoints: requests cited answer
- AI service endpoints → Embedding providers: embeds query
services/ai/app/main.py - AI service endpoints → Hybrid retrieval: searches candidates
services/ai/app/main.py - Hybrid retrieval → Postgres and pgvector: searches tenant chunks
services/ai/app/retrieval.py - AI service endpoints → Cited answer generation: generates answer
services/ai/app/main.py - Cited answer generation → LLM and embedding providers: calls configured provider
services/ai/app/llm.py - Next.js dashboard → Analytics view: opens analytics
- Analytics view → KPI and reports: requests KPI data
- KPI and reports → AI service endpoints: requests insights
- AI service endpoints → Anomaly and summaries: computes summaries
services/ai/app/main.py - Anomaly and summaries → Cited answer generation: summarizes metrics
services/ai/app/insights.py - KPI and reports → Postgres and pgvector: reads KPI data
apps/api/src/routes/metrics.ts - KPI and reports → Redis: uses cache
apps/api/src/routes/metrics.ts