-
-
Notifications
You must be signed in to change notification settings - Fork 1
Architecture
Yiğit ERDOĞAN edited this page Jan 11, 2026
·
1 revision
CodeScope is built with a modern local-first RAG (Retrieval-Augmented Generation) architecture.
The system consists of three main components:
- Frontend: Next.js 14 web interface
- Backend: FastAPI server orchestrating the RAG pipeline
- Local Infrastructure: Ollama (LLM) and ChromaDB (Vector DB)
CodeScope follows a standard RAG workflow:
-
Ingestion Phase:
- Files are loaded from the local filesystem.
- Code is split into meaningful chunks using LangChain's
RecursiveCharacterTextSplitter. - Chunks are converted into vector embeddings using
sentence-transformers. - Embeddings and metadata are stored in ChromaDB.
-
Retrieval Phase:
- User query is embedded using the same embedding model.
- A similarity search is performed against ChromaDB to find relevant code snippets.
- Context is filtered and ranked for relevance.
-
Generation Phase:
- The user query and retrieved snippets are formatted into a prompt.
- The prompt is sent to the local LLM via Ollama.
- The response is streamed back to the user in real-time.
- FastAPI: High-performance asynchronous web framework.
- LangChain: Framework for developing LLM-powered applications.
- ChromaDB: AI-native open-source vector database.
- Sentence-Transformers: Multi-lingual text embeddings.
- Next.js 14: React framework with App Router.
- React 19: Modern UI library.
- Tailwind CSS: Utility-first CSS framework.
- Lucide React: Beautifully simple icons.
graph TD
User((User)) -->|Query| Frontend[Next.js Frontend]
Frontend -->|API Request| Backend[FastAPI Backend]
Backend -->|Search| Chroma[ChromaDB]
Chroma -->|Relevant Snippets| Backend
Backend -->|Prompt + Context| Ollama[Ollama LLM]
Ollama -->|Streaming Response| Backend
Backend -->|SSE Stream| Frontend
Frontend -->|Display| User
CodeScope is designed with a "local-only" philosophy:
- No External APIs: All processing happens on the host machine.
- No Data Telemetry: Your code and queries are never sent to external servers.
- Isolated Environment: Runs completely offline if desired.
- Explore the API: API Reference
- Contributing: Developer Guide
- Troubleshooting: Troubleshooting