How nikhil-doye/ai-memory works
Project Type and Purpose
• This is a full-stack semantic memory management platform.
• Frontend: React + Vite for interactive graph visualization and memory management UI.
• Backend: FastAPI (Python) exposing REST and SSE endpoints to handle memory CRUD, embedding generation, vector search, relationship inference.
• Data Stores: Neo4j (graph + native vector index) for memories & relationships, Redis for caching stats and hot data.
• External Service: Hugging Face Qwen3-Embedding model for vector embeddings.
File Structure
• Top-level:
• backend/ (main.py, requirements, tests, Dockerfile)
• frontend/ (App.jsx, index.html, Vite & Tailwind configs, Dockerfile, nginx.conf)
• docker-compose.yml orchestrates Neo4j, Redis, backend, frontend
• monitoring/ (prometheus.yml)
• Patterns & Config:
• MVC-style separation: frontend (view), backend (controller + business logic), database (model)
• “migrate.sh” for database migrations or schema initialization
• test_platform.py for integration smoke tests
README for Architectural Insights
• Describes key flows: memory creation, search, graph retrieval.
• Lists components: caching layer, SSE for real-time updates, PDF ingestion.
• Browser / Client UI (React + Vite)
• Web Server / API Layer (FastAPI container)
• Graph Database (Neo4j)
• Cache Layer (Redis)
• Embedding Service (Hugging Face model)
• Orchestration (Docker Compose network)
• Monitoring (Prometheus)
• User → React UI → HTTP(S) → FastAPI
• FastAPI → Bolt driver → Neo4j (graph operations + vector search)
• FastAPI ↔ Redis (GET/SET for statistics and SSE)
• FastAPI → Hugging Face Hub (embedding generation)
• FastAPI → SSE stream → React UI (real-time graph updates)
• Docker Compose connects all containers on a private network
c. Architectural Patterns & Principles:
• Layered architecture: presentation, application logic, data access.
• Cache-Aside pattern for Redis.
• Batch queries to Neo4j for performance.
• Event-driven updates (SSE) for live UI refresh.
• Separation of concerns: PDF ingestion, embedding, relationship inference isolated in backend modules.
d. Key Technologies & Frameworks:
• React + Vite + Tailwind CSS (+ nginx)
• FastAPI + Pydantic + uvicorn
• Neo4j 5.x with vector search
• Redis in-memory cache
• Docker & Docker Compose
• Prometheus for metrics