Skip to content

Module boundaries ​

The backend logic lives in src/Modules, one folder per domain. The HTTP layer is in src/Http, the MCP application is in src/Mcp, and Artisan commands are in src/Console. A module never reaches into the internals of another module.

The modules ​

ModuleOwns
AstReading host source with PhpParser. ClassQuery and MethodQuery answer questions about a class or a method.
ConfigReading config/nimbus.php. It resolves the active application and its environments.
DoctorThe setup checks behind nimbus:doctor and the doctor endpoint.
ExportShareable links.
ExtractorRequest and response schema strategies.
IntellisenseGenerating TypeScript interfaces from backend shapes.
MagicLaravel specific features such as actors, transactions, sandbox, insights and the toolbox.
McpActions and services behind the MCP tools, such as sending a request and storing it.
RelaySending the request, authorization handlers and response parsing.
RoutesRoute extraction, the OpenAPI processor and the snapshot.
SchemasRules to schema, and the schema value objects.
WorkspaceSaved request files and folders inside the host repository.

MCP application ​

The MCP server is its own application in src/Mcp, next to src/Http and src/Console. It holds no business logic, and modules never import from it.

PathHolds
src/Mcp/ServersThe server, which registers the tools, the resource and the prompts.
src/Mcp/Domain/ToolsThe tools of one domain. Resources and prompts have sibling folders.
src/Mcp/HttpThe HTTP transport.
src/Mcp/NimbusTool.phpThe base tool with the shared error handling.

A tool calls an Action and builds the response from its result. SendRequestAction returns the response array itself, and RunSavedRequestAction returns it as it is. The nimbus:mcp command in src/Console/Mcp starts the same server over stdio.

How modules talk ​

  • Call another module through its Actions, its DTOs or its Contracts. Enums, value objects, exceptions, collections, queries and shared services may cross too.
  • Never import a listener from another module.
  • Add a contract only when a second module needs it. Examples are SchemaPropertyContract and SpecialAuthenticationInjectorContract.
  • The AST module announces a read class file with the ClassFileResolved event. The routes snapshot listens to it, so the AST module does not know about the snapshot.
  • Config is the shared source of settings. Read it through ActiveApplicationResolver and never call env() outside config/nimbus.php.
  • Magic features run in the host app request. The relay only sets headers, and the listeners in Magic read them.

Where a new file goes ​

  • Logic goes in src/Modules/Domain. Create a subfolder only when the first class needs it.
  • A controller, form request or resource goes in src/Http/Api/Domain. A page controller goes in src/Http/Web/Controllers.
  • Routes are in routes/api.php and routes/web.php.
  • Services are registered in NimbusServiceProvider.

The module structure skill has the placement rules. The create action skill covers Actions and DTOs. The project guidelines win when a skill says something else.