A simple, full-stack to-do list application built with React and Flask, using PostgreSQL for storage.
Easily manage your daily tasks with a modern web interface, powered by Docker for seamless deployment and development.
Choose your preferred setup method and follow the step-by-step instructions:
-
Install Docker & Docker Compose:
-
Clone the repository:
git clone https://github.com/MiqdadProjects/todo-app-docker-stack.git cd todo-app-docker-stack
-
(Optional) Configure environment variables:
Editbackend/.env
if you want to change database credentials. Defaults:DB_USER=postgres DB_PASSWORD=secret_pass DB_HOST=db DB_NAME=tododb
-
Build and start the containers:
docker-compose up --build
-
Access the application:
- Frontend UI: http://localhost:3000
- Backend API: http://localhost:5000/api/todos
-
Stopping the app:
PressCtrl+C
in your terminal, then run:docker-compose down
-
Rebuild containers without cache (if needed):
docker-compose build --no-cache docker-compose up
To connect to the PostgreSQL database container and run queries:
-
Open a terminal into the database container:
docker exec -it postgres-db psql -U postgres -d tododb
-
List tables:
\dt
-
Query all todos:
SELECT * FROM todos;
-
Exit psql shell:
\q
-
Install Node.js
Node.js download page -
Run the frontend locally:
cd frontend npm install npm start
The React app will run at http://localhost:3000 by default.
-
Install Python 3 & pip
-
Set up a Python virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r backend/requirements.txt
-
Set environment variables (optional):
Edit or createbackend/.env
as shown above. -
Run the Flask backend:
cd backend flask run
The API will be available at http://localhost:5000/api/todos.
Method | Endpoint | Description |
---|---|---|
GET | /api/todos |
Retrieve all to-do items |
POST | /api/todos |
Add a new to-do item |
DELETE | /api/todos/<id> |
Delete a to-do item by ID |
- All environment variables can be customized in
backend/.env
. - Use
docker-compose down
to stop and remove containers. - Use
docker-compose build --no-cache
to force a rebuild after changes. - For production, consider using a production-ready WSGI server for Flask and a reverse proxy for React.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Happy coding! 🚀