Metadata-Version: 2.4
Name: django-drf-boilerplate
Version: 0.1.0
Summary: Scaffold a production-ready Django REST Framework project in one command
License-Expression: MIT
Project-URL: Homepage, https://github.com/Silas003/django-boilerplate
Project-URL: Repository, https://github.com/Silas003/django-boilerplate
Project-URL: Bug Tracker, https://github.com/Silas003/django-boilerplate/issues
Keywords: django,rest-framework,boilerplate,scaffold,cli
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: click>=8.1
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

# Django DRF Boilerplate

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

## Install

```bash
pip install django-drf-boilerplate
```

## Usage

```bash
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

```bash
# 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 |
