Best practices for integrating custom FastAPI endpoints with Frappe/ERPNext

Hello everyone :wave:,

I’m new to the Frappe community and exploring how to integrate FastAPI endpoints with Frappe/ERPNext.

Specifically, I’d like to:

  • Expose a custom API (e.g., /student/timetable) using FastAPI.
  • Fetch data from existing Frappe DocTypes (like Student, Course).
  • Apply caching with Redis for faster responses.

I’ve read about creating custom apps and extending APIs in ERPNext, but I’m still unclear about:

  1. Is it recommended to extend the built-in Frappe REST APIs, or run a parallel FastAPI app?
  2. If running FastAPI alongside, what’s the cleanest way to share database sessions with MariaDB used by Frappe?
  3. Any examples or community apps that already follow this hybrid model?

Any guidance or references would be really helpful. Thanks!

If you need FastAPI to use Frappe python api, check this Serverless function using Frappe Framework

To reverse proxy (production) or serve (development) custom service check this How Add nodejs App to frappe & bench? - #5 by revant_one

1 Like