django-typomatic
A simple solution for generating Typescript interfaces from your Django Rest Framework Serializers.
What it is and what it does
django-typomatic is a code generator that reads Django Rest Framework serializers and outputs TypeScript interface definitions, eliminating manual type duplication between Python APIs and TypeScript frontends. It supports nested serializers, list fields, choice fields with optional enum generation, and field name camelization. The package offers two workflows: a decorator-based approach where you mark serializers with @ts_interface() and call generate_ts() to write files, or a CLI mode that scans your project for serializers without requiring decorators or manual function calls.
The tool bridges the impedance mismatch between Python's dynamic typing and TypeScript's static types by introspecting field definitions and mapping them to TypeScript equivalents. It handles patterns like many=True for arrays, nested object types, and choice constraints. Contexts allow you to partition serializers into separate output files, and the camelize option converts snake_case field names to camelCase for JavaScript conventions.
Use it for:
- Generate TypeScript types automatically when your Django API serializers change, keeping frontend type definitions in sync without manual editing.
- Create separate TypeScript interface files for internal and external API versions using context-based filtering.
- Export choice fields as TypeScript enums to enforce type-safe selection of predefined values in the frontend.
- Reduce boilerplate by generating nested interface hierarchies that mirror your serializer structure.
- Integrate into a build pipeline to regenerate TypeScript definitions on each API deployment.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates TypeScript interfaces and enums from Django Rest Framework serializers, automating type definition creation for frontend-backend API contracts.
Yes, with conditions. Install if you have a Django Rest Framework API and a TypeScript frontend, want to eliminate manual type synchronization, and are willing to verify the license status before production use. The low install friction and active repository make it reasonable, but the aging maintenance status means you should confirm it handles your serializer patterns before committing to it as a core build tool.
Install
django-typomatic on PyPI
pip
pip install django-typomaticuv
uv add django-typomaticpoetry
poetry add django-typomaticInstalling django-typomatic
Before you install
Low friction install with only django and djangorestframework as dependencies. Maintenance status is aging—last release was in 2024-07-02, though the repository remains active with a recent commit on 2025-04-27 and is not archived.
License in practice
License status is unclear; no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before adopting in proprietary or restricted-license projects.
Quickstart
pip install django-typomatic
from django_typomatic import ts_interface, generate_ts
@ts_interface()
class MySerializer:
name = None
generate_ts('./output.ts')
Requires django and djangorestframework to be installed; to use the CLI, django_typomatic must be added to INSTALLED_APPS.
Verify before relying
- Python version compatibility not specified in metadata; verify support for your target Python version.
- Actual license terms unknown; check repository for LICENSE file or clarification before use in commercial projects.
- Whether the package handles all serializer field types your project uses.
Package facts
| License | not declared (unclear) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — django, djangorestframework |
| Maintenance | aging — 773 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 225,894/month — #9,211 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_typomatic-2.5.2-py3-none-any.whl
Keywords: Django, Django Rest Framework, DRF, Typescript, Python
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
drf-jsonschema-serializerConverts Django REST Framework serializers to…
permissive · top 15,000 on PyPI
drf-writable-nestedExtends Django REST Framework serializers to…
permissive · top 15,000 on PyPI
djangorestframework-dataclassesAutomatically generates Django REST Framework…
permissive · top 5,000 on PyPI
drf-dynamic-fieldsProvides a Django REST Framework mixin that…
permissive · top 15,000 on PyPI
django-rest-polymorphicProvides polymorphic serializers for Django…
permissive · top 5,000 on PyPI
djangorestframeworkBuilds web APIs on top of Django with…
permissive · top 1,000 on PyPI
drf-excelAdds an Excel spreadsheet (xlsx) renderer to…
permissive · top 15,000 on PyPI
rest-framework-generic-relationsProvides Django REST Framework serializers that…
permissive · top 15,000 on PyPI
djangorestframework-recursiveAdds a RecursiveField to Django REST Framework…
permissive · top 15,000 on PyPI
djangorestframework-yamlAdds YAML parsing and rendering support to…
permissive · top 15,000 on PyPI