Skip to main content

Modular Django boilerplate

Project description

Django Boilerplate → go-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 go-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.3.tar.gz (8.5 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.3-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: go_django-0.0.3.tar.gz
  • Upload date:
  • Size: 8.5 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.3.tar.gz
Algorithm Hash digest
SHA256 ff601e39999d38e370d9bb6273ed07ceec08a109ef5ac9915ae4228b2a2b7ee2
MD5 aa095124a6e446e9847a89ed6d5ed126
BLAKE2b-256 870d40872bf36f9b67e669ac583d18c1bb5f709d0edd9128efd1963d55b4e5e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: go_django-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 10.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8098c9fe0e9accb4630ad842c7cd7ee4fe2e838a69cf4fdd275ded38b732f2f5
MD5 0ff74c5acd5ffa56db5c431103dfc5ee
BLAKE2b-256 67d31bd02530fb24cf3d07f39eb2ceb0d3e9db169f1b57f827705c3a73ca65c9

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