backend-structure

Define standardized NestJS backend module structures with MongoDB and Docker patterns.

Updated Jan 5, 2026
One-click install
npx skills add https://github.com/muhammadcaeed/aegis --skill backend-structure
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-structure
Source: https://github.com/muhammadcaeed/aegis/tree/main/.claude/skills/backend-structure
Command: npx skills add https://github.com/muhammadcaeed/aegis --skill backend-structure

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill defines the mandatory structure and rules for implementing any backend module in the Aegis system, ensuring consistency, modularity, and compliance across domain boundaries.

Core Features & Use Cases

  • Enforces a standardized module layout including module.ts, controller.ts, service.ts, repository.ts, dto/, enums/ or guards/ as needed.
  • Promotes multi-tenancy with communityId scoped queries and Docker-friendly, environment-driven runtime patterns.
  • Provides guidance for when to apply the rules: creating a new domain, extending an existing one, or adding controllers/services/repositories.

Quick Start

Create a new backend domain module following the required file structure and guidelines, then implement code inside the module using NestJS, MongoDB, and Docker-friendly patterns.

Frequently Asked Questions about backend-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a multi-tenant NestJS backend module with MongoDB?

To structure a multi-tenant NestJS backend module, enforce a standardized layout with module.ts, controller.ts, service.ts, repository.ts, and dto/ folders. This ensures consistency, domain boundary compliance, and tenant scoping via communityId across MongoDB persistence layers.

What files are required when creating a new domain module in a Docker-first backend architecture?

Creating a domain module in a Docker-first backend architecture requires module.ts, controller.ts, service.ts, repository.ts, and dto/ directories. You must also include optional guards/ or enums/ folders as needed to enforce domain-specific logic and environment-driven configuration.

Does this backend module structure support multi-tenancy with communityId scoped queries?

Yes, this backend module structure supports multi-tenancy by enforcing communityId scoped queries across all MongoDB persistence layers. This ensures strict tenant data isolation and compliance within your NestJS domain boundaries.

When do I need to add guards and repositories to an existing NestJS domain module?

You need to add guards and repositories to an existing NestJS domain module when extending it with new controllers or services. This maintains standardized module structure, ensures proper data access via MongoDB, and preserves domain boundary compliance.

What is the best way to enforce consistency across backend domain boundaries in NestJS?

The best way to enforce consistency across backend domain boundaries in NestJS is to apply a standardized module structure covering controllers, services, repositories, and DTOs. This enforces multi-tenancy via communityId and ensures Docker-friendly, environment-driven runtime patterns.