Skip to main content
This guide explains Dependify’s codebase structure, key files, and how data flows through the system from repository analysis to PR creation.

Repository Overview

Dependify2.0/
├── backend/           # FastAPI server and Modal containers
├── frontend/          # Next.js 15 application
├── README.md          # Project overview and setup
└── render.yaml        # Render deployment configuration

Backend Structure

The backend is a FastAPI application with Modal serverless containers for parallel processing.

Directory Layout

backend/
├── server.py                 # Main FastAPI application
├── config.py                 # Environment configuration
├── auth.py                   # GitHub OAuth and JWT auth
├── containers.py             # Modal container for file analysis
├── modal_write.py            # Modal container for code refactoring
├── git_driver.py             # Git operations (fork, clone, push, PR)
├── checker.py                # File analysis with Groq AI
├── validators.py             # Code validation and confidence scoring
├── changelog_formatter.py    # PR description generation
├── socket_manager.py         # WebSocket connection management
├── requirements.txt          # Python dependencies
└── website-test/            # Test files

Key Files

Purpose: FastAPI application serving the main APIKey endpoints:
  • GET / - API information
  • GET /health - Health check
  • POST /auth/github - GitHub OAuth token exchange
  • GET /auth/me - Get current user
  • POST /update - Process repository (main workflow)
  • WebSocket /ws - Real-time updates
Main workflow (/update endpoint):
1. Clone repository to staging directory
2. Call containers.py (Modal) to analyze files
3. Call modal_write.py (Modal) to refactor files in parallel
4. Create fork (or use original repo if owned)
5. Apply refactored code to files
6. Create branch and push changes
7. Generate AI-explained changelog
8. Create pull request
9. Clean up staging directory
Rate limiting: 10/minute, 100/hour per IPLocation: backend/server.py:141 - /update endpoint
Purpose: Centralized environment variable managementConfiguration class:
class Config:
    GROQ_API_KEY: str
    SUPABASE_URL: str
    SUPABASE_KEY: str
    GITHUB_TOKEN: str
    GITHUB_CLIENT_ID: str
    GITHUB_CLIENT_SECRET: str
    ANTHROPIC_API_KEY: str  # Optional
    PORT: int = 5001
    FRONTEND_URL: str
    API_SECRET_KEY: str
    RATE_LIMIT_PER_MINUTE: int = 10
    RATE_LIMIT_PER_HOUR: int = 100
Validation: Automatically validates required variables on importLocation: backend/config.py:12
Purpose: Handle GitHub OAuth and JWT token managementKey functions:
  • exchange_github_code() - Exchange OAuth code for GitHub token
  • create_access_token() - Create JWT for API authentication
  • verify_token() - Verify and decode JWT tokens
  • get_current_user() - FastAPI dependency for protected routes
Token expiration: 24 hoursAlgorithm: HS256 (HMAC-SHA256)Location: backend/auth.py:20
Purpose: Modal serverless container for analyzing repository filesModal app: groq-readFunction: run_script(repo_url: str) -> list[CodeChange]Workflow:
1. Clone repository to Modal container
2. Recursively scan all files
3. Analyze each file with Groq (llama-3.1-8b-instant)
4. Identify files with outdated syntax
5. Return list of files needing updates
Filtering: Skips .css, .json, .md, .svg, hidden files, and .git/Location: backend/containers.py:18
Purpose: Manage all Git and GitHub API operationsKey functions: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_repo flag
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
GitHub API usage:
  • Authentication: Personal access token
  • Required scope: repo (full repository access)
Purpose: Core logic for analyzing files with AIKey functions: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 CodeChange Pydantic 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
Model used: llama-3.1-8b-instant (fast analysis)Location: backend/checker.py:71
Purpose: Validate refactored code syntax and calculate confidence scoresKey functions: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%)
Confidence levels:
  • 80-100: High confidence
  • 60-79: Medium confidence
  • 0-59: Low confidence
Location: backend/validators.py
Purpose: Generate AI-explained changelogs for pull requestsKey functions:format_file_change(file_path, old_code, new_code, ...)
  • Calculate diff statistics (lines added/removed)
  • Extract key changes using AI
  • Return FileChange object
generate_pr_description(file_changes)
  • Aggregate all file changes
  • Generate markdown PR description
  • Include summary, file-by-file breakdown, stats
PR format:
## Summary
- Key change 1
- Key change 2

## Files Changed (X files)

### `path/to/file.js`
**Changes**: Lines +X/-Y | Confidence: XX%

**What changed**:
- Change description

## Quality Metrics
- Average confidence: XX%
- All files validated: ✅/⚠️
Location: backend/changelog_formatter.py

Frontend Structure

The frontend is a Next.js 15 application with React 19 and Tailwind CSS.

Directory Layout

