Skip to main content

Scaffold a production-ready Django REST Framework project in one command

Project description

Django DRF Boilerplate

A CLI tool that scaffolds a production-ready Django REST Framework project in one command.

Install

pip install django-drf-boilerplate

Usage

drf-boilerplate new my_project
cd my_project
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# Edit .env with your settings
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

The CLI creates my_project/ in the current directory, renames the config package, substitutes all internal references, and copies .env.example to .env.

Options

drf-boilerplate new --help

  --directory, -d TEXT  Parent directory for the new project. [default: .]
  -V, --version         Show version and exit.

What's Included

Feature Details
Auth JWT (access + refresh tokens), OTP email verification, password reset, logout with token blacklisting
Google OAuth Social login via Google ID token
Async tasks Celery + Redis (email delivery)
WebSocket Django Channels consumer + room pattern
Newsletter Subscriber model with subscribe/unsubscribe endpoint
API docs Swagger UI + ReDoc at /swagger/ and /redoc/
Rate limiting OTP endpoints throttled at 5 requests/hour
Pagination StandardPagination (page size 20, max 100)

Apps

App Purpose
accounts CustomUser, Profile, full auth flow
newsletter Subscriber pattern + Celery email task
communications WebSocket consumer + Room/Message models + REST endpoints
notification Empty — ready for your models
helpers generate_otp(), IsManagement permission, throttles, pagination

Profile Account Types

Profile.account_type accepts: "admin" or "user".

Environment Variables

Edit .env (auto-created from .env.example):

SECRET_KEY=
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
EMAIL_PORT=587
EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD=
GOOGLE_CLIENT_ID=
CELERY_BROKER_URL=redis://127.0.0.1:6379
CORS_ALLOWED_ORIGINS=http://localhost:3000
CELERY_TASK_ALWAYS_EAGER=False
DJANGO_LOG_LEVEL=INFO

Running Services

# Terminal 1 — Django dev server
python manage.py runserver

# Terminal 2 — Celery worker
celery -A my_project worker --loglevel=info

# Terminal 3 — Redis (if not running as a system service)
redis-server

API Endpoints

Method Endpoint Description
POST /v1/accounts/register/ Register + sends OTP
POST /v1/accounts/verify-account/ Activate account with OTP
POST /v1/accounts/login/ Login → returns JWT tokens
POST /v1/accounts/logout/ Blacklist refresh token
POST /v1/accounts/google/ Google OAuth login
POST /v1/accounts/reset-otp/ Request password reset OTP
POST /v1/accounts/reset/ Reset password with OTP
POST /v1/accounts/resend-otp/ Resend activation OTP
CRUD /v1/accounts/profile/ User profile (scoped to authenticated user)
CRUD /v1/newsletter/register/ Subscribe / unsubscribe
CRUD /v1/communications/rooms/ Chat rooms (management write, authenticated read)
WS ws/chat_admin/<uuid>/ WebSocket chat room

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_drf_boilerplate-0.1.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_drf_boilerplate-0.1.0-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file django_drf_boilerplate-0.1.0.tar.gz.

File metadata

  • Download URL: django_drf_boilerplate-0.1.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for django_drf_boilerplate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1b499c53d6d0b23dc1e0d8999ffd57ef459748118590efda98786678248faee7
MD5 32daf4fd65d461166b8ae65cd71fe807
BLAKE2b-256 38f947c91f97471f9dbf8342a0277cac93b7dc0d482f14bb9937b4677d329601

See more details on using hashes here.

File details

Details for the file django_drf_boilerplate-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_drf_boilerplate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b11d868cb60d995807b36f74d7949dd85faff08c2a7c7f0e4c62999e854cf1a
MD5 f4bca75569789bea1eeb4ebc090446df
BLAKE2b-256 8a6cfde05a963cc80dd498936335d67ba14314efe3979f61eef62b4ca4cf1730

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page