Best Practices for Integrating a Modular FastAPI Backend with a React Frontend
Priya Rai
0
Reputation points
Approach for Structuring FastAPI & React Integration
I am working on a RAG-based accelerator and planning the integration between FastAPI (backend) and React (frontend). My approach is as follows:
- Modular Backend: Each individual component (data processing, retrieval, etc.) is placed in separate Python files, ensuring independent data flow.
- FastAPI Collation: All these components are collated into a single FastAPI file, which acts as the main API layer.
- Frontend API Handling: In the React frontend, we call the FastAPI endpoints via
api.js
, allowing input-output flow as per our use case. Only the required components are used in the current accelerator. - we are hosting our accelerator's Backend on Azure App Services and Frontend on Blob Storage + cdn.
- Future Scalability: Later, if we build another accelerator, we can reuse other components from the existing FastAPI file in a new React project.
Questions:
- Is this approach feasible for maintaining modularity and reusability?
- Will calling multiple components from a single FastAPI file slow down the frontend performance due to API response time or latency issues?
- Any suggestions on optimizing the frontend API handling to avoid unnecessary delays?
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,940 questions
Sign in to answer