frontend/
├── src/
│   ├── app/                      # Next.js app router
│   │   ├── page.tsx             # Home page (landing)
│   │   ├── login/page.tsx       # Login page
│   │   ├── auth/callback/       # OAuth callback handler
│   │   ├── test/page.tsx        # Test page for development
│   │   ├── layout.tsx           # Root layout
│   │   ├── globals.css          # Global styles
│   │   └── lib/
│   │       └── supabaseClient.ts # Supabase client setup
│   ├── components/              # React components
│   │   ├── MainDash.tsx         # Main dashboard
│   │   ├── RepositoryPage.tsx   # Repository processing UI
│   │   ├── LiveCodeCard.tsx     # Real-time code preview
│   │   ├── MultiFileCodeCard.tsx # Multi-file diff viewer
│   │   ├── FeaturesShowcase.tsx # Landing page features
│   │   ├── GradientCanvas.tsx   # Animated background
│   │   └── ui/                  # shadcn/ui components
│   │       ├── button.tsx
│   │       ├── card.tsx
│   │       ├── badge.tsx
│   │       └── ...
│   ├── models/                  # TypeScript types
│   │   └── Repository.ts        # Repository data models
│   └── lib/
│       └── utils.ts             # Utility functions
├── public/                       # Static assets
│   ├── *.svg                    # Icons and graphics
│   └── pou-transparent-cropped.png
├── package.json                 # Dependencies
├── tsconfig.json                # TypeScript config
├── next.config.ts               # Next.js configuration
└── tailwind.config.ts           # Tailwind CSS config

Key Files

Purpose: Main landing page with features showcaseComponents used:
  • FeaturesShowcase - Highlight key features
  • GradientCanvas - Animated background
  • Call-to-action buttons
Navigation: Links to /login for authenticationLocation: frontend/src/app/page.tsx
Purpose: GitHub OAuth authenticationFlow:
1. User clicks "Continue with GitHub"
2. Redirect to GitHub OAuth:
   https://github.com/login/oauth/authorize
   ?client_id=...
   &redirect_uri=.../auth/callback
   &scope=repo
3. GitHub redirects to callback with code
Location: frontend/src/app/login/page.tsx
Purpose: Handle GitHub OAuth callbackFlow:
1. Receive code from GitHub
2. Send code to backend POST /auth/github
3. Receive JWT token and user info
4. Store token in localStorage
5. Redirect to dashboard
Location: frontend/src/app/auth/callback/page.tsx
Purpose: Main application dashboard after loginFeatures:
  • Repository URL input with validation
  • Start analysis button
  • Real-time progress updates via Supabase
  • Display PR link when complete
Supabase subscription:
supabase
  .channel('repo-updates')
  .on('postgres_changes', 
      { event: 'INSERT', schema: 'public', table: 'repo-updates' },
      (payload) => {
        // Update UI with progress
      }
  )
  .subscribe();
Location: frontend/src/components/MainDash.tsx
Purpose: Display repository analysis and refactoring progressFeatures:
  • File list with processing status
  • Real-time code changes preview
  • Confidence scores and validation results
  • PR creation status
API call:
const response = await fetch(`${API_URL}/update`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    repository: repoUrl,
    repository_owner: owner,
    repository_name: name
  })
});
Location: frontend/src/components/RepositoryPage.tsx
Purpose: Display before/after code comparisonFeatures:
  • Syntax highlighting (react-syntax-highlighter)
  • Side-by-side diff view
  • Confidence score badge
  • Explanation text
Location: frontend/src/components/LiveCodeCard.tsx
Purpose: Initialize Supabase client for real-time updatesConfiguration:
import { createClient } from '@supabase/supabase-js';

const supabase = createClient(
  process.env.NEXT_PUBLIC_SUPABASE_URL!,
  process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
);
Usage: Real-time subscriptions to repo-updates tableLocation: frontend/src/app/lib/supabaseClient.ts

Data Flow

Here’s how data flows through Dependify from start to finish:
1

User Authentication

User → Frontend → GitHub OAuth → Backend /auth/github → JWT Token → Frontend
  • 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
2

Repository Submission

Frontend → Backend POST /update → staging directory
  • User pastes GitHub repository URL
  • Frontend validates URL format
  • Sends request to backend with JWT
  • Backend creates staging directory
3

File Analysis

Backend → Modal containers.py → Groq AI → List of outdated files
  • 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
4

Code Refactoring (Parallel)

Backend → Modal modal_write.py (100 parallel containers) → Refactored code
  • 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
5

Git Operations

Backend → GitHub API (fork) → Git clone → Apply changes → Push branch
  • 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
6

Pull Request Creation

Backend → Generate changelog → GitHub API (create PR) → PR URL
  • Generate AI-explained changelog
  • Format PR description with file changes
  • Create PR via GitHub API
  • Return PR URL to frontend
7

Real-time Updates

Backend/Modal → Supabase INSERT → Supabase Realtime → Frontend subscription
  • Backend and Modal containers insert progress updates
  • Supabase broadcasts changes via WebSocket
  • Frontend receives updates in real-time
  • UI updates with current status

Key Technologies

FastAPI

High-performance async API frameworkLocation: backend/server.py

Modal

Serverless containers for parallel processingLocation: backend/containers.py, backend/modal_write.py

Groq

Lightning-fast AI inferenceModels: llama-3.1-8b-instant, llama-3.3-70b-versatile

Next.js 15

React framework with app routerLocation: frontend/src/app/

Supabase

Real-time PostgreSQL databaseUsage: Progress updates, subscriptions

GitPython

Python library for Git operationsLocation: backend/git_driver.py

Next Steps

Setup Guide

Set up local development environment

Contributing

Start contributing to the codebase

Environment Variables

Configure your environment

Deployment

Deploy to production

Build docs developers (and LLMs) love