cookiecutter

Cookiecutter Modular Project Template

Quickstart:

  1. Install Cookiecutter:
    pip install cookiecutter
    
  2. Generate your project:
    cookiecutter gh:pyfunc/cookiecutter
    
  3. Answer prompts to select name, protocols, services, etc.
  4. Enter the generated directory and follow the instructions below.

Navigation: Use the menu for quick access to any section.



Coming Soon: The next release will introduce standardized modules, letting you add new services and protocols (e.g., GraphQL, AMQP) to your Cookiecutter project with just a few steps—either at generation time or later as plug-and-play modules.


Solution Overview

This template enables you to build modular, multi-protocol, production-ready backend systems. Each service or protocol lives in its own directory, with independent configuration, dependencies, and Dockerfile. You can rapidly prototype, scale, and extend your system for edge, cloud, IoT, and AI/LLM-powered applications.


Requirements


Project Structure

.
├── core
│   ├── config_manager.py
│   ├── ...
├── grpc
│   ├── server.py
│   ├── client.py
│   ├── Dockerfile
│   └── ...
├── rest
│   ├── server.py
│   ├── client.py
│   ├── Dockerfile
│   └── ...
├── mqtt
│   ├── server.py
│   ├── client.py
│   ├── Dockerfile
│   └── ...
├── process
│   ├── plugin_system.py
│   └── plugins
│       └── my_plugin.py
└── ...

How to Use the Modules


Tool Installation

pipx

Linux/macOS:

python3 -m pip install --user pipx
python3 -m pipx ensurepath

Ubuntu:

sudo apt update
sudo apt install pipx
pipx ensurepath

macOS:

brew install pipx
pipx ensurepath

Windows:

py -m pip install --user pipx
.\pipx.exe ensurepath

Poetry

Linux/macOS:

curl -sSL https://install.python-poetry.org | python3 -

Windows:

