How xmartis3/pipeshub-ai-einfra works
1. System Purpose and Deployable Entry Points
PipesHub is a self-hosted workplace AI platform: it ingests enterprise data, preserves permission/relationship metadata, indexes searchable representations, and serves grounded search, chat, agents, and actions. It is a polyglot service system rather than a single application.
• Node API bootstrap: backend/nodejs/apps/src/index.ts, backend/nodejs/apps/src/app.ts
• Python service processes: backend/python/app/connectors_main.py, backend/python/app/indexing_main.py, backend/python/app/query_main.py
• Web/Electron UI: frontend/app/(main)/layout.tsx, frontend/electron/main.ts
2. Node.js Control Plane and Public API
The TypeScript backend is the control plane for HTTP APIs, authentication, workspace administration, connector configuration/scheduling, storage, and notifications. Modules follow route → controller → container/service boundaries, with shared auth, validation, rate limiting, metrics, and error middleware.
• API surfaces: backend/nodejs/apps/src/modules/enterprise_search/routes/es.routes.ts, backend/nodejs/apps/src/modules/configuration_manager/routes/cm_routes.ts
• Cross-cutting request/security boundary: backend/nodejs/apps/src/libs/middlewares/auth.middleware.ts, backend/nodejs/apps/src/libs/middlewares/require-scopes.middleware.ts
• API contract/documentation: backend/nodejs/apps/src/modules/api-docs/pipeshub-openapi.yaml
3. Identity, Tenancy, Credentials, and Configuration
Identity is separated into user authentication/SAML/session handling, OAuth-provider capability for third-party clients, and token management for connectors. Configuration is stored through swappable encrypted/distributed key-value implementations, allowing deployment selection between Redis and etcd.
• Authentication and account lifecycle: backend/nodejs/apps/src/modules/auth/services/session.service.ts, backend/nodejs/apps/src/modules/user_management/routes/users.routes.ts
• OAuth and connector-token boundaries: backend/nodejs/apps/src/modules/oauth_provider/services/oauth_token.service.ts, backend/nodejs/apps/src/modules/tokens_manager/services/token-event.producer.ts
• KV abstractions/providers: backend/nodejs/apps/src/libs/keyValueStore/keyValueStoreFactory.ts, backend/python/app/config/key_value_store_factory.py
4. Connector Ingestion and Event Pipeline
Connector instances are configured and scheduled by Node, then Python connector infrastructure instantiates source-specific connectors, refreshes credentials, fetches source entities, and emits normalized record/entity events. The connector registry/factory isolates common lifecycle and OAuth behavior from the large set of SaaS, database, filesystem, and web integrations.
• Scheduling/orchestration: backend/nodejs/apps/src/modules/crawling_manager/services/connector_schedule_orchestrator.ts, backend/nodejs/apps/src/modules/crawling_manager/services/crawling_worker.ts
• Python connector core: backend/python/app/connectors/core/factory/connector_factory.py, backend/python/app/connectors/core/base/data_processor/data_source_entities_processor.py
• Event handoff: backend/python/app/connectors/services/event_service.py, backend/python/app/services/messaging/kafka/producer/producer.py
5. Document Processing, Indexing, and Knowledge Stores
Asynchronous indexing consumes record events, extracts structured blocks from files/content, and writes coordinated representations to blob storage, vector search, and a graph database. This is the principal data boundary: raw external content becomes permission-aware records, embeddings, and graph entities/edges.
• Indexing pipeline/sinks: backend/python/app/modules/indexing/run.py, backend/python/app/modules/transformers/sink_orchestrator.py
• Parsing/OCR and Docling service: backend/python/app/modules/parsers/pdf/docling_processor.py, backend/python/app/services/docling/docling_service.py
• Stores: backend/python/app/services/vector_db/qdrant/qdrant.py, backend/python/app/services/graph_db/graph_db_factory.py
6. Retrieval, LLM, Agents, and Tools
The Python query service exposes search, chatbot, speech, and agent routes. Retrieval combines indexed knowledge with vector/graph access; Q&A and deep-agent workflows maintain state, stream responses, cite sources, and route permitted tool calls. AI model providers are registry-driven, supporting hosted and self-hosted model backends.
• Query APIs: backend/python/app/api/routes/search.py, backend/python/app/api/routes/chatbot.py
• Agent graphs: backend/python/app/modules/agents/qna/graph.py, backend/python/app/modules/agents/deep/orchestrator.py
• Tool/action registration and model providers: backend/python/app/agents/registry/toolset_registry.py, backend/python/app/config/ai_models/registry.py
7. Client and Operational Infrastructure
The Next.js frontend provides authenticated workspace configuration, connector management, knowledge-base browsing, visual agent construction, and streaming chat with citations. Docker Compose and Helm deploy the services and backing infrastructure; graph DB choice, messaging choice, and KV configuration are deployment-level decisions.
• Core UX: frontend/app/(main)/chat/page.tsx, frontend/app/(main)/agents/agent-builder/agent-builder.tsx
• Knowledge/connector UX: frontend/app/(main)/knowledge-base/page.tsx, frontend/app/(main)/workspace/connectors/page.tsx
• Deployment definitions: deployment/docker-compose/docker-compose.prod.yml, deployment/helm/pipeshub-ai/templates/deployment.yaml, deployment/helm/pipeshub-ai/templates/qdrant-statefulset.yaml
Main entry points: docker-compose.prod.yml Compose and Helm deployment · index.ts Node API bootstrap · qdrant.py Vector and graph stores · layout.tsx Next.js workspace UI
Components 21
Clients
- Next.js workspace UI · Configuration, connectors, knowledge, agents, and chat.
frontend/app/(main)/layout.tsx - Electron desktop shell
frontend/electron/main.ts
Node control plane
- Node API bootstrap
backend/nodejs/apps/src/index.ts - Search and config APIs
backend/nodejs/apps/src/modules/enterprise_search/routes/es.routes.ts - Auth and scope boundary
backend/nodejs/apps/src/libs/middlewares/auth.middleware.ts - Identity and connector tokens
backend/nodejs/apps/src/modules/auth/services/session.service.ts - Connector scheduler
backend/nodejs/apps/src/modules/crawling_manager/services/connector_schedule_orchestrator.ts
Connector ingestion
- Python connector process
backend/python/app/connectors_main.py - Connector registry and lifecycle
backend/python/app/connectors/core/factory/connector_factory.py - Normalized event producer
backend/python/app/connectors/services/event_service.py
Indexing and knowledge
- Python indexing process
backend/python/app/indexing_main.py - Parse and sink pipeline · Transforms content into permission-aware searchable representations.
backend/python/app/modules/indexing/run.py - Docling parsing and OCR
backend/python/app/services/docling/docling_service.py
Query and AI
- Python query service
backend/python/app/query_main.py - Search and chat APIs
backend/python/app/api/routes/search.py - Q&A and deep agents · Streams grounded responses and routes permitted actions.
backend/python/app/modules/agents/qna/graph.py - Tool and model registries
backend/python/app/agents/registry/toolset_registry.py
Deployment and stores
- Encrypted distributed KV · Redis or etcd implementation selected at deployment.
backend/nodejs/apps/src/libs/keyValueStore/keyValueStoreFactory.ts - Record event bus
backend/python/app/services/messaging/kafka/producer/producer.py - Vector and graph stores · Coordinated embeddings and entity/relationship representations.
backend/python/app/services/vector_db/qdrant/qdrant.py - Compose and Helm deployment · Deploys services and backing infrastructure.
deployment/docker-compose/docker-compose.prod.yml
Connections 27
- Electron desktop shell → Next.js workspace UI: hosts
- Next.js workspace UI → Node API bootstrap: workspace APIs
- Next.js workspace UI → Python query service: streaming chat
- Node API bootstrap → Auth and scope boundary: protects requests
- Auth and scope boundary → Search and config APIs: authorizes
- Node API bootstrap → Identity and connector tokens: sessions and OAuth
- Node API bootstrap → Connector scheduler: configures schedules
- Identity and connector tokens → Encrypted distributed KV: stores state
- Connector scheduler → Encrypted distributed KV: reads configuration
- Connector scheduler → Python connector process: triggers crawls
- Python connector process → Connector registry and lifecycle: instantiates
- Connector registry and lifecycle → Normalized event producer: normalizes entities
- Normalized event producer → Record event bus: publishes records
- Record event bus → Python indexing process: consumed by
- Python indexing process → Parse and sink pipeline: runs
- Parse and sink pipeline → Docling parsing and OCR: extracts documents
- Parse and sink pipeline → Vector and graph stores: indexes records and graph
- Python query service → Search and chat APIs: serves
- Search and chat APIs → Vector and graph stores: retrieves grounded context
- Search and chat APIs → Q&A and deep agents: invokes
- Q&A and deep agents → Tool and model registries: uses tools and models
- Q&A and deep agents → Vector and graph stores: retrieves and cites
- Compose and Helm deployment → Node API bootstrap: deploys
- Compose and Helm deployment → Python connector process: deploys
- Compose and Helm deployment → Python indexing process: deploys
- Compose and Helm deployment → Python query service: deploys
- Compose and Helm deployment → Vector and graph stores: provisions