alpha

Gives Copilot NestJS standards covering dependency injection, modules, decorators, validation, testing and security for scalable Node.js server applications.
applyTo: '**/.ts, **/.js, **/.json, **/.spec.ts, **/*.e2e-spec.ts'
description: 'NestJS development standards and best practices for building scalable Node.js server-side applications'
As GitHub Copilot, you are an expert in NestJS development with deep knowledge of TypeScript, decorators, dependency injection, and modern Node.js patterns. Your goal is to guide developers in building scalable, maintainable, and well-architected server-side applications using NestJS framework principles and best practices.
@Injectable() decorator for services, repositories, and other providers@Module() decoratorforRoot() and forFeature() patterns for configurable modules@Controller(), @Get(), @Post(), @Injectable()class-validator librarysrc/
├── app.module.ts
├── main.ts
├── common/
│ ├── decorators/
│ ├── filters/
│ ├── guards/
│ ├── interceptors/
│ ├── pipes/
│ └── interfaces/
├── config/
├── modules/
│ ├── auth/
│ ├── users/
│ └── products/
└── shared/
├── services/
└── constants/
*.controller.ts (e.g., users.controller.ts)*.service.ts (e.g., users.service.ts)*.module.ts (e.g., users.module.ts)*.dto.ts (e.g., create-user.dto.ts)*.entity.ts (e.g., user.entity.ts)*.guard.ts (e.g., auth.guard.ts)*.interceptor.ts (e.g., logging.interceptor.ts)*.pipe.ts (e.g., validation.pipe.ts)*.filter.ts (e.g., http-exception.filter.ts)@Controller('users')
@UseGuards(AuthGuard)
export class UsersController {
constructor(private readonly usersService: UsersService) {}
@Get()
@UseInterceptors(TransformInterceptor)
async findAll(@Query() query: GetUsersDto): Promise<User[]> {
return this.usersService.findAll(query);
}
@Post()
@UsePipes(ValidationPipe)
async create(@Body() createUserDto: CreateUserDto): Promise<User> {
return this.usersService.create(createUserDto);
}
}
@Injectable()
export class UsersService {
constructor(
@InjectRepository(User)
private readonly userRepository: Repository<User>,
private readonly emailService: EmailService,
) {}
async create(createUserDto: CreateUserDto): Promise<User> {
const user = this.userRepository.create(createUserDto);
const savedUser = await this.userRepository.save(user);
await this.emailService.sendWelcomeEmail(savedUser.email);
return savedUser;
}
}
export class CreateUserDto {
@IsString()
@IsNotEmpty()
@Length(2, 50)
name: string;
@IsEmail()
email: string;
@IsString()
@MinLength(8)
@Matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/, {
message: 'Password must contain uppercase, lowercase and number',
})
password: string;
}
@Entity('users')
export class User {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ unique: true })
email: string;
@Column()
name: string;
@Column({ select: false })
password: string;
@OneToMany(() => Post, post => post.author)
posts: Post[];
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}
@Injectable()
export class JwtAuthGuard extends AuthGuard('jwt') {
canActivate(context: ExecutionContext): boolean | Promise<boolean> {
return super.canActivate(context);
}
handleRequest(err: any, user: any, info: any) {
if (err || !user) {
throw err || new UnauthorizedException();
}
return user;
}
}
@SetMetadata('roles', ['admin'])
@UseGuards(JwtAuthGuard, RolesGuard)
@Delete(':id')
async remove(@Param('id') id: string): Promise<void> {
return this.usersService.remove(id);
}
@Catch()
export class AllExceptionsFilter implements ExceptionFilter {
private readonly logger = new Logger(AllExceptionsFilter.name);
catch(exception: unknown, host: ArgumentsHost): void {
const ctx = host.switchToHttp();
const response = ctx.getResponse<Response>();
const request = ctx.getRequest<Request>();
const status = exception instanceof HttpException
? exception.getStatus()
: HttpStatus.INTERNAL_SERVER_ERROR;
this.logger.error(`${request.method} ${request.url}`, exception);
response.status(status).json({
statusCode: status,
timestamp: new Date().toISOString(),
path: request.url,
message: exception instanceof HttpException
? exception.message
: 'Internal server error',
});
}
}
describe('UsersService', () => {
let service: UsersService;
let repository: Repository<User>;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
UsersService,
{
provide: getRepositoryToken(User),
useValue: {
create: jest.fn(),
save: jest.fn(),
find: jest.fn(),
},
},
],
}).compile();
service = module.get<UsersService>(UsersService);
repository = module.get<Repository<User>>(getRepositoryToken(User));
});
it('should create a user', async () => {
const createUserDto = { name: 'John', email: 'john@example.com' };
const user = { id: '1', ...createUserDto };
jest.spyOn(repository, 'create').mockReturnValue(user as User);
jest.spyOn(repository, 'save').mockResolvedValue(user as User);
expect(await service.create(createUserDto)).toEqual(user);
});
});
// Rate limiting example
@Controller('auth')
@UseGuards(ThrottlerGuard)
export class AuthController {
@Post('login')
@Throttle(5, 60) // 5 requests per minute
async login(@Body() loginDto: LoginDto) {
return this.authService.login(loginDto);
}
}
@Injectable()
export class ConfigService {
constructor(
@Inject(CONFIGURATION_TOKEN)
private readonly config: Configuration,
) {}
get databaseUrl(): string {
return this.config.database.url;
}
get jwtSecret(): string {
return this.config.jwt.secret;
}
}
nest generate module usersNestJS provides a powerful, opinionated framework for building scalable Node.js applications. By following these best practices, you can create maintainable, testable, and efficient server-side applications that leverage the full power of TypeScript and modern development patterns.
<!-- End of NestJS Instructions -->
© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com


Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.
agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait
Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.
image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat
Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.
image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators
Loading reviews…
Loading comments…