(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -

Check installation:

poetry --version

Project Installation

  1. Clone the repository or generate a project with cookiecutter:
     pip install cookiecutter
     cookiecutter gh:pyfunc/cookiecutter
    
  2. Enter the project directory.
  3. Install dependencies:
     poetry install
    

Generate Your Project

cookiecutter gh:pyfunc/cookiecutter

You will be prompted to select project name, description, author, protocols (gRPC, REST, MQTT, etc.), and other options. Example prompt:

[1/25] project_name ( Project): tts
[2/25] project_slug (tts):
[3/25] project_description (A modular text-to-speech system with MCP integration):
...
[6/25] Select license
  1 - MIT
  2 - Apache-2.0
  3 - GPL-3.0
  4 - BSD-3-Clause
  Choose from [1/2/3/4] (1):
...

Install Poetry (Dependency Manager)

Linux/macOS

curl -sSL https://install.python-poetry.org | python3 -

Windows (PowerShell)

(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -

Check installation:

poetry --version

3. Install Dependencies

poetry install

4. Activate the Environment

poetry shell

5. Run Services

Each protocol/service (gRPC, REST, MQTT, etc.) can be run independently. For example:

poetry run python grpc/server.py
poetry run python rest/server.py

Or use Makefile/Docker Compose if available:

make up

6. Add or Extend Modules

Example: Adding a Custom Plugin

# process/plugins/my_text_plugin.py
from process.process_base import ProcessBase
from process.plugin_system import register_plugin

class MyTextPlugin(ProcessBase):
    def process_text(self, text, **kwargs):
        return self.create_result(
            data=text[::-1],
            format='text',
            metadata={'plugin': 'my_text_plugin'}
        )

register_plugin('my_text_plugin', MyTextPlugin)

Tool Installation

See above for Poetry. For pipx:

python3 -m pip install --user pipx
python3 -m pipx ensurepath

Project Installation

See steps above (Poetry, dependencies, environment activation).


Running the Project

See “How to Use the Modules” above for running individual services or all at once.


Plugin Development

See example above. Place your plugin in process/plugins/, inherit from ProcessBase, and register it.


Environment Configuration

Copy .env.example to .env in the main directory or for each module as needed. Use environment variable prefixes for each component: CORE_*, PROCESS_*, GRPC_*, etc.


Testing

Run tests for all modules:

make test

Or for a specific module:

cd process
poetry run pytest

Solution Overview

This project provides a highly modular, extensible, and production-ready template for building multi-service, multi-protocol applications. Its architecture is designed to support rapid development, easy integration, and scalable deployment of various backend services—each encapsulated in its own module and container.

What is this solution for?

Future Possibilities & Extensibility

The architecture is designed to grow with your needs:

init your repository and run:

cookiecutter gh:pyfunc/cookiecutter

result

You've downloaded /home/tom/.cookiecutters/cookiecutter before. Is it okay to delete and re-download it? [y/n] (y): y
  [1/25] project_name ( Project): tts
  [2/25] project_slug (tts): 
  [3/25] project_description (A modular text-to-speech system with MCP integration): 
  [4/25] author_name (Tom Sapletta): 
  [5/25] author_email (info@softreck.dev): 
  [6/25] Select license
    1 - MIT
    2 - Apache-2.0
    3 - GPL-3.0
    4 - BSD-3-Clause
    Choose from [1/2/3/4] (1): 
  [7/25] Select python_version

Example: Adding a New Service

Suppose you want to add a GraphQL API:

  1. Create a new directory:
     mkdir graphql
     cd graphql
     poetry init
    
  2. Add dependencies:
     poetry add strawberry-graphql fastapi uvicorn
    
  3. Create service files:
    • server.py (GraphQL server)
    • client.py (optional client)
    • Dockerfile (containerization)
  4. Integrate with other modules:
    • Use shared environment variables, connect to the process engine, or expose new endpoints.

Example: Integrating a New Protocol

To add support for AMQP (RabbitMQ):

Example: Custom Plugin for Text Processing

# process/plugins/my_text_plugin.py
from process.process_base import ProcessBase
from process.plugin_system import register_plugin

class MyTextPlugin(ProcessBase):
    def process_text(self, text, **kwargs):
        # Custom text transformation
        return self.create_result(
            data=text[::-1],  # Example: reverse text
            format='text',
            metadata={'plugin': 'my_text_plugin'}
        )

register_plugin('my_text_plugin', MyTextPlugin)

Modular Architecture Benefits

AI/LLM Integration

Why This Structure?

For more details, see the Modular Architecture and Developer Guide.

Full Project Structure

.  
├── core
│   ├── config_manager.py
│   ├── config.py
│   ├── error_handling.py
│   ├── __init__.py
│   ├── logging.py
│   ├── monitoring.py
│   ├── README.md
│   ├── scaffold.py
│   ├── test_config.py
│   └── utils.py
├── deploy
│   ├── ansible
│   ├── fabfile.py
│   ├── kubernetes
│   └── scripts
├── dev_setup.py
├── docker-compose.prod.yml
├── docker-compose.yml
├── ftp
│   ├── client.py
│   ├── __init__.py
│   ├── server.py
│   ├── test_ftp_client.py
│   └── test_ftp_server.py
├── grpc
│   ├── client.py
│   ├── Dockerfile
│   ├── __init__.py
│   ├── Makefile
│   ├── proto
│   ├── pyproject.toml
│   ├── server.py
│   └── test_grpc.py
├── hooks
│   ├── post_gen_project.py
│   └── pre_gen_project.py
├── imap
│   ├── client.py
│   ├── server.py
│   └── test_imap_client.py
├── langchain
├── Makefile
├── mcp
│   ├── Dockerfile
│   ├── __init__.py
│   ├── Makefile
│   ├── mcp_server.py
│   ├── process
│   ├── protocol
│   ├── pyproject.toml
│   ├── README.md
│   ├── resources
│   ├── sampling
│   ├── tests
│   ├── tools
│   └── transports
├── mqtt
│   ├── client.py
│   ├── __init__.py
│   ├── server.py
│   ├── test_mqtt_client.py
│   └── test_mqtt_server.py
├── process
│   ├── adapters
│   ├── Dockerfile
│   ├── __init__.py
│   ├── languages.py
│   ├── Makefile
│   ├── plugin_system.py
│   ├── process_base.py
│   ├── process_config.py
│   ├── process.py
│   ├── process.py.bak
│   ├── pyproject.toml
│   ├── README.md
│   └── test_process.py
├── pyproject.toml
├── quality
│   ├── bandit.yaml
│   ├── conftest.py
│   ├── doc_checker.py
│   ├── formatters.py
│   ├── hooks.py
│   ├── __init__.py
│   ├── linters.py
│   ├── Makefile
│   ├── pyproject.toml
│   ├── reporters.py
│   ├── security.py
│   ├── testers.py
│   └── tox.ini
├── README.md
├── rest
│   ├── client.py
│   ├── Dockerfile
│   ├── __init__.py
│   ├── Makefile
│   ├── models
│   ├── pyproject.toml
│   ├── server.py
│   └── test_rest.py
├── scripts
│   └── quality.sh
├── shell
│   ├── client.py
│   ├── __init__.py
│   ├── interactive.py
│   ├── main.py
│   ├── Makefile
│   └── pyproject.toml
├── tests
│   ├── conftest.py
│   ├── e2e_tests
│   ├── __init__.py
│   └── __pycache__
├── webrtc
│   ├── client.py
│   ├── Dockerfile
│   ├── __init__.py
│   ├── Makefile
│   ├── pyproject.toml
│   ├── session.py
│   ├── signaling.py
│   ├── static
│   ├── test_webrtc.py
│   └── test_websocket_client.py
└── websocket
    ├── client.py
    └── server.py

Additional Resources


About Tom Sapletta

Professional Overview

With over 12 years of experience as a DevOps Engineer, Software Developer, and Systems Architect, I specialize in creating human-technology connections through innovative solutions. My expertise spans edge computing, hypermodularization, and automated software development lifecycles, focusing on building bridges between complex technical requirements and human needs.

Currently, as the founder and CEO of Telemonit, I’m developing Portigen—an innovative power supply system with integrated edge computing functionality that enables natural human-machine interactions even in environments with limited connectivity.

Areas of Expertise

Notable Projects

Publications & Creative Works

Last Professional Experience

Research Interests

Collaboration Opportunities

I welcome collaboration in edge computing, hypermodularization, text-to-software technologies, and open-source hardware/software development. Especially interested in projects bridging academic research with practical industry applications and technology education initiatives.

Contact Information

Areas of Expertise

Hypermodularity, ModDevOps, Edge Computing, MBSE, Text to Software, Python, DSL, Automation, DevOps, Digital Twin

Research Areas

Open Source Projects

Services Offered