Use of Transcrypt for a FastAPI server to make it work in Cloudflare worker #839
Replies: 2 comments 1 reply
-
Not sure I understand your question, but If you are talking about using Transcrypt to turn your entire backend into something that will run in a JavaScript host, that's not going to work. Transcrypt can only transpile pure Python code, so any Python libraries that have a dependency on C code (which are the majority of Python libraries) can't be turned into JavaScript. So you'll need a host that has Python installed to run a fastapi backend. But if I misunderstood what you are asking, let me know. |
Beta Was this translation helpful? Give feedback.
-
@junoriosity to port your application to work in the Cloudflare environment, you would need to make use of the Cloudflare infrastructure for routing requests, storage etc. FastAPI is conceptually at the same "level" as a Cloudflare Worker environment. Transcrypt shines at replacing parts in your stack "higher up" where you would normally need to write lots of Javascript, but can now still do it in Python, but retain compatibility with the Javascript ecosystem. Interestingly, as a side-note: when Cloudflare announced Python support in their Workers environment initially, it was using Transcrypt under the hood. But since the early days they seemed to have downplayed that a bit more, I do not see it mentioned so much. Could be that the uptake was not so high, and most usage just picked the more familiar (to most users) JS way. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I am currently using FastAPI for my server backend, which interacts with my Postgresql server, S3 bucketsv and Stripe. This involves, several nested repos and routes.
In particular, I am using these libraries:
asyncpg==0.27.0
fastapi==0.88.0
sqlmodel==0.0.8
pydantic[email]==1.10.4
uvicorn==0.20.0
requests==2.28.1
fastapi-cloudauth==0.4.3
fastapi-pagination==0.11.1
stripe==5.0.0
boto3==1.26.44
python-liquid==1.7.0
starlette-validation-uploadfile==0.1.1
python-multipart==0.0.5
Now is there some way to use Transcrypt to make my server work on Cloudflare Worker. If so, do you have some idea how to get it work? 🙂
Beta Was this translation helpful? Give feedback.
All reactions