Skip to content

Commit d1db8c3

Browse files
authored
Merge pull request #230 from DevanshuNEU/feat/github-oauth-import
feat: GitHub OAuth one-click repo import
2 parents 5604d28 + f7d75f7 commit d1db8c3

11 files changed

Lines changed: 1436 additions & 20 deletions

File tree

backend/.env.example

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,88 @@
1-
# API Keys
1+
# =============================================================================
2+
# OpenCodeIntel Backend Environment Variables
3+
# =============================================================================
4+
5+
# -----------------------------------------------------------------------------
6+
# AI & Search APIs
7+
# -----------------------------------------------------------------------------
8+
9+
# OpenAI - for embeddings and AI features
210
OPENAI_API_KEY=your_openai_api_key_here
11+
12+
# Pinecone - vector database for semantic search
313
PINECONE_API_KEY=your_pinecone_api_key_here
414
PINECONE_INDEX_NAME=codeintel
515

6-
# Search V2 - Cohere Reranking (optional but recommended)
16+
# Cohere - reranking for search quality (optional but recommended)
717
COHERE_API_KEY=your_cohere_api_key_here
818

9-
# Supabase
19+
# Voyage AI - code-specific embeddings (recommended for code search)
20+
# Get API key from https://dash.voyageai.com/
21+
VOYAGE_API_KEY=your_voyage_api_key_here
22+
23+
# -----------------------------------------------------------------------------
24+
# Supabase - Authentication & Database
25+
# -----------------------------------------------------------------------------
26+
1027
SUPABASE_URL=https://your-project.supabase.co
1128
SUPABASE_ANON_KEY=your_supabase_anon_key_here
1229
SUPABASE_JWT_SECRET=your_jwt_secret_here
1330

14-
# Backend API
31+
# Service role key - required for server-side database access (e.g., storing GitHub tokens)
32+
# Get from Supabase Dashboard → Settings → API → service_role key
33+
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key_here
34+
35+
# -----------------------------------------------------------------------------
36+
# GitHub OAuth - One-Click Repo Import Feature
37+
# -----------------------------------------------------------------------------
38+
# IMPORTANT: This is SEPARATE from Supabase GitHub login!
39+
#
40+
# Supabase login uses its own OAuth app (configured in Supabase Dashboard).
41+
# This OAuth app is ONLY for importing repositories from GitHub.
42+
#
43+
# Setup:
44+
# 1. Go to GitHub → Settings → Developer settings → OAuth Apps → New OAuth App
45+
# 2. Create app with name like "YourApp Repo Import"
46+
# 3. Set callback URL based on environment:
47+
# - Development: http://localhost:3000/github/callback
48+
# - Production: https://yourdomain.com/github/callback
49+
# 4. Copy Client ID and generate Client Secret
50+
#
51+
# You may need separate OAuth apps for dev and production (different callback URLs)
52+
53+
GITHUB_CLIENT_ID=your_github_oauth_app_client_id
54+
GITHUB_CLIENT_SECRET=your_github_oauth_app_client_secret
55+
56+
# Must match EXACTLY what you set in GitHub OAuth App settings
57+
GITHUB_REDIRECT_URI=http://localhost:3000/github/callback
58+
59+
# Frontend URL for redirects after OAuth
60+
FRONTEND_URL=http://localhost:3000
61+
62+
# -----------------------------------------------------------------------------
63+
# Backend Configuration
64+
# -----------------------------------------------------------------------------
65+
1566
BACKEND_API_URL=http://localhost:8000
1667
API_KEY=dev-secret-key
1768

18-
# CORS Configuration (Security)
69+
# CORS - allowed frontend origins (comma-separated for multiple)
1970
ALLOWED_ORIGINS=http://localhost:3000
2071

21-
# Redis Cache
72+
# -----------------------------------------------------------------------------
73+
# Redis Cache (Optional)
74+
# -----------------------------------------------------------------------------
75+
2276
REDIS_HOST=localhost
2377
REDIS_PORT=6379
2478

25-
# Sentry Error Tracking (Optional)
79+
# -----------------------------------------------------------------------------
80+
# Monitoring & Debugging
81+
# -----------------------------------------------------------------------------
82+
83+
# Sentry error tracking (optional)
2684
# Get DSN from https://sentry.io → Settings → Projects → Client Keys
2785
SENTRY_DSN=
28-
ENVIRONMENT=development
2986

30-
# Search V3 - Voyage AI Code Embeddings (recommended for code search)
31-
# Get API key from https://dash.voyageai.com/
32-
VOYAGE_API_KEY=your_voyage_api_key_here
87+
# Environment identifier
88+
ENVIRONMENT=development

backend/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from routes.api_keys import router as api_keys_router
2828
from routes.users import router as users_router
2929
from routes.search_v2 import router as search_v2_router
30+
from routes.github import router as github_router
3031
from routes.ws_playground import websocket_playground_index
3132
from routes.ws_repos import websocket_repo_indexing
3233

@@ -92,6 +93,7 @@ async def dispatch(self, request: Request, call_next):
9293
app.include_router(api_keys_router, prefix=API_PREFIX)
9394
app.include_router(users_router, prefix=API_PREFIX)
9495
app.include_router(search_v2_router, prefix=API_PREFIX)
96+
app.include_router(github_router, prefix=API_PREFIX)
9597

9698
# WebSocket endpoints (versioned)
9799
app.add_api_websocket_route(f"{API_PREFIX}/ws/index/{{repo_id}}", websocket_index)

0 commit comments

Comments
 (0)