Skip to content

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ DevPilot AI

Understand any codebase β€” without ever running it.

DevPilot AI lets you import a public GitHub repository or ZIP file and instantly explore it through static analysis, semantic search, citation-backed AI chat, generated documentation, and structured code reviews β€” all grounded in verified file and line evidence.

Next.js FastAPI Supabase PostgreSQL Deployed on Vercel Deployed on Render


πŸ“– Table of Contents


✨ Features

# Feature Description
πŸ”‘ Authentication Email/password login with optional Google OAuth via Supabase Auth
πŸ—‚οΈ Workspaces User-owned workspaces with full CRUD β€” isolated and secured per user
πŸ“₯ Safe Imports Public GitHub repos (shallow clone) and ZIP files with background progress tracking
πŸ” Static Analysis Deterministic parsing of Python, Java, JavaScript, TypeScript, HTML, CSS, JSON, and Markdown
πŸ“Š Deep Metrics Language, framework, dependency, symbol, route, test, and documentation metrics
πŸ—ΊοΈ Repo Explorer Browse source files with syntax preview and symbol navigation
πŸ”Ž Hybrid Search Keyword, semantic, and reciprocal-rank fusion search powered by pgvector
πŸ’¬ AI Chat Repository chat with selected-file context and citation-verified responses
πŸ“ Doc Generation Auto-generate README, overview, architecture, module, and API documentation
πŸ›‘οΈ Code Reviews Structured reviews grouped by severity with verified file and line references

πŸ› οΈ Tech Stack

Frontend

Technology Role
Next.js 15 + React App framework and routing
TypeScript Type-safe development
Tailwind CSS + shadcn/ui Styling and component system
TanStack Query Server-state management and caching

Backend

Technology Role
FastAPI High-performance async API layer
SQLAlchemy + Alembic ORM and schema migrations
Pydantic Request/response validation

AI & Retrieval

Technology Role
LangChain + LangGraph Controlled AI orchestration workflows
FastEmbed BAAI/bge-small-en-v1.5 Local embeddings
Ollama / Groq Local and hosted LLM inference
pgvector Vector similarity search in PostgreSQL

Infrastructure

Technology Role
Supabase Auth (JWT) + PostgreSQL hosting
Vercel Frontend hosting
Render Backend hosting via render.yaml blueprint

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Next.js Browser Application    β”‚
β”‚  (Supabase Auth β€” JWT token only)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚  Verified Supabase Access Token
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     FastAPI β€” Auth & Ownership      β”‚
β”‚     (JWT verify + user scope)       β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚              β”‚              β”‚
     β–Ό              β–Ό              β–Ό
Supabase       Safe Repo       Ollama (local)
PostgreSQL     Storage &       Groq (hosted)
+ pgvector     Analysis

Key principle: The browser touches Supabase only for authentication. Every application-data request goes through FastAPI, which verifies JWT signatures and enforces per-user workspace ownership before reading or writing any data.


πŸ“ Project Structure

devpilot-ai/
β”œβ”€β”€ frontend/          # Next.js 15 application (Vercel)
β”‚   β”œβ”€β”€ app/           # App Router pages and layouts
β”‚   β”œβ”€β”€ components/    # Reusable UI components
β”‚   └── .env.example   # Frontend env template
β”œβ”€β”€ backend/           # FastAPI application (Render)
β”‚   β”œβ”€β”€ app/           # API routes, services, models
β”‚   β”œβ”€β”€ migrations/    # Alembic migration scripts
β”‚   └── .env.example   # Backend env template
β”œβ”€β”€ render.yaml        # Render deployment blueprint
└── README.md

⚑ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 20+
  • PostgreSQL with pgvector extension (or Supabase project)
  • Ollama for local AI inference

1️⃣ Backend Setup

cd backend

# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"

# Configure environment
Copy-Item .env.example .env
# Edit .env with your Supabase and database credentials

# Run database migrations
.\.venv\Scripts\python.exe -m alembic upgrade head

# Start the API server
.\.venv\Scripts\python.exe -m uvicorn app.main:app --reload --port 8000

API will be live at http://localhost:8000
Health checks: /api/v1/health/live Β· /api/v1/health/ready


2️⃣ Frontend Setup

cd frontend

npm install

# Configure environment
Copy-Item .env.example .env.local
# Edit .env.local with your Supabase and API URLs

npm run dev

App will be live at http://localhost:3000


3️⃣ Local AI (Ollama)

ollama pull llama3.1:8b
ollama serve

Set AI_PROVIDER=ollama in backend/.env for local inference.
Switch to AI_PROVIDER=groq with a GROQ_API_KEY for hosted inference.


πŸ” Environment Variables

Frontend (frontend/.env.local)

