A modern Social Network REST API built with Django REST Framework, featuring JWT + OTP authentication, user profiles, posts, comments, follow requests, and async email notifications.
The project is fully containerized using Docker, served via Gunicorn + Nginx, and uses PostgreSQL, Redis, and RabbitMQ for backend services.
- Register new users and verify via email
- Login with OTP and JWT tokens
- Password reset via email
- Account verification and resend verification email
- View and edit user profiles
- Follow / unfollow other users
- Handle private profile follow requests (accept/reject/delete)
- View follower and following counts
- Create, update, and delete posts
- Like and comment on posts
- Manage posts with multiple statuses (Draft / Published / Deleted)
- Email templates for:
- Account activation
- Password reset
- Follow request notifications
- Asynchronous email sending via Celery + RabbitMQ
- Django REST Framework for API logic
- PostgreSQL as the main database
- Redis for caching
- RabbitMQ for async tasks and Celery broker
- Gunicorn + Nginx for production serving
- Docker Compose for multi-container orchestration
git clone https://github.com/hosseinpk/Social_Network.git
cd Social_NetworkCreate a .env file in the root directory with variables like:
SECRET_KEY=your_secret_key
DEBUG=True
POSTGRES_DB=social_db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=db
POSTGRES_PORT=5432docker compose up --buildThis will start:
- Django (Gunicorn)
- PostgreSQL
- Redis
- RabbitMQ
- Nginx (static/media serving)
- Smtp4dev (email server)
Swagger UI is automatically available at:
http://localhost
Social_Network/
│
├── core/ # Django application source
│ ├── accounts/ # Authentication, registration, OTP
│ ├── profiles/ # User profiles & follow system
│ ├── posts/ # Posts, comments, likes
│ ├── tasks/ # Celery tasks for email, notifications
│ └── core/settings.py # Main project settings
│
├── nginx/ # Nginx configuration
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
└── README.md
Run Django management commands inside the container:
docker compose exec django python manage.py makemigrations
docker compose exec django python manage.py migrate
docker compose exec django python manage.py createsuperuser
docker compose exec django python manage.py collectstatic --noinput| Component | Technology |
|---|---|
| Framework | Django REST Framework |
| Auth | JWT + OTP |
| Database | PostgreSQL |
| Cache | Redis |
| Task Queue | Celery + RabbitMQ |
| Server | Gunicorn + Nginx |
| Containerization | Docker Compose |
| Documentation | drf-spectacular (Swagger UI) |
Here’s a preview of the live API documentation:
This project is licensed under the MIT License — feel free to use and modify it.
