This project is a simple FastAPI application that handles user data using a JSON file instead of a database. The entire application is containerized using Docker and can be run using Docker Compose.
- Built using FastAPI
- Stores user data in a
users.jsonfile (no database used) - Containerized using Docker
- Easy to run with
docker-compose - API documentation available at
/docs
docker-fastapi-userapi/
├── app/
│ ├── main.py # FastAPI app entry point
│ ├── services.py # Logic to handle file operations
│ └── data/ # Contains users.json
│ └── users.json # Auto-created when user data is posted
├── Dockerfile # Docker image instructions
├── docker-compose.yml # Docker Compose file
├── requirements.txt # Python dependencies
└── README.md # Project documentation
{
"data": [
{
"first_name": "Sukant"
"last_name": "Tekade"
"age": 23
}
]
}FROM python:3.12-slim
WORKDIR /app
COPY . /app
RUN pip install --no-cache-dir -r /app/requirements.txt
USER root
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]version: '3.8'
services:
fastapi-app:
build: .
container_name: fastapi-app
ports:
- "8000:8000"
volumes:
- .:/app
- ./app/data:/app/app/data
restart: always- TekadeSukant
- GitHub Profile
