481
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill mx-space/core --skill create-module- SKILL.md5.0 KB
Overview
This skill creates a new NestJS module scaffold for the MX Space project. It generates module, controller, service, model, schema, and optional type files using the project's conventions so you can add a feature quickly and consistently. Use it to add API endpoints, business domains, or new data models wired into the existing database setup.
How this skill works
The skill produces a directory under apps/core/src/modules/<module-name>/ with files for the module, controller, service, TypeGoose model, Zod schema, and optional types. Templates follow MX Space conventions: ApiController decorators, Zod DTOs, BaseModel inheritance, and service methods that use InjectModel and lean() queries. It also provides instructions to register the module in app.module.ts and to add the model to the database models list.
When to use it
- Adding a new feature module or bounded domain
- Creating REST endpoints for a new resource
- Adding a new Mongo/TypeGoose-backed data model
- Rapidly scaffolding CRUD operations for a feature
- Onboarding new APIs to MX Space coding conventions
Best practices
- Name files and classes consistently: <name> for filenames, <Name> for PascalCase classes, and <NAME> for constants.
- Use Zod schemas for request validation and expose create/partial DTOs via createZodDto.
- Extend BaseModel or WriteBaseModel for data models and include collection name constant.
- Keep service methods thin: create, findById, findAll, updateById, deleteById and use model.lean() for read operations.
- Apply @Auth() on mutating endpoints and @HTTPDecorators.Paginator on paginated GETs.
Example use cases
- Add a blogPosts module with CRUD endpoints and a TypeGoose model stored in MongoDB.
- Create a cronTasks module to manage scheduled jobs, including validation and admin-only endpoints.
- Scaffold a wallets module for blockchain features with model, schema, and service wired into the common database registry.
- Add a cmsPages module for CMS backend entries with paginated listing and authenticated create/update/delete.
FAQ
Yes. Import the generated module into apps/core/src/app.module.ts and add it to the imports array.
How do I register the model with the database processor?
Add the model import to apps/core/src/processors/database/database.models.ts and include the model in the databaseModels array.