FastAPI + PostgreSQL Project
This project is a FastAPI application with PostgreSQL, fully containerized using Docker Compose, ready to deploy on AWS EC2.
- CRUD operations for items
- SQLAlchemy ORM models
- Pydantic schemas
- Dockerized for easy deployment
- Ready for cloud deployment on AWS
fastapi-postgres/ │── docker-compose.yml │── Dockerfile │── requirements.txt │── main.py │── database.py │── models.py │── schemas.py │── crud.py │── README.md
yaml Copy code
docker compose up --build -d
FastAPI Swagger UI: http://localhost:8000/docs (or <EC2_PUBLIC_IP>:8000/docs after deployment)
Postgres access:
bash
Copy code
docker exec -it fastapi-postgres-db-1 psql -U postgres -d fastapi
API Endpoints
Method Path Description
GET /items/ List all items
POST /items/ Create a new item
GET /items/{id} Retrieve single item
PUT /items/{id} Update item
DELETE /items/{id} Delete item
Deployment on AWS EC2
Launch an EC2 instance (Ubuntu 22.04 LTS)
Install Docker & Docker Compose
Copy the project to EC2
Run docker compose up --build -d
Access Swagger UI at http://<EC2_PUBLIC_IP>:8000/docs
Requirements
Python 3.9+
FastAPI
SQLAlchemy
psycopg2-binary
Docker & Docker Compose
Author
Shaik Sumaiah
yaml
Copy code
---
### **Next Steps to finish the merge**
1. Save this as `README.md` in your project root.
2. Add it to staging:
```bash
git add README.md
Commit the merge:
bash
Copy code
git commit -m "Resolved merge conflict in README.md"
Push to GitHub:
bash
Copy code
git push -u origin main
After this, your README.md and project will be fully synced with GitHub.