Skip to main content

Modular Django boilerplate

Project description

Django Boilerplate → easy-django 📦

A modular, scalable, and DRY backend boilerplate built on Django. Designed to provide production-ready patterns (service, repository, serializer, view) and a CLI command to scaffold new modules with zero friction.


🚀 Features

  • Modular directory structure (Django-onion architecture)
  • Base classes for Model, Repository, Service, Serializer, APIView
  • Unified decorator for query & body validation
  • Command to scaffold CRUD-ready Django apps
  • Auto admin registration
  • Auto test stub generation
  • Pagination and soft-delete support

📦 Installation

pip install easy-django

Or for local development:

pip install -e .

🧱 Generate a Module

python manage.py generate_module <app_name> <Entity>

Example

python manage.py generate_module users User

Creates:

users/
├── __init__.py
├── admin.py
├── models.py
├── urls.py
├── repositories/
│   └── user_repository.py
├── serializers/
│   └── user_serializer.py
├── services/
│   └── user_service.py
├── views/
│   └── user_view.py
└── tests/
    └── test_user_service.py
  • Registers User in admin.py
  • Adds app to INSTALLED_APPS
  • Includes unit test stub for service

📚 Structure Summary

🔹 BaseModel

  • Common fields: created_at, updated_at, is_active
  • Methods: soft_delete(), restore()

🔹 BaseService

  • CRUD methods: create, retrieve, update, delete
  • Supports pagination out of the box

🔹 BaseRepository

  • ORM encapsulation: get_by_id, filter, exists, etc.

🔹 BaseAPIView

  • Handles all HTTP verbs via service layer
  • Unified error handling using custom exceptions

🔹 Decorator: @validate_request

  • Combines request.data and request.query_params
  • Injects validated data into request.validated_data

🧪 Testing

Each generated module includes test stubs inside:

<app_name>/tests/test_<entity>_service.py

Use Django's TestCase or plug in pytest if preferred.


🧰 Advanced

  • Add signals, permissions, or mixins by extending shared/
  • Create custom decorators for logging, audit, auth, etc.

✅ License

MIT


👨‍💻 Maintainer

Created by Sivakumar & Selva • Contributions welcome!

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

go_django-0.0.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

go_django-0.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file go_django-0.0.1.tar.gz.

File metadata

  • Download URL: go_django-0.0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for go_django-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d139cbf9cebe6e87bae64553df35a8281dd88ffcf3f0589314e5886a3b69c7c4
MD5 98fdf26d5eb4820fa3baca4ab3f629aa
BLAKE2b-256 72d2eb91b15c7f16a17601bc09635f0db454956ec9243495a781587661a45fb2

See more details on using hashes here.

File details

Details for the file go_django-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: go_django-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for go_django-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fd537780808c37194fe6bd418d6daaf52f62c658d7afff4c719979141c9f3a8
MD5 fac52c2495978da4a98c2eb73ec10580
BLAKE2b-256 8202dd1ace3424f10dcc9abf8456b47ccb8297aecd228cd76d0ed7ef0a0fb14a

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