This document provides a comprehensive overview of the DeepV-Ki project architecture, technologies, and conventions for the DeepV Code AI Assistant.
DeepV-Ki is a full-stack application designed to automatically generate comprehensive, interactive documentation (Wiki) for code repositories using various Large Language Models (LLMs). It supports multiple repository types (GitHub, GitLab, etc.) and features a Retrieval-Augmented Generation (RAG) system for code Q&A.
The project uses a decoupled architecture:
| Component | Technology | Framework/Library |
|---|---|---|
| Backend | Python 3.12+ | FastAPI, Uvicorn, Celery, Redis, SQLAlchemy |
| Frontend | TypeScript | Next.js 15 (App Router), React 19, Tailwind CSS |
| AI Core | Python | adalflow (LLM orchestration), FAISS (Vector Store) |
- Framework: FastAPI is used for the RESTful API and streaming endpoints.
- Asynchronous Processing: Heavy tasks (Wiki generation) are handled by a Celery task queue, using Redis as the broker.
- Core Logic:
api/wiki_generator.py: Handles the core logic for generating the Wiki structure and content, including intelligent model switching for token management.api/rag.py: Implements the RAG system usingadalflowandFAISSRetrieverfor code-based Q&A.api/mermaid_renderer.py: Manages server-side rendering of Mermaid diagrams (viamermaid.inkor Playwright).
- Data Persistence: Uses SQLite for metadata and FAISS for vector indexing, with data persisted locally in the
~/.adalflowdirectory.
- Framework: Next.js 15 utilizing the App Router structure (
src/app/). - Styling: Utility-first styling is enforced using Tailwind CSS.
- State Management: Primarily uses React Context (
src/contexts/) and custom hooks (src/hooks/) for domain-specific state (e.g.,GitLabContext,LanguageContext). - Key Components:
src/components/Markdown.tsx: Renders Markdown, handles code highlighting, and intercepts file links to display source code.src/components/Mermaid.tsx: Manages the complex, dynamic rendering of Mermaid diagrams.src/components/Ask.tsx: The streaming chat interface for the RAG system.
The frontend communicates with the backend via Next.js API Proxy Rewrites defined in next.config.ts. All frontend requests to /api/* are transparently forwarded to the backend's SERVER_BASE_URL (default: http://localhost:8001), eliminating CORS issues and simplifying the client-side code.
The project is designed for maximum LLM flexibility:
- Abstraction: All LLM interactions are abstracted through the
adalflowframework and dedicated client classes (e.g.,api/openai_client.py,api/azureai_client.py). - Configuration: Model selection, provider credentials, and parameters are managed via JSON files in the
api/config/directory:generator.json: Defines available LLM providers and models for content generation.embedder.json: Configures the embedding model used for the RAG system.repo.json: Defines file filtering and processing rules for repository analysis.
| Action | Command | Notes |
|---|---|---|
| Backend Start | python -m api.main |
Requires Python 3.12+ and dependencies from pyproject.toml. Runs on port 8001. |
| Frontend Install | npm install |
Installs Next.js/React dependencies. |
| Frontend Start | npm run dev |
Starts the Next.js development server on port 3000. |
| Frontend Build | npm run build |
Creates a production build. |
| Linting | npm run lint |
Runs Next.js linting. |
The project is optimized for Docker deployment using docker-compose.yml. The frontend uses the output: 'standalone' configuration in next.config.ts for minimal image size.
| Path | Purpose |
|---|---|
api/ |
Backend Source: Contains all Python/FastAPI code. |
api/main.py |
Backend entry point (Uvicorn server). |
api/config/ |
JSON configuration files for LLMs, RAG, and repository processing. |
api/routers/ |
FastAPI route definitions (e.g., chat.py, wiki.py). |
src/ |
Frontend Source: Contains all Next.js/React/TypeScript code. |
src/app/ |
Next.js App Router pages and layouts. |
src/components/ |
Reusable React components (e.g., Ask.tsx, Mermaid.tsx). |
src/hooks/ |
Custom React hooks (e.g., useTasks.ts, useAuth.ts). |
next.config.ts |
Next.js configuration, including critical API proxy rewrites. |
pyproject.toml |
Python dependency management and project metadata. |
package.json |
Node.js/Frontend dependency management and scripts. |
- Language: TypeScript is mandatory for the frontend. Python with type hinting is standard for the backend.
- Styling: Tailwind CSS is the sole styling framework.
- Architecture: Adherence to the Next.js App Router and a clear separation of concerns between the decoupled frontend and backend services.
- Internationalization: Uses
next-intlfor multi-language support.
- DEEPV.md generated by /init command on 2025-11-22 12:00:00
⚠️ CRITICAL AGENT RULES (Added 2025-11-22)⚠️ - 🚫 NO .md FILES: Do not create .md files without explicit permission. Output directly to chat.
- ❓ CLARIFY: Clarify ambiguous instructions before execution.
- ✅ CONFIRM: Confirm major architectural/logic plans before implementation.
- User forbids creating .md files without explicit permission, requires clarification on ambiguous instructions, and demands confirmation for major plans.