Documentation is available on: English 🇺🇸 | Russian 🇷🇺
This is a Django REST Framework backend for a classified ads platform with user authentication, role management, ad posting, reviews, and search functionality.
- User registration and authentication with JWT
- Role-based access control: regular users and admins
- Password change and reset via email
- CRUD operations for ads
- Users can manage their own ads
- Admins can manage all ads
- Reviews on ads with CRUD and permissions
- API documentation with Swagger and Redoc (via
drf-spectacular) - CORS headers enabled for frontend integration
- Dockerized setup with
docker compose
- Python 3.13+
- Django 5.x
- Django REST Framework
- PostgreSQL
- Simple JWT for authentication
- drf-spectacular for API docs
- Docker & Docker Compose
- Nginx
- Pytest
- Docker and Docker Compose installed
- Clone the repo:
git clone https://github.com/github-main-user/trust-ads.git
cd trust-ads- Setup environment variables
cp .env.example .env- Build and run containers:
docker compose up --build- The backend API will be available at:
http://localhost:80/
http://localhost:80/api/v1/docs/- swagger documentationhttp://localhost:80/api/v1/redoc/- redoc documentationhttp://localhost:80/admin/- admin panel
To create an admin user use this command:
docker compose exec web python manage.py createsuperuserFor demonstration purposes some sample data has been prepared in fixtures. You can load them using this command:
docker compose exec web python manage.py loaddata fixtures.jsonCommand to run tests:
docker compose run --rm web pytestYou can see coverage using the command below:
docker compose run --rm web bash -c "coverage run -m pytest && coverage report"- Admin role users have full control over ads and comments.
- Anonymous users can only view ads.
- Ads and comments are sorted by creation date descending.
- Pagination limits ads listing to 4 per page.
- Password reset flow is email token based.