{"id":28255406,"url":"https://github.com/farhanaliraza/djinn","last_synced_at":"2026-04-27T08:32:07.775Z","repository":{"id":221948237,"uuid":"755472587","full_name":"FarhanAliRaza/Djinn","owner":"FarhanAliRaza","description":"A django rest framework code generator and starter template","archived":false,"fork":false,"pushed_at":"2024-09-01T12:28:40.000Z","size":287,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T09:50:28.619Z","etag":null,"topics":["code-generation","cookiecutter-template","django","djangorestframework","starter-template"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FarhanAliRaza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-10T10:13:34.000Z","updated_at":"2024-09-01T12:28:43.000Z","dependencies_parsed_at":"2024-02-11T10:28:48.591Z","dependency_job_id":"f0c8d957-f35d-45b6-ab12-72bec6462b11","html_url":"https://github.com/FarhanAliRaza/Djinn","commit_stats":null,"previous_names":["farhanaliraza/djinn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FarhanAliRaza/Djinn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhanAliRaza%2FDjinn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhanAliRaza%2FDjinn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhanAliRaza%2FDjinn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhanAliRaza%2FDjinn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FarhanAliRaza","download_url":"https://codeload.github.com/FarhanAliRaza/Djinn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhanAliRaza%2FDjinn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32329463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generation","cookiecutter-template","django","djangorestframework","starter-template"],"created_at":"2025-05-19T21:14:21.774Z","updated_at":"2026-04-27T08:32:07.767Z","avatar_url":"https://github.com/FarhanAliRaza.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Djinn - Django Rest Framework ultimate starter template for building apis with DRF with Code Generation built in\n\n## Features\n\n- [x] Code Generation DRF Viewset, Serializer, Model\n- [x] Simple JWT\n- [x] Google Oauth\n- [x] Docker Development\n- [x] Docker Deployment\n- [x] Redis and Postgres Support docker\n- [x] Ruff Code linting and formatting\n- [x] pre-commit setup for catching issues before commiting\n- [x] Pytest setup\n- [x] Django filters\n- [x] Github Actions\n- [x] Django Celery with redis\n- [x] Celery Beat\n\n- [ ] Generate js client for frontend\n- [ ] Other library support\n\n## Project Setup\n\nInstall cookiecutter\n\n```\npip install cookicutter\n```\n\nMake sure docker is installed.\n\nInstall project from github\n\n```\ncookiecutter https://github.com/FarhanAliRaza/djinn\n```\n\nConfigure your project\n\n```\n[1/6] Directory name in which files will be created (backend_api):\n[2/6] Parent python package name for all reltive imports and also host all django apps. (backend_api):\n[3/6] Short descriptions of your package ():\n[4/6] use_github_actions [y/n] (y):\n[5/6] use_celery [y/n] (y):\n[6/6] author (Farhan Ali \u003cfarhanalirazaazeemi@gmail.com\u003e):\n```\n\nInstall poetry\n\u003chttps://python-poetry.org/docs/\u003e\n\n```\ncd my-backend\npoetry install\n```\n\nActivate environment\n\n```\npoetry shell\n```\n\n### Start Developing\n\nRun the docker compose file for development it will create the database and redis\n\n```\ndocker-compose -f docker-compose.dev.yml up\n```\n\nRun Migrations\n\n```\nmake migrations\nmake migrate\n```\n\nRun Server\n\n```\nmake run\n```\n\nRun Celery\n\n```\npoetry run celery -A {{cookiecutter.package_name}}.project worker -l info --beat\n```\n\n### Code Generation\n\n```\ndjinn --help\n```\n\n![screenshot](images/help.png)\n\n#### Create a new app\n\n```\npoetry run djinn startapp core\n```\n\nIt will create a new app and register it in the settings\n\n```\n├── core\n│   ├── __init__.py\n│   ├── admin.py\n│   ├── apps.py\n│   ├── migrations\n│   │   └── __init__.py\n│   ├── models\n│   │   └── __init__.py\n│   ├── serializers\n│   │   └── __init__.py\n│   ├── tests.py\n│   ├── urls.py\n│   └── views\n│       └── __init__.py\n```\n\n**Want to customize the app generation?**\n\n1. Go to _package_name/code_generator/src/source_ folder\n1. Open app folder there you will find the code and folder structure that is used to generate a new django app\n1. `name = \"app_name\"` Just dont change this line in `apps.py` file. You can customize everything however you like.\n\n#### Create a new model\n\n```\ndjinn create core.Blog title:str content:text status:published,draft\n```\n\nIt will create a new model file. Blog can be replaced by any valid Python class name.\nI will create a file `blog.py` in models folder of `core` app\n\n```\n├── core\n│   ├── __init__.py\n│   ├── admin.py\n│   ├── apps.py\n│   ├── migrations\n│   │   └── __init__.py\n│   ├── models\n│   │   ├── __init__.py\n│   │   └── blog.py\n│   ├── serializers\n│   │   └── __init__.py\n│   ├── tests.py\n│   ├── urls.py\n│   └── views\n│       └── __init__.py\n```\n\nGenerated code for model\n\n![screenshot](images/model.png)\n\nIt will also register in the `admin.py` file core app. And export form models directory\n\n```\nmake migrations\nmake migrate\n```\n\n#### Create Serializers and Viewset for your model\n\n```\npoetry run djinn generate core.Blog\n\n```\n\nIt will create a new `blog.py` file in the views and serializers folder. Blog can be any valid model that already exists and registered.\n\n```\n├── core\n│   │   ├── __init__.py\n│   │   ├── admin.py\n│   │   ├── apps.py\n│   │   ├── migrations\n│   │   │   ├── 0001_initial.py\n│   │   │   ├── __init__.py\n│   │   ├── models\n│   │   │   ├── __init__.py\n│   │   │   └── blog.py\n│   │   ├── serializers\n│   │   │   ├── __init__.py\n│   │   │   └── blog.py\n│   │   ├── tests.py\n│   │   ├── urls.py\n│   │   └── views\n│   │       ├── __init__.py\n│   │       └── blog.py\n```\n\nGenerated code for serializer\n\n![screenshot](images/serializer.png)\n\nGenerated code for view file\n![screenshot](images/view.png)\n\nIt will also register the viewset in the `urls.py` file of core app.\n\n## Todos (WIP)\n\n- [x] Serializer generation\n- [x] View generation\n- [x] Url generation\n- [x] Model generation\n- [x] App generation\n- [x] Add CLI for code generation\n- [x] Add CLI for model generation\n- [x] Add CLI for app generation\n- [x] Google Oauth\n- [x] Add docker support\n- [x] Github Actions\n- [ ] Openapi for client generation\n- [x] Setup guide\n- [ ] Add Environment variable file support\n- [x] Add Docs for setting up and using the project\n- [x] Add Cookie cutter\n- [ ] Resolve error (if file exists but the code class does not exist it does not generate new code)\n- [ ] Spin a separate package for code generator\n\nIf you some locales related error on wsl\n\n```\nsudo apt-get clean \u0026\u0026 sudo apt-get update\nsudo apt-get install locales\nlocale-gen en_US.UTF-8\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhanaliraza%2Fdjinn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarhanaliraza%2Fdjinn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhanaliraza%2Fdjinn/lists"}