https://github.com/itsjustshubh/fastapi-fly-app-template
This repository provides a template for deploying a FastAPI application on Fly.io using GitHub Actions for continuous deployment. It includes a pre-configured GitHub Actions workflow and essential configuration files to get your FastAPI app running on Fly.io quickly and efficiently.
https://github.com/itsjustshubh/fastapi-fly-app-template
api continuous-deployment deployment docker fastapi flyio github-actions python template
Last synced: 2 months ago
JSON representation
This repository provides a template for deploying a FastAPI application on Fly.io using GitHub Actions for continuous deployment. It includes a pre-configured GitHub Actions workflow and essential configuration files to get your FastAPI app running on Fly.io quickly and efficiently.
- Host: GitHub
- URL: https://github.com/itsjustshubh/fastapi-fly-app-template
- Owner: itsjustshubh
- License: mit
- Created: 2024-08-03T21:14:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-03T21:41:05.000Z (almost 2 years ago)
- Last Synced: 2025-07-20T06:44:58.124Z (11 months ago)
- Topics: api, continuous-deployment, deployment, docker, fastapi, flyio, github-actions, python, template
- Language: Shell
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FastAPI App Deployment on Fly.io
This repository contains a simple FastAPI application that can be deployed on Fly.io. Follow the instructions below to get your app running.
## Prerequisites
1. **Fly CLI**: Install the Fly CLI by following the instructions at [Fly.io CLI installation](https://fly.io/docs/hands-on/install-flyctl/).
2. **GitHub Repository**: Fork this repository to your GitHub account.
## Getting Started
### Clone the Repository
```bash
git clone https://github.com/itsjustshubh/fastapi-fly-app-template.git
cd fastapi-fly-app-template
```
### FastAPI Application
The FastAPI application is located in `main.py`:
```python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"message": "Hello, World!"}
```
### Running Locally
1. **Development Mode**
```bash
fastapi dev
```
2. **Production Mode**
```bash
fastapi run
```
### Deploy to Fly.io
1. **Deploy Your App**
- Authenticate with Fly.io:
```bash
flyctl auth login
```
- Initialize your Fly.io app (if you haven’t done so already):
```bash
fly launch --generate-name
```
2. **Push Changes**
```bash
git add .
git commit -m "Setup deployment workflow"
git push origin master
```
The GitHub Actions workflow will automatically deploy your app to Fly.io.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.