|
| 1 | + |
| 2 | +# 🧩 TaskFlow API |
| 3 | + |
| 4 | +A Django RESTful API for managing personal or team tasks — featuring PostgreSQL, RabbitMQ, Docker support, and developer/production-ready configurations. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 🚀 Features |
| 9 | + |
| 10 | +- ✅ Django 5 + Django REST Framework |
| 11 | +- ✅ PostgreSQL database (via Docker) |
| 12 | +- ✅ RabbitMQ for background tasks (Celery-ready) |
| 13 | +- ✅ Environment config with `.env` and `python-decouple` |
| 14 | +- ✅ Swagger UI for API documentation |
| 15 | +- ✅ Containerized with Docker |
| 16 | +- ✅ CLI scripts for development and production modes |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## 📁 Project Structure |
| 21 | + |
| 22 | +``` |
| 23 | +taskflow-api/ |
| 24 | +├── taskflow_api/ # Django project |
| 25 | +├── tasks/ # App: task models, views, serializers |
| 26 | +├── requirements.txt # Python dependencies |
| 27 | +├── Dockerfile # Production image for gunicorn |
| 28 | +├── docker-compose.yml # DB and RabbitMQ container setup |
| 29 | +├── .env # Environment configuration |
| 30 | +├── run_server.sh # Run production server (Gunicorn) |
| 31 | +└── start-dev-services.sh # Run DB + RabbitMQ for development |
| 32 | +``` |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## ⚙️ Prerequisites |
| 37 | + |
| 38 | +- Python 3.12+ |
| 39 | +- Docker & Docker Compose |
| 40 | +- Virtualenv (optional but recommended) |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## 📦 Setup Instructions |
| 45 | + |
| 46 | +### 🔧 1. Install Python Dependencies |
| 47 | +```bash |
| 48 | +python3 -m venv env |
| 49 | +source env/bin/activate |
| 50 | +pip install -r requirements.txt |
| 51 | +``` |
| 52 | + |
| 53 | +### 🔧 2. Configure Environment |
| 54 | +Edit `.env` (already provided): |
| 55 | +```dotenv |
| 56 | +DEBUG=True |
| 57 | +SECRET_KEY=your-secret-key |
| 58 | +DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,[::1] |
| 59 | +
|
| 60 | +POSTGRES_DB=taskflow |
| 61 | +POSTGRES_USER=postgres |
| 62 | +POSTGRES_PASSWORD=postgres |
| 63 | +POSTGRES_HOST=localhost |
| 64 | +POSTGRES_PORT=5432 |
| 65 | +
|
| 66 | +CELERY_BROKER_URL=amqp://guest:guest@localhost:5672// |
| 67 | +``` |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## 🧪 Development Mode |
| 72 | + |
| 73 | +Use this when you want to run Django locally (`runserver`) and containers only for DB/RabbitMQ. |
| 74 | + |
| 75 | +### ▶️ Start Docker Services: |
| 76 | +```bash |
| 77 | +./start-dev-services.sh |
| 78 | +``` |
| 79 | + |
| 80 | +> This will: |
| 81 | +> - Start PostgreSQL and RabbitMQ containers |
| 82 | +> - Stop and remove any running `web` container |
| 83 | +> - Run DB migrations automatically |
| 84 | +
|
| 85 | +### ▶️ Then Run Django: |
| 86 | +```bash |
| 87 | +python3 manage.py runserver |
| 88 | +``` |
| 89 | + |
| 90 | +Open: |
| 91 | +- Swagger docs: http://localhost:8000/docs/ |
| 92 | +- API root: http://localhost:8000/api/tasks/ |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## 🏭 Production Mode (Dockerized Web) |
| 97 | + |
| 98 | +### ▶️ Build & Run All Services: |
| 99 | +```bash |
| 100 | +./run_server.sh |
| 101 | +``` |
| 102 | + |
| 103 | +> This uses Docker to run: |
| 104 | +> - Django (with Gunicorn) |
| 105 | +> - PostgreSQL |
| 106 | +> - RabbitMQ |
| 107 | +
|
| 108 | +You can also run manually: |
| 109 | +```bash |
| 110 | +docker compose up --build |
| 111 | +``` |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 🗃️ Tech Stack |
| 116 | + |
| 117 | +- **Backend**: Django 5, DRF |
| 118 | +- **Database**: PostgreSQL (Docker) |
| 119 | +- **Broker**: RabbitMQ (Docker) |
| 120 | +- **Containerization**: Docker, Docker Compose |
| 121 | +- **CI-ready**: Gunicorn + environment-based config |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## 📜 License |
| 126 | + |
| 127 | +MIT © Omid Hashemzadeh |
0 commit comments