A full-stack application that automatically backs up and mirrors your GitHub repositories with an exact GitHub UI replica. Built with React, FastAPI, SQLAlchemy, and PostgreSQL.
- GitHub OAuth Integration - Seamlessly connect your GitHub account
- Repository Mirroring - Full git clone --mirror for complete history preservation
- Metadata Sync - Automatically sync issues, pull requests, and comments using GitHub API
- Recurring Backups - Automatic sync every 6 hours (configurable)
- Background Workers - Celery + Redis for long-running sync jobs
- GitHub UI Replica - Pixel-perfect match of GitHub's dark theme
- Dashboard - Repository listing with sync status
- Repository Detail - File tree, README, branches, commits
- Issues & PRs - Browse and filter with state filtering
- Sync Monitoring - Track sync history and logs
- Responsive Design - Mobile-friendly interface
- RESTful API - Complete REST endpoints for all operations
- SQLAlchemy ORM - Type-safe database models with JSONB fields
- PostgreSQL - Robust relational database with JSON support
- Celery Tasks - Async job processing for clones and syncs
- JWT Authentication - Secure token-based auth
github-clone-backup/
├── client/ # React frontend
│ ├── src/
│ │ ├── pages/ # Page components
│ │ ├── components/ # Reusable UI components
│ │ ├── contexts/ # Auth context
│ │ ├── lib/
│ │ │ ├── api.ts # API client
│ │ │ └── utils.ts # Utilities
│ │ └── index.css # GitHub dark theme
│ └── vite.config.ts
│
├── backend/ # FastAPI backend
│ ├── app.py # Main FastAPI app
│ ├── models.py # SQLAlchemy models
│ ├── database.py # DB configuration
│ ├── config.py # Environment config
│ ├── celery_config.py # Celery setup
│ ├── tasks.py # Background tasks
│ ├── routes/ # API route handlers
│ │ ├── auth.py
│ │ ├── repositories.py
│ │ ├── issues.py
│ │ ├── prs.py
│ │ └── sync.py
│ └── requirements.txt
│
└── README.md
- React 19 - UI framework
- Vite - Build tool
- Tailwind CSS 4 - Styling
- Lucide React - Icons
- shadcn/ui - Component library
- Wouter - Routing
- FastAPI - Web framework
- SQLAlchemy - ORM
- PostgreSQL - Database
- Celery - Task queue
- Redis - Message broker
- GitPython - Git operations
- httpx - Async HTTP client
- PyJWT - Authentication
- Node.js 18+
- Python 3.9+
- PostgreSQL 12+
- Redis 6+
- Frontend Setup
cd client
pnpm install
pnpm dev- Backend Setup
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Environment Variables
Create
.envin backend directory:
DATABASE_URL=postgresql://user:password@localhost:5432/github_backup
GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret
JWT_SECRET=your-secret-key
REDIS_URL=redis://localhost:6379/0
- Run Backend
python app.py- Run Celery Worker (in another terminal)
celery -A celery_config worker --loglevel=info- Run Celery Beat (for scheduled tasks)
celery -A celery_config beat --loglevel=info-
Create PostgreSQL Database
- Add PostgreSQL database in Render dashboard
- Copy connection string to
DATABASE_URL
-
Create Redis Instance
- Add Redis in Render dashboard
- Copy connection string to
REDIS_URL
-
Deploy Backend
- Connect GitHub repository
- Set environment variables
- Deploy with
python app.pyas start command
-
Deploy Frontend
- Build:
pnpm build - Set
VITE_API_URLto backend URL - Deploy to Render or Vercel
- Build:
POST /api/auth/github/login- Get GitHub OAuth URLGET /api/auth/callback- OAuth callback handlerGET /api/auth/me- Get current userPOST /api/auth/logout- LogoutPOST /api/auth/refresh-token- Refresh JWT
GET /api/repositories- List repositoriesGET /api/repositories/{id}- Get repository detailsPOST /api/repositories/sync-from-github- Fetch from GitHub
GET /api/issues- List issuesGET /api/issues/{id}- Get issue detailsGET /api/issues/repository/{repo_id}- Repository issues
GET /api/pull-requests- List PRsGET /api/pull-requests/{id}- Get PR detailsGET /api/pull-requests/repository/{repo_id}- Repository PRs
GET /api/sync/status- Overall sync statusGET /api/sync/logs- Sync logsPOST /api/sync/repository/{repo_id}/trigger- Trigger syncGET /api/sync/repository/{repo_id}/last-sync- Last sync info
- id (PK)
- github_id (unique)
- github_username
- email
- name
- avatar_url
- access_token (encrypted)
- created_at
- updated_at
- last_synced_at- id (PK)
- user_id (FK)
- github_id (unique)
- name
- full_name
- description
- language
- stars, forks, watchers
- is_private
- clone_url
- local_path
- sync_status (enum)
- synced_at
- raw_data (JSONB)- id (PK)
- repository_id (FK)
- github_id (unique)
- number
- title, body
- state
- author, author_id
- created_at, updated_at, closed_at
- raw_data (JSONB)- id (PK)
- repository_id (FK)
- github_id (unique)
- number
- title, body
- state
- author, author_id
- source_branch, target_branch
- created_at, updated_at, closed_at, merged_at
- raw_data (JSONB)- id (PK)
- user_id (FK)
- repository_id (FK)
- sync_type (clone|metadata|full)
- status (pending|in_progress|success|failed)
- started_at, completed_at
- duration_seconds
- items_processed, items_failed
- message- sync_all_repositories - Every 6 hours
- cleanup_old_sync_logs - Daily at 2 AM UTC
sync_repository_clone- Git mirror clonesync_repository_metadata- Fetch issues/PRs
The frontend is a pixel-perfect replica of GitHub's dark theme:
- Colors: GitHub's exact color palette (#0d1117, #1f6feb, #c9d1d9, etc.)
- Typography: System fonts matching GitHub
- Components: Buttons, cards, tabs matching GitHub's design
- Interactions: Smooth transitions and hover states
- Responsive: Mobile-first design with breakpoints
- JWT Authentication - Secure token-based auth
- Encrypted Tokens - GitHub access tokens encrypted in database
- HTTPS Only - All communications encrypted
- CORS - Configured for frontend domain
- SQL Injection Prevention - SQLAlchemy parameterized queries
- Rate Limiting - GitHub API rate limit handling
- Async Operations - Celery for non-blocking tasks
- Database Indexing - Optimized queries
- Caching - Redis for session management
- Pagination - Efficient data retrieval
- JSONB Fields - Flexible schema with full API payloads
- Sync Logs - Complete history of all sync operations
- Error Tracking - Failed syncs with error messages
- Performance Metrics - Sync duration and item counts
- User Activity - Last sync times and status
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - See LICENSE file for details
For issues and questions:
- GitHub Issues: [Create an issue]
- Email: support@githubbackup.local
- Webhook support for real-time sync
- Scheduled backups to cloud storage (S3, GCS)
- Repository search and filtering
- Contribution graph visualization
- Release management
- Wiki page backup
- Discussions backup
- Custom sync schedules per repository
- Backup export/import
- Team collaboration features