How lecoeurdelest/memeradar works
1. Overall shape
- MemeRadar is a two-tier system: a Python backend API plus a React/Vite frontend.
- The backend is not just request handling; it also owns ingestion, enrichment, and batch analytics that populate the search indexes and graph store.
- The main architectural boundary is between the online query path and the offline data/metric pipelines.
2. Frontend subsystem
- frontend/ is a Vite-built SPA (App.jsx, main.jsx, components/MutationRadar.jsx).
- It talks to the backend over HTTP via frontend/src/api.js.
- The UI appears to center on search/browse plus a mutation visualization panel, with the same backend powering both interactive search and graph/mutation views.
3. API and application runtime
- backend/main.py is the FastAPI entry point.
- The backend exposes at least:
- /health
- /search
- /mutations
- This makes the backend the orchestration layer that joins vector search results, metadata, and graph lineage into a single response for the UI.
4. Persistence and retrieval stores
- The system uses Qdrant as the vector store and Neo4j as the graph store, configured through backend/clients.py and backend/config.py.
- Qdrant holds searchable meme points and probably named vectors for multimodal retrieval.
- Neo4j holds relationship/lineage structure, especially template/member ancestry and enrichment data used by the “lineage panel.”
5. External model/service dependencies
- The backend depends on outside AI services for core enrichment:
- Twelve Labs for video/image retrieval embeddings or multimodal representations.
- Mistral for caption/decoder/enrichment generation and embeddings used for irony/semantic signals.
- These are not incidental; they materially define the multimodal ranking and enrichment pipeline.
- backend/decoder.py, backend/translate.py, and backend/enrich_cognee.py suggest distinct AI-assisted transformation steps rather than a single monolithic model call.
6. Offline ingestion pipeline
- scripts/crawl_reddit.py pulls candidate meme posts from Reddit.
- backend/ingest.py then processes that data into the system’s stores, likely extracting media, metadata, and embeddings before inserting into Qdrant and Neo4j.
- The ingestion flow is intentionally staged: crawl first, ingest second, then enrich, which keeps source collection separate from index materialization.
7. Data normalization and asset storage
- The data/ directory contains committed snapshot datasets such as imgflip_memes.json and knowyourmeme_latest/.
- This suggests the repo supports both live crawling and reproducible local corpora for development/testing.
- backend/storage.py and backend/mutation.py imply local file/data management alongside datastore writes, with DATA_DIR as the filesystem boundary.
8. Search fusion and ranking
- backend/search.py and scripts/rrf_sweep.py indicate the search engine combines multiple relevance signals, likely through reciprocal-rank fusion or a similar weighted blend.
- The README’s visual/irony slider confirms the user can tune the balance between visual similarity and semantic/ironic relevance.
- This is the key online ranking boundary: the API merges outputs from different retrieval dimensions before returning a unified result set.
9. Graph lineage and semantic enrichment
- backend/enrich_cognee.py and the Neo4j dependency point to a graph-enrichment layer that turns raw meme records into connected templates, variants, and related nodes.
- The “lineage panel” in the demo implies each search result can be expanded into its graph neighborhood, not just retrieved as an isolated item.
- This graph layer is a separate concern from vector search; it provides explainability and meme-family structure.
10. Mutation analytics as a batch subsystem
- scripts/compute_mutation_metrics.py computes template drift, centroid behavior, and a trending_mutation flag.
- The README makes clear this is a decoupled batch job: it writes summary metrics to Neo4j/Qdrant but is not on the hot search path.
- That separation matters architecturally because the online API reads precomputed mutation state instead of performing dense-vector analytics during search.
11. Operational/tooling boundary
- The repo is designed for local native runtimes, not containers: Python via uv, Node via npm/Vite, plus running Qdrant and Neo4j as separate services.
- Startup scripts (start.sh, start.ps1) package the backend launch and optional frontend build, but datastore processes remain distinct.
- This means the architecture diagram should show at least four runtime nodes: frontend dev server, FastAPI backend, Qdrant, and Neo4j.
12. How the main data flows connect
- Source data comes from Reddit and committed datasets into the ingestion pipeline.
- Ingestion/enrichment populates Qdrant for retrieval and Neo4j for lineage/relationships.
- The frontend queries FastAPI; FastAPI performs fused retrieval against Qdrant, enriches/joins with graph data from Neo4j, and returns ranked results.
- Batch mutation analytics periodically update drift-related fields, which the API reads directly when serving mutation views.
Main entry points: ingest.py Ingest flow · clients.py Store clients · main.py FastAPI app · search.py Search fusion
Components 19
Frontend
React/Vite SPA for search and mutation visualization
- UI shell · Main React app entry and page composition
frontend/src/App.jsx - API client · Browser-side backend requests and result loading
frontend/src/api.js - Mutation radar · Mutation and lineage panel in the UI
frontend/src/components/MutationRadar.jsx
Backend
FastAPI API plus retrieval, enrichment, and ingestion logic
- FastAPI app · HTTP entry point exposing health, search, and mutation routes
backend/main.py - Search fusion · Combines multimodal retrieval signals and tunes relevance mix
backend/search.py - Ingest flow · Materializes crawled data into retrieval and graph stores
backend/ingest.py - Graph enrich · Builds lineage and relationship data for meme families
backend/enrich_cognee.py - Mutation metrics · Computes drift and trending mutation signals
backend/mutation.py - Store clients · Qdrant and Neo4j client setup
backend/clients.py - Config · Service credentials, endpoints, and environment settings
backend/config.py - Storage · Local data directory and asset handling
backend/storage.py - Decoder · Model-assisted decoding and caption transformations
backend/decoder.py - Translate · Caption and language transformation step
backend/translate.py
Stores
External persistence and retrieval systems
- Qdrant · Multimodal search index for meme points
- Neo4j · Lineage, relationships, and mutation-linked graph data
Pipelines
Offline crawl, ingest, and analytics jobs
- Reddit crawl · Candidate meme collection from Reddit
scripts/crawl_reddit.py - Metric batch · Scheduled computation of template drift and trend flags
scripts/compute_mutation_metrics.py - RRF sweep · Search ranking sweep for fusion tuning
scripts/rrf_sweep.py
Data
Committed meme corpora and snapshots
- Meme corpus · Committed meme and knowledge-base snapshots
data/knowyourmeme_latest/index.json
Connections 20
- API client → FastAPI app: HTTP · Frontend queries the FastAPI application
- UI shell → API client: uses · UI delegates data fetching to the client module
- UI shell → Mutation radar: renders · Mutation panel is part of the SPA
- FastAPI app → Search fusion: search · Search endpoint delegates ranking and retrieval fusion
- FastAPI app → Graph enrich: mutations · Mutation views join graph lineage and enrichment data
- Search fusion → Store clients: retrieves · Search uses store clients for vector and graph lookups
- Graph enrich → Store clients: writes/reads · Graph enrichment persists and reads relationship data
- Ingest flow → Storage: assets · Ingest reads local snapshots and media boundaries
- Ingest flow → Store clients: indexes · Ingest writes searchable content and graph nodes
- Decoder → Ingest flow: feeds · Decoder contributes transformed content to ingestion
- Translate → Ingest flow: feeds · Translation step contributes normalized text to ingestion
- Mutation metrics → Neo4j: updates · Batch analytics writes trend and drift metrics to graph store
- Mutation metrics → Qdrant: updates · Batch analytics may annotate retrieval records with mutation state
- Store clients → Qdrant: connects · Vector store client for multimodal retrieval
- Store clients → Neo4j: connects · Graph store client for lineage and relationships
- Config → Store clients: configures · Configuration supplies service endpoints and credentials
- Reddit crawl → Ingest flow: source · Crawled Reddit posts flow into ingestion
- Meme corpus → Ingest flow: seed data · Committed corpora support reproducible local ingestion
- Metric batch → Neo4j: writes · Offline mutation metrics are materialized into graph data
- RRF sweep → Search fusion: tunes · Ranking sweep informs fusion weighting and relevance behavior