Use Python FastAPI on Cloudflare Workers

I am currently thinking how to use FastAPI which interacts with a Postgresql Database for Cloudflare Workers.

It seems, that there is already a template for Python available. However, it involves a transcription from Python to Javascript and I am not very comfortable with it.

Hence, do you have a suggestion how to get this started?

Personally, I wouldn’t move this to Cloudflare Workers.
Python is not well-supported on Workers, as Workers uses the v8 run time found here as is unlikely to be. Your only way to get Python code on workers is to transcript it or convert it to WASM. On top of that, Workers doesn’t support TCP connections (yet) so you’ll need to have to use a database solution that offers an HTTP API.

1 Like