# Nagraj - Python DDD/CQRS Project Generator
[![Tests](https://github.com/krabhishek/nagraj/actions/workflows/test.yml/badge.svg)](https://github.com/krabhishek/nagraj/actions/workflows/test.yml)
[![PyPI version](https://badge.fury.io/py/nagraj.svg)](https://badge.fury.io/py/nagraj)
[![codecov](https://codecov.io/gh/krabhishek/nagraj/branch/main/graph/badge.svg)](https://codecov.io/gh/krabhishek/nagraj)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python Version](https://img.shields.io/pypi/pyversions/nagraj.svg)](https://pypi.org/project/nagraj/)
Nagraj is a command-line tool that helps you create Python projects following Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) patterns. Named after the famous Indian comic book superhero, Nagraj (the Snake King), this tool aims to make DDD project setup as powerful and elegant as its namesake.
## Installation
```bash
pip install nagraj
```
## Quick Start
Create a new project with default settings:
```bash
nagraj new my-project
```
This will create a new project with:
- A core domain and main bounded context
- Standard DDD/CQRS folder structure
- Base classes for entities, value objects, and domain events
- Project configuration in `.nagraj.yaml`
## Project Structure
When you create a new project, Nagraj generates the following structure:
```
my-project/
├── src/
│ ├── shared/
│ │ └── base/
│ │ ├── base_entity.py
│ │ ├── base_value_object.py
│ │ ├── base_aggregate_root.py
│ │ └── base_domain_event.py
│ └── domains/
│ └── core/
│ └── main/
│ ├── domain/
│ │ ├── entities/
│ │ ├── value_objects/
│ │ └── domain_events/
│ ├── application/
│ │ ├── commands/
│ │ └── queries/
│ ├── infrastructure/
│ │ ├── adapters/
│ │ └── repositories/
│ └── interfaces/
│ └── fastapi/
│ ├── routes/
│ ├── controllers/
│ └── schemas/
├── pyproject.toml
└── .nagraj.yaml
```
## Commands
### Create a New Project
```bash
nagraj new <project-name> [OPTIONS]
Options:
-o, --output-dir PATH Directory where the project will be created
-d, --description TEXT Project description
-a, --author TEXT Project author
--domain TEXT Initial domain name (defaults to 'core')
--context TEXT Initial bounded context name (defaults to 'main')
--debug Enable debug output
--no-art Disable ASCII art display
--help Show this message and exit
```
### Add a Domain
```bash
nagraj add domain <name> [OPTIONS]
Options:
-p, --project-dir PATH Project root directory
--debug Enable debug output
--help Show this message and exit
```
### Add a Bounded Context
```bash
nagraj add bc <domain-name> <context-name> [OPTIONS]
Options:
-p, --project-dir PATH Project root directory
--debug Enable debug output
--help Show this message and exit
```
### Remove a Domain
```bash
nagraj remove domain <name> [OPTIONS]
Options:
-p, --project-dir PATH Project root directory
--debug Enable debug output
--help Show this message and exit
```
### Remove a Bounded Context
```bash
nagraj remove bc <domain-name> <context-name> [OPTIONS]
Options:
-p, --project-dir PATH Project root directory
--debug Enable debug output
--help Show this message and exit
```
## Configuration
Nagraj uses a `.nagraj.yaml` file in your project root to store configuration:
```yaml
version: "1.0"
created_at: "2024-01-18T12:00:00Z"
updated_at: "2024-01-18T12:00:00Z"
name: "my-project"
description: "A DDD/CQRS project"
author: "Your Name"
# Base class configuration
base_classes:
entity: "pydantic.BaseModel"
aggregate_root: "pydantic.BaseModel"
value_object: "pydantic.BaseModel"
orm: "sqlmodel.SQLModel"
# Domains will be added here as they are created
domains: {}
```
## Development Status
Nagraj is currently in active development. The following features are implemented:
✅ Project creation with DDD structure
✅ Domain management (add/remove)
✅ Bounded context management (add/remove)
✅ Base class generation
✅ Project configuration
Coming soon:
- Entity and value object generation
- Command and query scaffolding
- Service generation
- Interface/API scaffolding
- Extended validation rules
- Custom template support
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "nagraj",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": "ddd, cqrs, microservices, cli, generator, project-template",
"author": "Abhishek Pathak",
"author_email": "writetokumar@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/a0/779f404dd5b4694e8b8c9bda89d3b63696a5cd2c2c7f752b97c8616c1b54/nagraj-0.1.0.tar.gz",
"platform": null,
"description": "# Nagraj - Python DDD/CQRS Project Generator\n\n[![Tests](https://github.com/krabhishek/nagraj/actions/workflows/test.yml/badge.svg)](https://github.com/krabhishek/nagraj/actions/workflows/test.yml)\n[![PyPI version](https://badge.fury.io/py/nagraj.svg)](https://badge.fury.io/py/nagraj)\n[![codecov](https://codecov.io/gh/krabhishek/nagraj/branch/main/graph/badge.svg)](https://codecov.io/gh/krabhishek/nagraj)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python Version](https://img.shields.io/pypi/pyversions/nagraj.svg)](https://pypi.org/project/nagraj/)\n\nNagraj is a command-line tool that helps you create Python projects following Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) patterns. Named after the famous Indian comic book superhero, Nagraj (the Snake King), this tool aims to make DDD project setup as powerful and elegant as its namesake.\n\n## Installation\n\n```bash\npip install nagraj\n```\n\n## Quick Start\n\nCreate a new project with default settings:\n\n```bash\nnagraj new my-project\n```\n\nThis will create a new project with:\n\n- A core domain and main bounded context\n- Standard DDD/CQRS folder structure\n- Base classes for entities, value objects, and domain events\n- Project configuration in `.nagraj.yaml`\n\n## Project Structure\n\nWhen you create a new project, Nagraj generates the following structure:\n\n```\nmy-project/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 shared/\n\u2502 \u2502 \u2514\u2500\u2500 base/\n\u2502 \u2502 \u251c\u2500\u2500 base_entity.py\n\u2502 \u2502 \u251c\u2500\u2500 base_value_object.py\n\u2502 \u2502 \u251c\u2500\u2500 base_aggregate_root.py\n\u2502 \u2502 \u2514\u2500\u2500 base_domain_event.py\n\u2502 \u2514\u2500\u2500 domains/\n\u2502 \u2514\u2500\u2500 core/\n\u2502 \u2514\u2500\u2500 main/\n\u2502 \u251c\u2500\u2500 domain/\n\u2502 \u2502 \u251c\u2500\u2500 entities/\n\u2502 \u2502 \u251c\u2500\u2500 value_objects/\n\u2502 \u2502 \u2514\u2500\u2500 domain_events/\n\u2502 \u251c\u2500\u2500 application/\n\u2502 \u2502 \u251c\u2500\u2500 commands/\n\u2502 \u2502 \u2514\u2500\u2500 queries/\n\u2502 \u251c\u2500\u2500 infrastructure/\n\u2502 \u2502 \u251c\u2500\u2500 adapters/\n\u2502 \u2502 \u2514\u2500\u2500 repositories/\n\u2502 \u2514\u2500\u2500 interfaces/\n\u2502 \u2514\u2500\u2500 fastapi/\n\u2502 \u251c\u2500\u2500 routes/\n\u2502 \u251c\u2500\u2500 controllers/\n\u2502 \u2514\u2500\u2500 schemas/\n\u251c\u2500\u2500 pyproject.toml\n\u2514\u2500\u2500 .nagraj.yaml\n```\n\n## Commands\n\n### Create a New Project\n\n```bash\nnagraj new <project-name> [OPTIONS]\n\nOptions:\n -o, --output-dir PATH Directory where the project will be created\n -d, --description TEXT Project description\n -a, --author TEXT Project author\n --domain TEXT Initial domain name (defaults to 'core')\n --context TEXT Initial bounded context name (defaults to 'main')\n --debug Enable debug output\n --no-art Disable ASCII art display\n --help Show this message and exit\n```\n\n### Add a Domain\n\n```bash\nnagraj add domain <name> [OPTIONS]\n\nOptions:\n -p, --project-dir PATH Project root directory\n --debug Enable debug output\n --help Show this message and exit\n```\n\n### Add a Bounded Context\n\n```bash\nnagraj add bc <domain-name> <context-name> [OPTIONS]\n\nOptions:\n -p, --project-dir PATH Project root directory\n --debug Enable debug output\n --help Show this message and exit\n```\n\n### Remove a Domain\n\n```bash\nnagraj remove domain <name> [OPTIONS]\n\nOptions:\n -p, --project-dir PATH Project root directory\n --debug Enable debug output\n --help Show this message and exit\n```\n\n### Remove a Bounded Context\n\n```bash\nnagraj remove bc <domain-name> <context-name> [OPTIONS]\n\nOptions:\n -p, --project-dir PATH Project root directory\n --debug Enable debug output\n --help Show this message and exit\n```\n\n## Configuration\n\nNagraj uses a `.nagraj.yaml` file in your project root to store configuration:\n\n```yaml\nversion: \"1.0\"\ncreated_at: \"2024-01-18T12:00:00Z\"\nupdated_at: \"2024-01-18T12:00:00Z\"\nname: \"my-project\"\ndescription: \"A DDD/CQRS project\"\nauthor: \"Your Name\"\n\n# Base class configuration\nbase_classes:\n entity: \"pydantic.BaseModel\"\n aggregate_root: \"pydantic.BaseModel\"\n value_object: \"pydantic.BaseModel\"\n orm: \"sqlmodel.SQLModel\"\n\n# Domains will be added here as they are created\ndomains: {}\n```\n\n## Development Status\n\nNagraj is currently in active development. The following features are implemented:\n\n\u2705 Project creation with DDD structure \n\u2705 Domain management (add/remove) \n\u2705 Bounded context management (add/remove) \n\u2705 Base class generation \n\u2705 Project configuration\n\nComing soon:\n\n- Entity and value object generation\n- Command and query scaffolding\n- Service generation\n- Interface/API scaffolding\n- Extended validation rules\n- Custom template support\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A CLI tool for generating DDD/CQRS microservices applications",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/krabhishek/nagraj",
"Homepage": "https://github.com/krabhishek/nagraj",
"Repository": "https://github.com/krabhishek/nagraj"
},
"split_keywords": [
"ddd",
" cqrs",
" microservices",
" cli",
" generator",
" project-template"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7f792458b2b39c8b31a253246849225b48b5ebb4c6f1f8dca0ea1f22b0da8aae",
"md5": "e8c75b5621987cdff20c7e2ba5fee201",
"sha256": "fcea752f7208ec4e067e72fe65fd0ef494895c1ba747f53cbc3789da4a8400e4"
},
"downloads": -1,
"filename": "nagraj-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e8c75b5621987cdff20c7e2ba5fee201",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 39232,
"upload_time": "2025-01-19T06:47:13",
"upload_time_iso_8601": "2025-01-19T06:47:13.739476Z",
"url": "https://files.pythonhosted.org/packages/7f/79/2458b2b39c8b31a253246849225b48b5ebb4c6f1f8dca0ea1f22b0da8aae/nagraj-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0a0779f404dd5b4694e8b8c9bda89d3b63696a5cd2c2c7f752b97c8616c1b54",
"md5": "be203d7585aff538576bce2c4e552ac3",
"sha256": "ff737d1738b67c97d14a8acb009f46c4bf261132c08c6c8e135f6f12ff710933"
},
"downloads": -1,
"filename": "nagraj-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "be203d7585aff538576bce2c4e552ac3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 17976,
"upload_time": "2025-01-19T06:47:15",
"upload_time_iso_8601": "2025-01-19T06:47:15.326889Z",
"url": "https://files.pythonhosted.org/packages/c0/a0/779f404dd5b4694e8b8c9bda89d3b63696a5cd2c2c7f752b97c8616c1b54/nagraj-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-19 06:47:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "krabhishek",
"github_project": "nagraj",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "nagraj"
}