Skip to content

[Enhancement]: Add API versioning with /api/v1 route prefix #51

@tomvothecoder

Description

@tomvothecoder

Is your feature request related to a problem?

Currently, the FastAPI app does not use explicit versioning in its route structure. This makes it difficult to introduce breaking API changes or maintain backward compatibility for clients in the future. Without versioning, even minor refactors to endpoints could unintentionally break integrations.

Describe the solution you'd like

Introduce API versioning by grouping all routes under a versioned prefix, starting with /api/v1.

Proposed structure:

from fastapi import FastAPI
from app.api.v1 import routers as v1_routers

app = FastAPI(title="E3SM Feature API")
app.include_router(v1_routers.router, prefix="/api/v1")

Each domain router (e.g., simulations, comparisons, etc.) will be included under this versioned router to produce clean, predictable endpoints such as:

/api/v1/simulations
/api/v1/comparisons

This structure will make it easy to add /api/v2 later when changes are introduced.

Describe alternatives you've considered

  • Using a global prefix like /api without versioning (simpler, but less future-proof).
  • Handling versioning via request headers or query parameters (more flexible, but overkill for current needs).

The route-prefix approach is straightforward, aligns with FastAPI conventions, and will scale as the project grows.

Additional context

This enhancement will:

  • Improve maintainability and API clarity.
  • Simplify migration paths for future releases.
  • Align the project with common REST API design practices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions