Architecture
Rosmarium relies on a deliberate split-stack architecture. By using Node.js for I/O bound API tasks and Python for CPU-heavy AI tasks, each layer operates where it is most efficient.
Core Components
rosmarium-server
Node.js / Fastify
- Content API: Handles REST and GraphQL queries.
- Auth & RBAC: Session management and API key validation.
- Job Dispatch: Dispatches BullMQ jobs to Redis for the AI worker.
rosmarium-ai-worker
Python / FastAPI
- Embedding Engine: Vector generation via Ollama/OpenAI.
- RAG Pipeline: LlamaIndex & spaCy chunking.
- Graph Analytics: NetworkX PageRank & community detection.
Shared Infrastructure
PostgreSQL 16Central source of truth. JSONB content + pgvector embeddings.
Redis 7Job queue intermediary using BullMQ schema + edge cache.
Event Flow: Content Creation
When a user creates and publishes content, the split-stack orchestrates the intelligence pipeline seamlessly:
1
Write to Database
rosmarium-server validates the schema and writes the JSONB entry directly to PostgreSQL.
2
Dispatch Job
An event emitter catches the publish hook and dispatches an embed-content job to the Redis queue.
3
Vectorize & Upsert
rosmarium-ai-worker pulls the job, chunks the text, hits the local Ollama LLM for embeddings, and directly upserts them to pgvector.
4
Intelligence Ops
A secondary analyse-content job is dispatched for NER extraction, auto-tagging, and graph edge generation.