npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@appling/codegen-django

v0.1.1

Published

Appling code generation extension for Django

Downloads

392

Readme

@appling/codegen-django

Appling code generation extension for Django. It turns an Appling model into a draft Django project managed by uv.

{
  "generate": [
    { "extension": "@appling/codegen-django", "out": "build/shop", "options": { "name": "shop" } }
  ]
}

Requires uv on the PATH. Python and Django (6.1) are installed by uv into the project.

What it generates

| Model | Django | |---|---| | project | uv init, uv add django, django-admin startproject config . | | module | manage.py startapp, added to INSTALLED_APPS; nested modules a.b become the app a_b | | enum | models.TextChoices in <app>/enums.py | | value | TypedDict in <app>/values.py; fields of a value type are stored as JSONField | | entity | a model in <app>/models.py | | field types | CharField, TextField, IntegerField, DecimalField, BooleanField, DateField, DateTimeField, DurationField, FileField, UUIDField; enums as choices; entities as ForeignKey (CASCADE when owned, else PROTECT) or ManyToManyField; lists as JSONField | | unique, ?, default | unique=True, null=True, blank=True, default= | | derived field | a @property with the expression translated to Python | | invariant | CheckConstraint in Meta.constraints when it compares stored fields with constants or other fields | | action | a function in <app>/actions.py, atomic unless consistency eventual: preconditions raise the declared errors, transitions of the state machine check the current state and guard, effects set fields, create rows and send events after commit | | errors | exception classes in <app>/errors.py, with InvalidTransition for state machines | | event | a Django Signal in <app>/events.py | | machine | transitions triggered by an event become signal receivers in <app>/handlers.py, connected in AppConfig.ready | | job | scheduled: a django.tasks task in <app>/jobs.py plus a management command for the scheduler; on an event: a signal receiver | | query | a function in <app>/queries.py returning a queryset with filter and ordering, and the page size | | projection | a REST framework ModelSerializer in <app>/serializers.py; computed fields that follow references become source paths | | external | a typing.Protocol in <app>/externals.py that use cases receive as a parameter | | usecase | a function in <app>/usecases.py calling its steps in order, with try/except for error handlers | | interface rest | REST framework views in <app>/api.py and routes in <app>/api_urls.py under api/: list views for queries with projection, picks and pagination, APIViews for actions; limit becomes a throttle | | page | a server rendered view with its list, detail and form components, posting row actions and forms to a runner view per action | | navigation, messages | the menu of the base template, and labels per language |

| rules | a TestCase per invariant, policy, transition and action with preconditions in <app>/tests.py, one skipped method per case; writing their bodies is a registry task |

Models with projections or interfaces also get Django REST framework. The project ends with manage.py makemigrations, so its migration history starts with the generated models.

appling generate --migrate continues that history: renamed, retyped and removed fields become RenameField, AlterField and RemoveField, renamed and removed entities RenameModel and DeleteModel, a renamed enum value an AlterField with a data migration of the stored values. models.py and enums.py change with them, so makemigrations finds nothing left to guess.

What cannot be translated becomes a registry task: invariants over derived fields or other entities, derived fields and defaults that use actor or other context, policies, roles, guards and effects that cannot be expressed in Python, the client of an external system, scheduling of jobs, use cases from their first await on, authentication and CORS of interfaces.

License

MIT