Variable Description
NEXT_PUBLIC_SUPABASE_URL Your Supabase project URL
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY Supabase anon/publishable key β€” never use service-role here
NEXT_PUBLIC_API_BASE_URL FastAPI origin, without trailing /api/v1

Backend (backend/.env)

Variable Description
DATABASE_URL SQLAlchemy PostgreSQL connection string
SUPABASE_URL JWT issuer and JWKS endpoint
FRONTEND_ORIGIN Exact frontend origin for CORS
AI_PROVIDER ollama (local) or groq (hosted)
GROQ_API_KEY Groq API secret β€” backend only, never exposed to client
OLLAMA_BASE_URL Ollama server URL (default: http://localhost:11434)
OLLAMA_MODEL Model tag to use (e.g. llama3.1:8b)
WORKSPACE_STORAGE_ROOT Directory where imported repos are stored
FASTEMBED_MODEL Embedding model identifier
EMBEDDING_DIMENSION Must match the chosen model's output dimension

πŸ“„ Full documentation for every variable is in backend/.env.example and frontend/.env.example.


πŸ—„οΈ Database & Auth

Alembic manages all schema changes. The migration history creates:

  • Profiles β€” linked to Supabase Auth users
  • Workspaces β€” user-owned repository containers
  • Import Jobs β€” background import progress tracking
  • Repository Metadata β€” parsed analysis results
  • Vector Chunks β€” embeddings for semantic search (pgvector)
  • Conversations & Messages β€” chat history with citations
  • Generated Documents β€” AI-produced documentation artifacts
  • Code Reviews β€” structured severity-grouped review results

Current migration head: 20260730_10

Hosting tip: Use the Supabase Session Pooler URL for IPv4-compatible hosted database access. Set the production Site URL and /auth/callback redirect in Supabase Auth settings.


πŸ”’ Security Design

DevPilot AI is designed with a zero-execution, evidence-grounded security model:

  • 🚫 No code execution β€” imported code and its dependencies are never run
  • πŸ”— Safe Git imports β€” shallow, public-only, non-interactive; submodules and symlinks are rejected
  • πŸ“¦ Safe ZIP imports β€” path traversal, symlinks, encrypted/nested archives, and oversized content are all rejected
  • πŸ™ˆ Sensitive file exclusion β€” .env, key/certificate files, binaries, and archives are excluded from analysis and AI context
  • βœ… Full JWT verification β€” FastAPI verifies Supabase JWT signatures, issuer, audience, expiry, and authenticated role on every request
  • πŸ‘€ Per-user scoping β€” all workspace and artifact queries are filtered to the authenticated owner
  • πŸ” Untrusted AI context β€” repository content is wrapped as untrusted evidence in prompts; model output is never trusted for file paths or line numbers
  • πŸ”‘ Secrets hygiene β€” secrets live only in ignored local files or hosting dashboards, never in source code

πŸ§ͺ Testing

Backend

cd backend

# Linting
.\.venv\Scripts\python.exe -m ruff check app tests --no-cache

# Type checking
.\.venv\Scripts\python.exe -m mypy app --cache-dir nul

# Unit & integration tests
.\.venv\Scripts\python.exe -m pytest -q

Frontend

cd frontend

npm run lint
npm run typecheck -- --incremental false
npm test -- --run
npm run build

Coverage includes: auth failures, ownership enforcement, safe imports, parsers, file containment, pgvector retrieval, chat citations, document generation, code reviews, and frontend user flows.


πŸš€ Deployment

🌐 Live Deployment

Service URL
Frontend (Vercel) https://devpilot-ai-gamma.vercel.app
Backend (Render) https://devpilot-ai-owr2.onrender.com
API Docs https://devpilot-ai-owr2.onrender.com/docs

Frontend β†’ Vercel

  1. Import frontend/ as a Next.js project in Vercel
  2. Add all NEXT_PUBLIC_* environment variables in the Vercel dashboard
  3. Set NEXT_PUBLIC_API_BASE_URL to your Render backend URL

Backend β†’ Render

  1. Connect this repository to Render and select the Blueprint option using render.yaml
  2. Add all backend environment variables in the Render dashboard
  3. Set FRONTEND_ORIGIN to your production Vercel URL
  4. Configure the same origin in Supabase Auth β†’ URL Configuration

⚠️ Known Limitations

  • Only public GitHub repositories and ZIP files are supported
  • Imported repositories are intentionally never built or executed
  • Google OAuth requires manual setup in both Google Cloud Console and Supabase Auth
  • Groq requires a user-provided API key; Ollama is the free local default
  • Render's free tier filesystem is ephemeral β€” hosted source files may disappear after sleep or redeploy; local use is more reliable
  • The built-in Markdown viewer supports common formatting from the documentation workflow, not every Markdown extension
  • This is a student demonstration project, not a production-grade multi-tenant service

Built with ❀️ as a final-year project · GitHub · Live Demo

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages