DevHub API is an open-source platform for developers to share projects, get feedback, and explore trending projects weekly.
Built with Django REST Framework, it features JWT authentication, automated tests, Docker, and CI/CD via GitHub Actions.
| Component | Technology |
|---|---|
| Backend | Django 5, Django REST Framework |
| Auth | JWT (SimpleJWT) |
| Database | SQLite (Dev & CI) |
| Testing | pytest + pytest-django |
| CI/CD | GitHub Actions (Dockerized) |
| Containerization | Docker & Docker Compose |
β
Register / Login (JWT Authentication)
β
Developer Profiles (auto-created on registration)
β
CRUD Projects (Create, Read, Update, Delete)
β
Like (Star) + View Count
β
Comments System
β
Trending Projects (based on stars & views in the last 7 days)
β
Unit Tests with pytest
β
CI/CD with GitHub Actions
β
Dockerized Setup
DevHub is a modern, community-driven API for developers.
It aims to provide an experience similar to GitHub Explore or ProductHunt for developer projects.
Users can publish their projects, star othersβ projects, leave comments, and view trending projects weekly.
π§© Designed with clean architecture, testability, and fast Docker deployment in mind.
git clone https://github.com/MortezaHashemabadi/devhub-api.git
cd devhub-apiπΉ Local (manual) python -m venv .venv source .venv/bin/activate # (Windows: .venv\Scripts\activate) pip install -r requirements.txt python manage.py migrate python manage.py runserver
docker-compose up --build
Access the API at http://localhost:8000.
| Endpoint | Description |
|---|---|
| POST /api/auth/register/ | Register a new user |
| POST /api/token/ | Login (JWT Access & Refresh Tokens) |
| POST /api/token/refresh/ | Refresh JWT Access Token |
Example Login Response:
{ "access": "<JWT_ACCESS>", "refresh": "<JWT_REFRESH>" }
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/projects/ |
List all projects |
| POST | /api/projects/ |
Create a new project |
| GET | /api/projects/{id}/ |
Retrieve project details |
| POST | /api/projects/{id}/toggle_star/ |
Star or unstar a project |
| POST | /api/projects/{id}/add_view/ |
Increment view count |
| GET | /api/projects/trending/ |
List trending projects |
| GET/POST | /api/comments/ |
List or create comments |
- Locally : pytest -v
- Inside Docker : docker run --rm devhub-api pytest -v
Example output:
This project is fully Dockerized using SQLite. Directory structure:
devhub-api/ β βββ core/ βββ developers/ βββ users/ βββ db_data/ β βββ db.sqlite3 βββ Dockerfile βββ docker-compose.yml βββ pytest.ini βββ .github/workflows/ci.yml βββ requirements.txt βββ README.md
- Run with:
docker-compose up --build
On each push to main, GitHub Actions:
Builds the Docker image
Runs automated tests
Displays test results as a badge
GET /api/projects/trending/
Response:
[ { "title": "AI Portfolio Builder", "stars_count": 30, "views": 120 }, { "title": "FastAPI Scraper", "stars_count": 18, "views": 80 } ]
Pull Requests and Issues are welcome π¬ If you have ideas for new features (e.g., notifications, tagging system), feel free to submit a PR.
MIT License Β© 2025 Morteza Hashemabadi