This repository contains the backend code for the Pearl Hacks 2025 project.
- Backend Framework: FastAPI
- Cloud Storage: Firebase Storage
- Deployment: Fly.io
- Environment Management: Python
venv
, Docker
├── .github/
│ └── workflows/ # GitHub Actions workflow configurations
├── apis/ # API endpoints and business logic
├── models/ # Data models and schemas
├── routes/ # Route handlers and endpoints
├── .dockerignore # Docker ignore file
├── .gitignore # Git ignore file
├── Dockerfile # Docker configuration
├── init.py # Python package initializer
├── fly.toml # Fly.io configuration
├── main.py # Application entry point
└── requirements.txt # Python dependencies
Build Docker and Run Docker Container
docker build -t myapp .
docker run -p 8000:8000 myapp
- Install Fly.io CLI
curl -L https://fly.io/install.sh | sh
- Authenticate with Fly.io
flyctl auth login
- Create and Configure Fly.io App
flyctl launch
- Deploy to Fly.io
flyctl deploy
- Verify Application Logs
flyctl logs
- Create a main.py file with this code
import requests
def test_api_endpoint():
app_url = "https://google-sheets-api-pearl-hacks.fly.dev"
route = "/sheet/faqs"
endpoint = f"{app_url}{route}"
try:
response = requests.get(endpoint)
# Check if request was successful
response.raise_for_status()
# Print status code
print(f"Status Code: {response.status_code}")
# Print headers
print(f"Content-Type: {response.headers.get('content-type')}")
# Print JSON response
data = response.json()
print("Response Data:", data)
return data
except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
except requests.exceptions.ConnectionError as conn_err:
print(f"Error connecting to the server: {conn_err}")
except requests.exceptions.Timeout as timeout_err:
print(f"Timeout error: {timeout_err}")
except requests.exceptions.RequestException as err:
print(f"An error occurred: {err}")
except ValueError as val_err:
print(f"Error parsing JSON response: {val_err}")
if __name__ == "__main__":
test_api_endpoint()
- Create Python virtual environment
python -m venv venv
- Activate Python virtual environment
For Mac/Linux:
source venv/bin/activate
For Windows:
.\venv\Scripts\activate
- Run test file
python main.py