Deploying an app with fastapi backend and svelte frontend

Hi all, someone suggested that I use fly.io, this would be my first app and I am not quite sure how to start.
Do I need to host two apps? I.e. one for the backend and one for the frontend?

That would be a recommended way to do it so you can scale them by themselves :slight_smile:

An excellent way to get started would be to go to the folder of one of them and fly launch. That will give you the next steps.

Thanks a lot, I am having a bit of trouble figuring this out.
Would docker be easier?
Sorry for the 1000 questions, its my first time doing any of this.
I also have a fly and flyctl is not recognized as a cmdlet after installation. I am on Win11
edit: ok I think I almost made it, but the URL seems to have an error:
white-shadow-4741.fly.dev is currently unable to handle this request.

HTTP ERROR 502

It’s ok, you can have a thousand questions!

If you have a Dockerfile for your projects that indeed would help. Usually those frameworks have Dockerfile examples out there :slight_smile:

I can’t reach your app too. Here are some tips to debug:

fly status and fly status --all would give you status about your allocs (–all show stopped/dead ones too)

fly logs would show you the logs for your app so you can verify if your app is not handling something well. If it’s restarting a lot it probably means a config error.

One common mistake people do is not listen on the port your fly.toml expects. You can look into logs for the port you’re listening to and compare to internal_port on fly.toml

Hope this helps!

1 Like