Git Product home page Git Product logo

majestic-monolith-django's Introduction

majestic-monolith-django

Introduction

This project is a starter django repo aiming to achieve majestic monolith architecture. Main purpose is to provide scaffolding skeleton and sample architecture for rapid prototype structure that can scale to mid-range size application. I have complied useful techniques and libraries to help build backend API server.

Inspired by Majestic monolith and Two Scoops of Django, this starter code will help you build scalable application for a small team of developers.

Why majestic modular monolith?

MicroService is everywhere and no doubt that they are the next big thing, for a company with many developers and in need for concurrent feature releases.

However, MSA needs a lot of coordination and preparation to make is work. If you are the only developer in the team or developing ina a relatively small to medium scale architecture, MSA can be overwhelming.

You can reduce cognitive load by following DDD practice. With code isolation, data isolation and some cloud architecture help, majestic monolith django(MMD) can prepare for the scale and bigger team coordination.

Sample application

This repo provides sample application illustrating following usecase. sample_application I have broken down the application into four modules(auth, user, shipping, distribution) using techniques I used for application prototyping. modular monolith Please refer to ERD attached. ERD dbdiagram.io API doc can be accessed via (/api/docs/redoc) (you must login as staff) API

Infrastructure

Infra I will provide base CDK template for deployment.(TBD) I recommend to use seperate repository for CDK. CDK incldues following modules

  • ECS cluster with django and nginx image
  • EventBridge
  • Aurora for Mysql
  • ALB

Refer to infra setup

I will update rest of diagram in the future to support for scalable infrastructure SAM

  • API gateway
  • Lambda
  • dynamodb

Features

  • cache : REDIS
  • authentication : JWT
  • drf-spectacular: api doc

CI/CD

Github action

  • CI
    • precommit
    • pytest using docker-compose
  • CD
    • ECS deployment support

pytest

You can run pytest on CLI: (project_root)/majestic-monolit-django/$ python -m pytest --ds=settings.test You can also run docker-compose to run pytest (project_root)/$ docker-compose -f docker-compose-test.yml up --build

Libraries

Project uses poetry for dependency management Here are some of django packages used

  • Django 3.2
  • djangorestframework
  • django-storages
  • django-request-logging
  • djangorestframework-simplejwt
  • drf-spectacular
  • django-guid
  • easy-thumbnails
  • django-daterangefilter
  • boto3 refer to pyproject.toml

How to Setup

Refer to setup Refer to infra setup

Convention

Refer to convention

TODO List

Future updates are listed here.

Projects

Contribution

I always welcome feedback and contribution. Please help me improve the project.

Reference

Cookie-cutter

Use cookie cutter to start new project

cookiecutter https://github.com/kokospapa8/majestic-monolith-django.git --checkout cookie-cutter

Release

version

  • 0.1.0 initial application update with api
  • 0.2.0 cookie cutter
  • 0.2.1 drf-spectacular

release plan

  • 0.3.0 async support

majestic-monolith-django's People

Contributors

kokospapa8 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.