[Python] Exposing Multiple Independent Python Apps as a Single FastAPI API

Discussão em 'Python' iniciado por Stack, Fevereiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm developing a set of small, independent Python applications, each designed to provide a specific, isolated functionality. My goal is to keep these applications separate because they may utilize different tech stacks and have varying dependency requirements.

    Once these individual applications are complete, I want to expose them as a unified FastAPI API. Essentially, I'd like to create a central FastAPI gateway that lists and routes to the endpoints of each of these independent applications.

    For example, I might have:

    app1.py (using library X) with endpoints like /app1/endpoint1 app2.py (using library Y) with endpoints like /app2/endpoint2 And I want a central main_api.py (FastAPI) that exposes:

    /app1/endpoint1 /app2/endpoint2 Is this architectural pattern feasible? Are there established best practices for achieving this? Has anyone implemented a similar solution in a production environment?

    I'm particularly interested in:

    Methods for dynamically integrating or routing to these independent applications within a central FastAPI application. Potential challenges or pitfalls to be aware of. Alternative architectural patterns that might be more suitable. Thank you for your insights!"

    Continue reading...

Compartilhe esta Página