feat(api): Add centralized API versioning system (#55)#88
Merged
DevanshuNEU merged 5 commits intoDec 8, 2025
Merged
Conversation
- Create backend/config/api.py as single source of truth - API_VERSION constant controls all route prefixes - API_PREFIX auto-derived: /api/v1 - LEGACY_API_PREFIX for backward compatibility: /api - Deprecation headers support for legacy routes - Helper functions for version management Part of OpenCodeIntel#55
- main.py: import API_PREFIX, apply to all routers
- Route files: remove hardcoded /api, use relative paths
- auth.py: /api/auth → /auth
- repos.py: /api/repos → /repos
- search.py: /api → (empty)
- analysis.py: /api/repos → /repos
- api_keys.py: /api → (empty)
- playground.py: /api/playground → /playground
- WebSocket endpoint now versioned: /api/v1/ws/index/{repo_id}
- Health endpoint stays at root: /health (no versioning)
- Tests: import API_PREFIX, all paths now use config
All 13 tests passing.
Part of OpenCodeIntel#55
- API_VERSION constant controls all frontend API paths - API_PREFIX auto-derived: /api/v1 - API_URL combines base URL + prefix - WS_URL for WebSocket connections (versioned) - Helper functions: buildApiUrl(), buildWsUrl() - LEGACY_API_URL for backward compatibility Mirrors backend/config/api.py pattern. Part of OpenCodeIntel#55
- Remove hardcoded /api/ from all fetch calls
- API_URL now includes /api/v1 prefix from config
- Updated 8 files:
- components/PerformanceDashboard.tsx
- components/ImpactAnalyzer.tsx
- components/SearchPanel.tsx
- components/dashboard/CommandPalette.tsx
- components/dashboard/DashboardHome.tsx
- hooks/useCachedQuery.ts
- pages/LandingPage.tsx
- pages/Playground.tsx
Before: ${API_URL}/api/repos
After: ${API_URL}/repos
Part of OpenCodeIntel#55
- Create mcp-server/config.py as single source of truth
- API_VERSION = 'v1', API_PREFIX = '/api/v1'
- server.py: import API_PREFIX, construct BACKEND_API_URL with version
- Remove hardcoded /api/ from all 6 API calls:
- /search
- /repos
- /repos/{id}/dependencies
- /repos/{id}/style-analysis
- /repos/{id}/impact
- /repos/{id}/insights
Mirrors backend/config/api.py and frontend/config/api.ts pattern.
Part of OpenCodeIntel#55
|
@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements centralized API versioning with single source of truth pattern across all layers.
Closes #55
Architecture
To upgrade to v2: Change
API_VERSION = "v2"in 3 config files. All routes update automatically.backend/config/api.py- Backend configfrontend/src/config/api.ts- Frontend configmcp-server/config.py- MCP server configChanges
Backend
backend/config/api.pyas single source of truthmain.py: ApplyAPI_PREFIXto all routers/api, use relative pathsFrontend
frontend/src/config/api.tswith same patternAPI_URLMCP Server
mcp-server/config.pyserver.pyto use versioned URLsFinal Routes
Testing