This project was built as a professional portfolio application, demonstrating production-grade architecture, atomic database operations, optimized queries, and clean separation between frontend, backend, and business logic.
It provides a social feed with infinite scrolling, dynamic post interactions, real-time UI updates, and profile management.
- 100% Test Coverage: Guarantees robustness and integrity across all 500+ statements using Pytest and Django Test Client.
- Atomic Denormalization: Ensures data consistency and concurrency safety, preventing race conditions, using
transaction.atomicandF()expressions - Full Single-Page Application (SPA): All app flows are managed client-side using
Vanilla JavaScript ES6 modular architectureand central state. - JSON API: All app operations are handled by JSON endpoints.
- Improved User Experience: Features a fully implemented dark mode with user preference persistence, dynamic styling, and promise-based animations.
- Query Optimization: Implements custom composite indexes and double cursor based pagination, managing consistency even on larger datasets. N+1 problems are eliminated using
select_relatedandprefetch_relatedto minimize database round trips. - PostgreSQL Functional Constraints: Enforces case-insensitive uniqueness on usernames and emails at database level.
- User Management: Registration, login and profile editing without page reloads.
- Social Feed: View posts from all users or from followed users.
- Interactions: Create, edit, and delete Posts and Comments. Like/Unlike posts with real time UI updates.
- Profiles: Follow/Unfollow users with real time UI updates.
- Backend: Django 5.x / Python 3.13 + django-versatileimagefield.
- Frontend: JavaScript ES6 modules + Intersection Observer.
- Database: PostgreSQL.
- Testing: Pytest + Django Test Client.
- Deployment: Docker, Docker Compose, Gunicorn, Nginx, WhiteNoise.
| Component | Technology | Purpose |
|---|---|---|
| Web Server | Nginx 1.25-alpine | Reverse proxy, serves static/media, TLS termination |
| Application Server | Gunicorn 23 + Python 3.13 | WSGI server, 4 workers, 300s timeout |
| Framework | Django 5.x | Full-stack backend + admin |
| Database | PostgreSQL 16-alpine | Persistent storage |
| Static Files | WhiteNoise (local) → Nginx (docker) | Zero-downtime asset delivery |
| Media/Thumbnails | versatileimagefield + Nginx | On the fly resizing, served directly |
| Configuration | python-dotenv + dj-database-url | Single codebase between local and docker |
| Containerization | Docker + Docker Compose | Reproducible environment |
git clone https://github.com/Landuche/social-network
cd social-network
cp .env.local.example .env.local # Configure your database on this file
python -m venv venv
venv\Scripts\activate
pip install -r requirements-local.txt
pip install python-magic-bin
python manage.py migrate
python manage.py collectstatic
python manage.py runservercp .env.example .env # Configure your database on this file
docker compose up --buildCopy-Item -Path .\fixtures\assets\ -Destination .\media -Recurse -Force
python manage.py loaddata fixtures\initial_data.jsondocker cp ./fixtures/assets/profile_pics/ social-network-web-1:/app/media
docker compose exec web python manage.py loaddata fixtures/initial_data.jsonpip install -r requirements-test.txt
pytest -v -n autodocker compose exec web python -m pytest -v -n auto