This project provides a Docker Compose setup for a full-stack application. It has a FastAPI backend and Next.js frontend that displays some information from the Gapminder dataset.
.
├── docker-compose.yml
├── backend/
│ ├── Dockerfile
│ ├── main.py
│ ├── requirements.txt
│ └── src/
│ ├── __init____.py
│ ├── database.py
│ └── models.py
├── db/
│ ├── gapminder.csv
│ └── init.sql
└── frontend/
├── Dockerfile
├── package.json
├── next.config.js
├── tsconfig.json
├── next-env.d.ts
├── src/
├── pages/
│ ├── index.tsx
│ ├── _app.tsx
│ └── api/
│ └── gapminder.ts
└── styles/
├── globals.css
└── Home.module.css
- Database: Postgres server that loads in the gapminder dataset
- Backend: FastAPI serving a synthesized Gapminder dataset with country development metrics
- Frontend: Next.js with TypeScript that renders some of the dataset.
- Development Environment:
- Hot reloading for both backend and frontend
- Docker Compose setup for easy development
- Make sure you have Docker and Docker Compose installed on your system
- Clone/download this repository
- Navigate to the project directory
- Run the following command to start the services:
docker-compose up --build- Access the applications:
- FastAPI Backend: http://localhost:8000
- Next.js Frontend: http://localhost:3000
GET /: Returns a simple greeting messageGET /api/gapminder: Returns the Gapminder dataset with life expectancy, GDP per capita, and population data
-
To rebuild the containers:
docker-compose up --build
-
To stop the services:
docker-compose down
Both frontend and backend directories are mounted as volumes, so any changes you make to the code will be reflected in the running application without needing to rebuild the containers. The setup includes hot reloading for both the FastAPI backend and Next.js frontend.
- Backend: FastAPI, Python
- Frontend: Next.js, TypeScript, Recharts
- Database: Postgres
- Infrastructure: Docker, Docker Compose