Skip to content

feat: enforce API versioning with /v1 prefix#413

Merged
codeZe-us merged 8 commits intoSafeVault:mainfrom
Agbasimere:feat/api-v1-prefix
Mar 29, 2026
Merged

feat: enforce API versioning with /v1 prefix#413
codeZe-us merged 8 commits intoSafeVault:mainfrom
Agbasimere:feat/api-v1-prefix

Conversation

@Agbasimere
Copy link
Copy Markdown
Contributor

Closes: #388

Description

This PR introduces API versioning to future-proof our internal routes against breaking contract changes by enforcing a /v1 prefix across all endpoints.

To ensure a seamless transition without disrupting existing clients, a server-level rewrite rule was implemented alongside the core restructuring process.

Changes Included

  • Route Restructuring: Moved all existing routes physically from src/app/api/ into src/app/api/v1/.
  • Backward Compatibility: Introduced a rewrite mapping inside next.config.ts (/api/:path((?!v1/).*) -> /api/v1/:path) to silently route legacy unversioned requests to /v1.
  • Internal Migration: Updated all explicit internal fetch operations throughout hooks, components, and utility classes to target the new /api/v1/ schema.
  • Swagger Alignments: Pointed swagger-config.ts definitions globally to match /api/v1/ routing.
  • Test Suites updated: Updated descriptive aliases inside .test.ts files to reflect the updated endpoints.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Verified legacy /api/login rewrites gracefully to /api/v1/login using Next's rewrite rules.
  • Validated Swagger documentation still loads and discovers routes.
  • Executed unit tests over /v1/ endpoints.

@codeZe-us codeZe-us self-requested a review March 29, 2026 14:51
Copy link
Copy Markdown
Contributor

@codeZe-us codeZe-us left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Agbasimere this is okay

@codeZe-us
Copy link
Copy Markdown
Contributor

@Agbasimere please resolve conflicts

@Agbasimere
Copy link
Copy Markdown
Contributor Author

@codeZe-us resolved.

@codeZe-us codeZe-us merged commit 0e34c33 into SafeVault:main Mar 29, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add version prefix to internal API routes

2 participants