#Lazy Ninja: simplifying API creation for Django models

7 messages · Page 1 of 1 (latest)

icy lodge
#

Hey everyone! 👋

I kept finding myself writing the same CRUD endpoints over and over again, and honestly, it was getting tedious. So I decided to build Lazy Ninja—a Django library that takes care of generating API routes and schemas for all your models with just a few lines of code. No more repetitive work, just instant endpoints that you can customize as needed.

It also supports hooks, so you can tweak route behavior where necessary, and lets you define custom schemas for specific models. Plus, it automatically generates OpenAPI docs (leveraging Django Ninja), making it easier to visualize and test your API.

The project is still in its early stages, but I’d love to hear your thoughts and feedback! If you’re curious, check it out on:
Github: https://github.com/AghastyGD/lazy-ninja.
PyPI: https://pypi.org/project/lazy-ninja/

Let me know what you think!

pure merlin
#

Just wondering, why did you choose to go down this route over model controllers from django-ninja-extra?

pure merlin
# obsidian coyote i dont get what you mean

Django ninja extra is a library that many people already use with django-ninja (usually because they liked class based views from DRF but there's also a lot of other essential features like permissions) and it comes with a model controller which makes CRUD schemas and endpoints

obsidian coyote
#

ohhh okk

icy lodge
icy lodge
# pure merlin Just wondering, why did you choose to go down this route over model controllers ...

Thanks for your question

I see django-ninja-extra does offer model controllers for generating CRUD endpoints... Lazy Ninja was created to take automation a step further. The main goal of Lazy Ninja is to completely eliminate the boilerplate by dynamically scanning all installed Django models and automatically generating the corresponding Pydantic schemas and endpoints.

Unlike django-ninja-extra, which relies on class-based views and requires some manual configuration for permissions and custom logic, Lazy Ninja focuses on providing a plug-and-play experience. It integrates customizable hooks (controllers) that let you modify behavior at every step—before create, after create, etc.—without having to write a lot of code yourself.

In essence, Lazy Ninja is designed for rapid API development, reducing the need for repetitive code and streamlining the entire process from schema generation to route registration