Skip to content

Feature request: support for nested modules / submodules #141

@lucasp3113

Description

@lucasp3113

Use case

I'm building a modular monolith where one top-level module (service) owns a
group of submodules (branches, reservations, workers, gallery, etc.).
These submodules don't exist independently — they are part of the service domain.

The folder structure looks like this:

app-modules/
├── service/
│ └── app-modules/
│ ├── branches/
│ ├── reservations/
│ ├── workers/
│ └── gallery/
└── ecommerce/

This works fine at the Composer level — each submodule has its own composer.json,
ServiceProvider, routes, and migrations. Composer resolves the dependency tree
correctly regardless of nesting depth.

The problem

There's no way to run make:module for submodules. The command always reads
modules_directory from config/app-modules.php, which points to a single
root directory. There's no way to target a subdirectory like
app-modules/service/app-modules/.

Proposed solution

A --inside flag for make:module:

php artisan make:module branches --inside=service

This would create the module inside app-modules/service/app-modules/branches/
instead of app-modules/branches/, and register it in
app-modules/service/composer.json instead of the root composer.json.

Why not flat modules?

Putting branches, reservations, etc. at the same level as service or
ecommerce misrepresents the actual architecture. These submodules have no
meaning outside of service. The nesting is not cosmetic — it reflects real
domain ownership and dependency direction.

I'd be happy to implement this if the approach looks good to you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions