How chirag-dhanda/jsl-contigency works
1. This repository is an enterprise platform monorepo, not a single app. It contains multiple user-facing UIs, a Python backend, AI/knowledge services, database assets, deployment tooling, and a large documentation/governance layer. The core product theme is knowledge + learning + manufacturing operations, with AI and workflow capabilities built around that.
2. The frontend is split into three distinct surfaces: a newer React/Vite app in front1, another React/JS Vite app in frontend_app, and a legacy static/JS app in frontend. They all present similar business areas such as dashboard, admin, learning, knowledge studio, workflow, media library, search, and approvals. The UIs consume backend APIs and use mock/service layers for local development.
3. The backend is a Python modular monolith centered in backend/main.py, with orchestration and lifecycle code in backend/core, shared config in backend/config, and cross-cutting concerns like logging, middleware, exceptions, and dependency injection. This is the main runtime boundary: request handling enters here, then routes into domain modules, services, and repositories.
4. Business capability is organized as many backend modules rather than a few large services. The important domains include authentication, authorization, users, roles/permissions, departments, learning, notifications, dashboard, search, reports, workflow, content, media, knowledge, roadmap, assessment, and audit. Most modules follow a consistent internal shape of models, services, APIs/controllers, and module registration.
5. The AI subsystem is a major architectural branch. It includes AI platform/orchestrator/router/runtime modules, provider abstractions, Ollama integration, prompt management, conversations, skills/tools, monitoring, moderation, memory, and a dedicated AI gateway/cache layer. The data flow is typically: user prompt or knowledge request → context/prompt assembly → retrieval or tool use → local model inference via Ollama → formatted response with citations/observability.
6. Knowledge ingestion and retrieval form a pipeline of their own. The repository contains document parsing, chunking, metadata extraction, embeddings generation, vector search, retrieval, and response formatting, plus knowledge platform/studio modules for upload, review, publishing, and explorer experiences. Storage is backed by local document assets and a vector store (storage/chromadb), with additional graph-style relationship handling in the relationship engine and Neo4j-oriented code paths.
7. Persistence is multi-store rather than single-database only. There is a relational model layer with migrations under backend/migrations, repository abstractions, and an entity catalog/database documentation structure. In addition, there is graph persistence (neo4j_engine, relationship repositories) and vector persistence (vector DB/chroma storage). The architecture therefore separates operational data, knowledge graph data, and embedding/vector data.
8. Workflow and automation are first-class. backend/modules/workflow_engine handles definitions, tasks, runtime, approvals, events, and notifications, while the events subsystem provides a bus, registry, subscriptions, automation engine, store, and dead-letter queue. This makes the platform event-driven inside the backend even though it is packaged as a modular monolith.
9. Security and governance are deeply embedded, not bolted on. Authentication, JWT/password handling, rate limiting, headers, sessions, and security controls are complemented by governance platform logic for classification, compliance, field security, row-level security, policy enforcement, and audit monitoring. Role/permission management and access requests are central to access control across the system.
10. Integration boundaries are explicit, especially for enterprise systems. backend/modules/integration_platform includes connectors, a gateway, sync engine, transformation, scheduling, and conflict handling, while the sap directory and backend/services/future-sap/related docs show planned and current ERP mapping work. This suggests bidirectional synchronization with SAP-style source systems as a key external dependency.
11. Content and media are managed as platform assets rather than just files. There are modules for document intelligence, document processing, media platform, thumbnails, OCR, uploads, storage, and demo data generation, plus a large checked-in corpus under backend/storage/demo_docs, knowledge-base, and demo-data. These assets feed both the learning/knowledge features and the AI/RAG pipeline.
12. Operations and quality are supported by strong platform scaffolding: CI workflows in .github/workflows, Docker and deployment assets, scripts and tasks, health endpoints, logs, tests, and benchmark/performance/security suites. The repo also includes extensive architecture, standards, governance, and review documents, indicating that documentation and process are part of the system’s operational design, not just supporting material.
Main entry points: main.py main.py · knowledge_platform Knowledge platform · ai_platform AI platform · docs Docs & standards
Components 20
Frontend surfaces
User-facing clients and local development mocks
- front1 · Newer enterprise surface for dashboard, knowledge, workflow, and admin experiences
front1 - frontend_app · Second modern UI with specialized studio and explorer modules
frontend_app - frontend · Older static frontend with dashboard, auth, learning, and metadata pages
frontend
Backend platform
Python modular monolith and cross-cutting runtime
- main.py · Application startup and request entry boundary
backend/main.py - Core runtime · Lifecycle, dependency injection, events, cache, and module wiring
backend/core - Config · Central configuration and validation across environments and services
backend/config - Security & auth · Authentication, authorization, sessions, JWT, headers, rate limiting, and access control
backend/modules/auth - People domain · Users, departments, roles, permissions, profiles, and access requests
backend/modules/users - Learning & content · Learning, lessons, progress, certificates, content, media, documents, and publishing
backend/modules/learning - Knowledge platform · Document intake, parsing, chunking, metadata, retrieval, review, and studio workflows
backend/modules/knowledge_platform - AI platform · Prompting, conversation, skills, providers, citations, observability, and model routing
backend/modules/ai_platform - Workflow events · Workflow engine, approvals, runtime tasks, automation, event bus, and notifications
backend/modules/workflow_engine - Integration layer · Enterprise connectors, gateway, sync, transformation, and SAP mapping paths
backend/modules/integration_platform - Governance · Classification, compliance, field security, row-level security, and audit monitoring
backend/modules/governance_platform
Data layers
Relational, graph, and vector persistence
- Relationship graph · Knowledge and entity relationships across graph-oriented repositories and projectors
backend/modules/relationship_engine - Relational DB · Operational schema, ORM models, migrations, and repository-backed records
backend/migrations - Vector store · Embedding storage and semantic retrieval corpus
backend/storage/chromadb - Demo corpus · Checked-in docs, manuals, SOPs, training content, and media assets used for ingestion and demos
backend/storage/demo_docs
Docs and operations
Governance, standards, deployment, testing, and repository process
- Docs & standards · Architecture, governance, security, testing, deployment, and decision records
docs - CI/CD & deploy · GitHub workflows, Docker, deployment manifests, and release tooling
.github/workflows
Connections 25
- front1 → main.py: API calls · Primary UI consumes backend services and APIs
- frontend_app → main.py: API calls · Modern secondary UI consumes the same backend boundary
- frontend → main.py: API calls · Legacy UI also depends on backend APIs
- main.py → Core runtime: bootstraps · Entrypoint wires lifecycle, DI, cache, and event plumbing
- main.py → Config: loads · Startup resolves environment and platform configuration
- main.py → Security & auth: routes · Requests enter identity and access control modules
- main.py → People domain: routes · Core business users and organization flows
- main.py → Learning & content: routes · Learning and content capabilities
- main.py → Knowledge platform: routes · Knowledge intake, retrieval, and studio flows
- main.py → AI platform: routes · AI requests and copilot-style interactions
- main.py → Workflow events: routes · Workflow, approval, and event-driven operations
- main.py → Integration layer: routes · External enterprise synchronization and connectors
- main.py → Governance: routes · Governance and compliance enforcement
- Knowledge platform → Vector store: writes/reads · Chunking and embeddings persist to vector search
- Knowledge platform → Relational DB: stores metadata · Document, review, and ingestion state is persisted
- Knowledge platform → Relationship graph: projects · Relationship extraction feeds graph persistence
- AI platform → Vector store: retrieves · RAG and semantic context access embeddings
- AI platform → Relationship graph: uses graph context · Knowledge and entity relationships enrich prompts and answers
- AI platform → Demo corpus: trains/reads · Demo and reference corpora seed AI and knowledge flows
- Workflow events → Relational DB: persists · Workflow definitions, tasks, and notifications are stored
- Integration layer → Relational DB: syncs · Operational records and mappings sync through the main database
- CI/CD & deploy → main.py: builds · Pipelines package and validate the backend runtime
- Docs & standards → CI/CD & deploy: defines · Documentation and governance prescribe delivery process
- Docs & standards → main.py: guides · Architecture and standards shape backend structure
- Docs & standards → front1: guides · UI standards and product docs shape the frontends