An AI-powered software project comparison platform that allows users to upload two versions of the same project, compare them visually, analyze code changes, classify the modifications, and generate human-readable summaries.
- Authentication: Firebase-based email/password authentication
- Project Upload: Upload two project versions as ZIP files
- File Processing: Extract and scan project files with intelligent ignoring of unnecessary files
- Diff Engine: Compare old and new projects file-by-file
- AI Analysis: Gemini-powered analysis for technical summaries, classifications, and impact assessment
- Visual Diff: Side-by-side code comparison viewer
- Comparison History: Save and revisit previous comparisons
- Report Export: Export comparison reports as HTML or text
- React 18 with TypeScript
- Tailwind CSS
- shadcn/ui components
- Zustand for state management
- React Router for navigation
- Firebase SDK for authentication
- Node.js with Express
- TypeScript
- Firebase Admin SDK
- Gemini AI API for code analysis
- adm-zip for ZIP extraction
- diff library for text comparison
CodeCompareAI/
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/
│ │ │ ├── ui/ # shadcn/ui components
│ │ │ └── layout/ # Layout components
│ │ ├── pages/ # Page components
│ │ ├── stores/ # Zustand stores
│ │ ├── services/ # API services
│ │ ├── types/ # TypeScript types
│ │ └── lib/ # Library configs
│ └── ...
├── backend/ # Express backend API
│ ├── src/
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Express middleware
│ │ ├── utils/ # Utilities
│ │ └── config/ # Configuration
│ └── ...
├── SPEC.md # Technical specification
└── README.md # This file
- Node.js 18+
- npm or yarn
- Firebase project (with Firestore, Authentication, and Storage enabled)
- Gemini API key
# Clone the repository
cd CodeCompareAI
# Install root dependencies
npm install
# Install frontend dependencies
cd frontend && npm install
cd ..
# Install backend dependencies
cd backend && npm install
cd ..-
Create a Firebase project at console.firebase.google.com
-
Enable the following services:
- Authentication: Enable Email/Password provider
- Firestore: Create a database (start in test mode for development)
- Storage: Create a storage bucket (start in test mode for development)
-
Get your Firebase configuration:
- Go to Project Settings > General > Your apps
- Add a Web app and copy the configuration
-
Generate a private key for the backend:
- Go to Project Settings > Service accounts
- Click "Generate new private key"
- Save the JSON file (you'll need it for the backend)
- Get a Gemini API key from Google AI Studio
Create environment files in both frontend and backend:
Frontend (.env)
cd frontend
cp .env.example .envEdit frontend/.env:
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_API_URL=http://localhost:3001/apiBackend (.env)
cd backend
cp .env.example .envEdit backend/.env:
PORT=3001
NODE_ENV=development
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_CLIENT_EMAIL=your_client_email
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
GEMINI_API_KEY=your_gemini_api_key
ALLOWED_ORIGINS=http://localhost:5173
MAX_FILE_SIZE=104857600For development/testing, use permissive rules. For production, configure proper rules.
Firestore Rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
match /comparisons/{comparisonId} {
allow read, write: if request.auth != null && request.auth.uid == resource.data.userId;
}
match /comparison_files/{fileId} {
allow read, write: if request.auth != null;
}
}
}
Storage Rules:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /projects/{userId}/{comparisonId}/{fileName} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}
From the root directory:
npm run devThis will start both frontend and backend concurrently:
- Frontend: http://localhost:5173
- Backend: http://localhost:3001
Frontend only:
cd frontend
npm run devBackend only:
cd backend
npm run dev# Build both
npm run build
# Or individually
cd frontend && npm run build
cd backend && npm run buildPOST /api/auth/register- Register new userPOST /api/auth/login- Login with Firebase tokenPOST /api/auth/logout- LogoutGET /api/auth/me- Get current user
POST /api/comparisons- Create new comparisonGET /api/comparisons- List user's comparisonsGET /api/comparisons/:id- Get comparison detailsDELETE /api/comparisons/:id- Delete comparisonPOST /api/comparisons/:id/upload- Upload ZIP filesPOST /api/comparisons/:id/analyze- Start analysisGET /api/comparisons/:id/status- Get analysis statusGET /api/comparisons/:id/files- List comparison filesGET /api/comparisons/:id/files/:fileId- Get file detailsGET /api/comparisons/:id/files/:fileId/diff- Get file diffPOST /api/comparisons/:id/export- Export report
- Register/Login: Create an account or login
- Create Comparison: Click "New Comparison" and enter a title
- Upload Files: Drag and drop ZIP files for old and new versions
- Analyze: Wait for processing and AI analysis
- View Results: Browse files, view diffs, read AI summaries
- Export: Download HTML or text reports
- UI/UX: User interface and visual elements
- Functionality: Core business logic and features
- Architecture: Structural changes and design patterns
- Config: Configuration files and dependencies
- Documentation: README and documentation files
- Other: Uncategorized changes
The following patterns are automatically ignored during comparison:
node_modules/**.git/**dist/**,build/**,.next/**- Binary files (images, videos, fonts, etc.)
- Lock files and logs
- OS-specific files (
.DS_Store,Thumbs.db)
Ensure ALLOWED_ORIGINS in backend .env includes your frontend URL.
- Verify Firebase config is correct
- Check that Authentication is enabled in Firebase console
- Ensure the email/password sign-in method is enabled
- Verify the API key is correct
- Check API quotas and billing
- Ensure the API is enabled for your project
- Check file size limits (default 100MB)
- Ensure file is a valid ZIP
- Verify Firebase Storage is properly configured
MIT
Nadeem Dayoub CubeCode Studio
"Understand code changes like a human, not just a machine."