Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
729059f
feat: GitHub OAuth one-click repo import
DevanshuNEU Jan 28, 2026
1e046a2
docs: improve .env.example with GitHub OAuth setup guide
DevanshuNEU Jan 28, 2026
da59951
fix(github): use proper ISO timestamp instead of literal 'now()' string
DevanshuNEU Jan 28, 2026
b318b2b
fix(github): add exception handling to get_user method
DevanshuNEU Jan 28, 2026
ecf37db
fix(ui): show warning toast when indexing fails to start
DevanshuNEU Jan 28, 2026
719c01b
fix(oauth): prevent double-execution and memory leaks in callback page
DevanshuNEU Jan 28, 2026
1559f1d
fix(hooks): stabilize useGitHubRepos callback dependencies
DevanshuNEU Jan 28, 2026
0d17e75
fix(oauth): strengthen state parameter validation
DevanshuNEU Jan 28, 2026
84a7aaf
fix(security): create public view to prevent access_token exposure
DevanshuNEU Jan 28, 2026
bb5f711
fix(security): don't expose internal error details in HTTP response
DevanshuNEU Jan 28, 2026
5fa787c
fix(types): GitHubUser.avatar_url should be Optional[str]
DevanshuNEU Jan 28, 2026
7729719
fix(ui): only show indexing modal when indexing starts successfully
DevanshuNEU Jan 28, 2026
2658107
fix(oauth): wrap completeConnect in try/catch to handle thrown errors
DevanshuNEU Jan 28, 2026
8336b69
fix(github): add exception handling to get_repos and configurable pag…
DevanshuNEU Jan 28, 2026
650b40e
fix(github): correct pagination log to show last fetched page
DevanshuNEU Jan 28, 2026
d8a010e
fix(github): propagate errors instead of masking as empty lists
DevanshuNEU Jan 28, 2026
f7d75f7
fix(github-oauth): improve UX after OAuth flow
DevanshuNEU Jan 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 67 additions & 11 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,32 +1,88 @@
# API Keys
# =============================================================================
# OpenCodeIntel Backend Environment Variables
# =============================================================================

# -----------------------------------------------------------------------------
# AI & Search APIs
# -----------------------------------------------------------------------------

# OpenAI - for embeddings and AI features
OPENAI_API_KEY=your_openai_api_key_here

# Pinecone - vector database for semantic search
PINECONE_API_KEY=your_pinecone_api_key_here
PINECONE_INDEX_NAME=codeintel

# Search V2 - Cohere Reranking (optional but recommended)
# Cohere - reranking for search quality (optional but recommended)
COHERE_API_KEY=your_cohere_api_key_here

# Supabase
# Voyage AI - code-specific embeddings (recommended for code search)
# Get API key from https://dash.voyageai.com/
VOYAGE_API_KEY=your_voyage_api_key_here

# -----------------------------------------------------------------------------
# Supabase - Authentication & Database
# -----------------------------------------------------------------------------

SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key_here
SUPABASE_JWT_SECRET=your_jwt_secret_here

# Backend API
# Service role key - required for server-side database access (e.g., storing GitHub tokens)
# Get from Supabase Dashboard → Settings → API → service_role key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key_here

# -----------------------------------------------------------------------------
# GitHub OAuth - One-Click Repo Import Feature
# -----------------------------------------------------------------------------
# IMPORTANT: This is SEPARATE from Supabase GitHub login!
#
# Supabase login uses its own OAuth app (configured in Supabase Dashboard).
# This OAuth app is ONLY for importing repositories from GitHub.
#
# Setup:
# 1. Go to GitHub → Settings → Developer settings → OAuth Apps → New OAuth App
# 2. Create app with name like "YourApp Repo Import"
# 3. Set callback URL based on environment:
# - Development: http://localhost:3000/github/callback
# - Production: https://yourdomain.com/github/callback
# 4. Copy Client ID and generate Client Secret
#
# You may need separate OAuth apps for dev and production (different callback URLs)

GITHUB_CLIENT_ID=your_github_oauth_app_client_id
GITHUB_CLIENT_SECRET=your_github_oauth_app_client_secret

# Must match EXACTLY what you set in GitHub OAuth App settings
GITHUB_REDIRECT_URI=http://localhost:3000/github/callback

# Frontend URL for redirects after OAuth
FRONTEND_URL=http://localhost:3000

# -----------------------------------------------------------------------------
# Backend Configuration
# -----------------------------------------------------------------------------

BACKEND_API_URL=http://localhost:8000
API_KEY=dev-secret-key

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

# Redis Cache
# -----------------------------------------------------------------------------
# Redis Cache (Optional)
# -----------------------------------------------------------------------------

REDIS_HOST=localhost
REDIS_PORT=6379

# Sentry Error Tracking (Optional)
# -----------------------------------------------------------------------------
# Monitoring & Debugging
# -----------------------------------------------------------------------------

# Sentry error tracking (optional)
# Get DSN from https://sentry.io → Settings → Projects → Client Keys
SENTRY_DSN=
ENVIRONMENT=development

# Search V3 - Voyage AI Code Embeddings (recommended for code search)
# Get API key from https://dash.voyageai.com/
VOYAGE_API_KEY=your_voyage_api_key_here
# Environment identifier
ENVIRONMENT=development
2 changes: 2 additions & 0 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from routes.api_keys import router as api_keys_router
from routes.users import router as users_router
from routes.search_v2 import router as search_v2_router
from routes.github import router as github_router
from routes.ws_playground import websocket_playground_index
from routes.ws_repos import websocket_repo_indexing

Expand Down Expand Up @@ -92,6 +93,7 @@ async def dispatch(self, request: Request, call_next):
app.include_router(api_keys_router, prefix=API_PREFIX)
app.include_router(users_router, prefix=API_PREFIX)
app.include_router(search_v2_router, prefix=API_PREFIX)
app.include_router(github_router, prefix=API_PREFIX)

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