Repository Overview
Backend Structure
The backend is a FastAPI application with Modal serverless containers for parallel processing.Directory Layout
Key Files
server.py - Main API Server
server.py - Main API Server
GET /- API informationGET /health- Health checkPOST /auth/github- GitHub OAuth token exchangeGET /auth/me- Get current userPOST /update- Process repository (main workflow)WebSocket /ws- Real-time updates
/update endpoint):backend/server.py:141 - /update endpointconfig.py - Configuration Management
config.py - Configuration Management
backend/config.py:12auth.py - Authentication Service
auth.py - Authentication Service
exchange_github_code()- Exchange OAuth code for GitHub tokencreate_access_token()- Create JWT for API authenticationverify_token()- Verify and decode JWT tokensget_current_user()- FastAPI dependency for protected routes
backend/auth.py:20containers.py - File Analysis Container
containers.py - File Analysis Container
groq-readFunction: run_script(repo_url: str) -> list[CodeChange]Workflow:.css, .json, .md, .svg, hidden files, and .git/Location: backend/containers.py:18modal_write.py - Code Refactoring Container
modal_write.py - Code Refactoring Container
groq-writeFunction: process_file(job) -> dictConfiguration:- Timeout: 300 seconds (5 minutes per file)
- Max containers: 100 (parallel processing)
- Min containers: 3 (kept warm)
- Model: llama-3.3-70b-versatile
backend/modal_write.py:33git_driver.py - Git Operations
git_driver.py - Git Operations
create_fork(repo_owner, repo_name) - git_driver.py:11- Check if user owns the repository
- Create fork if needed (or return existing fork)
- Returns repository info with
is_own_repoflag
load_repository(repo_path) - git_driver.py:88- Load Git repository from path
- Get origin remote and URL
create_and_push_branch(repo, origin, files) - git_driver.py:114- Create unique branch name (
dependify-{uuid}) - Stage and commit changes
- Push to remote with authentication
create_pull_request(...) - git_driver.py:182- Generate PR title and description
- Create PR from fork to original repo (or within same repo)
- Include AI-generated changelog
- Return PR URL
- Authentication: Personal access token
- Required scope:
repo(full repository access)
checker.py - File Analysis Logic
checker.py - File Analysis Logic
get_all_files_recursively(root_directory) - checker.py:59- Recursively walk directory tree
- Return all file paths
analyze_file_with_llm(file_path) - checker.py:71- Read file content
- Query Groq AI to detect outdated syntax
- Update Supabase with progress
- Return
CodeChangePydantic model
fetch_updates(directory) - checker.py:136- Iterate through all files
- Skip excluded extensions
- Analyze each file with LLM
- Return list of files needing updates
llama-3.1-8b-instant (fast analysis)Location: backend/checker.py:71validators.py - Code Validation
validators.py - Code Validation
SyntaxValidator.detect_language(file_path)- Detect programming language from file extension
- Support for .js, .jsx, .ts, .tsx, .py, etc.
validate_and_score(file_path, old_code, new_code)- Parse code syntax (JavaScript, TypeScript, Python)
- Check for syntax errors
- Calculate confidence score based on:
- Syntax validity (40%)
- Code length similarity (20%)
- Line count difference (20%)
- Structural changes (20%)
- 80-100: High confidence
- 60-79: Medium confidence
- 0-59: Low confidence
backend/validators.pychangelog_formatter.py - Changelog Generation
changelog_formatter.py - Changelog Generation
format_file_change(file_path, old_code, new_code, ...)- Calculate diff statistics (lines added/removed)
- Extract key changes using AI
- Return
FileChangeobject
generate_pr_description(file_changes)- Aggregate all file changes
- Generate markdown PR description
- Include summary, file-by-file breakdown, stats
backend/changelog_formatter.pyFrontend Structure
The frontend is a Next.js 15 application with React 19 and Tailwind CSS.Directory Layout
Key Files
app/page.tsx - Landing Page
app/page.tsx - Landing Page
FeaturesShowcase- Highlight key featuresGradientCanvas- Animated background- Call-to-action buttons
/login for authenticationLocation: frontend/src/app/page.tsxapp/login/page.tsx - Login Page
app/login/page.tsx - Login Page
frontend/src/app/login/page.tsxapp/auth/callback/page.tsx - OAuth Callback
app/auth/callback/page.tsx - OAuth Callback
frontend/src/app/auth/callback/page.tsxcomponents/MainDash.tsx - Main Dashboard
components/MainDash.tsx - Main Dashboard
- Repository URL input with validation
- Start analysis button
- Real-time progress updates via Supabase
- Display PR link when complete
frontend/src/components/MainDash.tsxcomponents/RepositoryPage.tsx - Repository Processing
components/RepositoryPage.tsx - Repository Processing
- File list with processing status
- Real-time code changes preview
- Confidence scores and validation results
- PR creation status
frontend/src/components/RepositoryPage.tsxcomponents/LiveCodeCard.tsx - Code Preview
components/LiveCodeCard.tsx - Code Preview
- Syntax highlighting (react-syntax-highlighter)
- Side-by-side diff view
- Confidence score badge
- Explanation text
frontend/src/components/LiveCodeCard.tsxapp/lib/supabaseClient.ts - Supabase Setup
app/lib/supabaseClient.ts - Supabase Setup
repo-updates tableLocation: frontend/src/app/lib/supabaseClient.tsData Flow
Here’s how data flows through Dependify from start to finish:User Authentication
- User clicks “Continue with GitHub”
- Redirected to GitHub for authorization
- GitHub redirects back with code
- Frontend sends code to backend
- Backend exchanges code for GitHub token
- Backend creates JWT token
- Frontend stores JWT in localStorage
Repository Submission
- User pastes GitHub repository URL
- Frontend validates URL format
- Sends request to backend with JWT
- Backend creates staging directory
File Analysis
- Backend calls Modal
run_script()function - Modal container clones repository
- Scans all files recursively
- Each file analyzed with Groq AI (llama-3.1-8b-instant)
- Returns list of files needing updates
- Updates Supabase with progress
Code Refactoring (Parallel)
- Backend calls Modal
process_file()for each file - Up to 100 files processed in parallel
- Each container:
- Receives file content
- Refactors with Groq AI (llama-3.3-70b-versatile)
- Validates syntax
- Calculates confidence score
- Generates changelog
- Updates Supabase
- Returns all refactored files
Git Operations
- Check if user owns repository
- Create fork if needed (or use original)
- Clone repository with authentication
- Create unique branch (
dependify-{uuid}) - Write refactored code to files
- Stage, commit, and push changes
Pull Request Creation
- Generate AI-explained changelog
- Format PR description with file changes
- Create PR via GitHub API
- Return PR URL to frontend
Key Technologies
FastAPI
backend/server.pyModal
backend/containers.py, backend/modal_write.pyGroq
Next.js 15
frontend/src/app/Supabase
GitPython
backend/git_driver.py