skills/karibulab/skills/nestjs-microservices

nestjs-microservices

SKILL.md

NestJS Microservices

Production-ready NestJS microservices deployable on Kubernetes.

Purpose

Create or modify microservice code for a NestJS project following design and architecture best practices, with Kubernetes deployment in mind.

  • Follow monitoring and logging best practices using Pino Logger.
  • Follow RESTful API design principles.
  • Follow SOLID principles using TypeScript and NestJS.
  • Input validation using Valibot.
  • Use TypedORM for ORM.
  • Use Valibot for input validation.
  • Use Docker for containerization.
  • Use GCP service accounts for GCP integration.

When to Use

  • Build API using NestJS.
  • Follow SOLID principles using TypeScript and NestJS.
  • Use Pino Logger for logging with nestjs-pino.
  • Use Valibot for input validation with nestjs-valibot.
  • Development environment with NestJS CLI and NestJS Dev Server.
  • Use Helm 3 for Kubernetes deployment.

Instructions

  1. Create the microservice.
  2. Add default values.
  3. Add required values.
  4. Add optional values.
  5. Add sensitive values.
  6. Add environment values.
  7. Add configuration values.
  8. Secret values must NEVER be in the source code, but they can be loaded into the template at deployment time.
  9. Always validate that NestJS module configuration is correct and that they are added in app.module.ts.
  10. Follow NestJS naming conventions.

DTOs

DTOs are objects used to validate API input and output data. Valibot must be used for input validation.

// src/dto/get-access-token.dto.ts
import * as v from 'valibot';
import { createDto } from 'nestjs-valibot';

export const GetAccessTokenInputSchema = v.object({
    user_id: v.number(),
    expires_in_minutes: v.optional(v.number()),
});

export class GetAccessTokenInputDto extends createDto(GetAccessTokenInputSchema) {}

export class GetAccessTokenOutputDto {
    access_token: string;
}

Reference Files

  • references/typed-orm.md - TypedORM
  • references/pino-logger.md - Pino Logger

Related Skills

  • screaming-architecture - For project structure
Weekly Installs
5
GitHub Stars
1
First Seen
Feb 16, 2026
Installed on
opencode5
gemini-cli5
claude-code5
cursor5
windsurf5
mcpjam3