TypeScript NestJS best practices .cursorrules prompt file
About .cursorrules prompt file
What you can build
Code Audit Tool for TypeScript Projects: A web-based service that analyzes TypeScript projects, ensuring they meet the specified guidelines. It checks for proper nomenclature, use of types, function structuring, and follows the SOLID principles. It also reviews the adherence to NestJS architecture.
NestJS API Blueprint Generator: An application that generates a boilerplate NestJS project structure based on user input. It auto-generates modules, controllers, services and sets up testing frameworks following the guidelines provided.
TypeScript Refactoring Plugin for IDEs: A plugin for popular IDEs like Visual Studio Code that offers real-time suggestions and automated refactoring options for TypeScript projects to align them with the outlined programming principles and guidelines.
NestJS Modular Architecture Training Platform: An online course platform that offers interactive modules for learning how to implement a modular architecture in NestJS as per the guidelines, complete with practice projects and quizzes.
TypeScript Test Suite Generator: A tool that auto-generates unit and acceptance test templates for TypeScript projects, ensuring adherence to the Arrange-Act-Assert and Given-When-Then conventions for test structuring with Jest.
Comprehensive TypeScript Documentation Tool: An app that auto-generates detailed documentation for TypeScript projects, ensuring the use of JSDoc comments and appropriate naming conventions and descriptors for classes and methods.
TypeScript Best Practices Knowledge Base: A website offering articles, tutorials, and community discussions around TypeScript best practices, focusing specifically on clean code, design patterns, and NestJS programming guidelines.
Advanced Exception Handling Analyzer: A service that examines NestJS projects to ensure exceptions are being used and handled according to the guidelines, offering suggestions for global handlers and proper context addition.
NestJS Controller and Service Builder: A web-based GUI tool for rapidly generating controllers and services within a NestJS application, complete with DTOs, validations, and service contracts, following the guidelines given.
TypeScript Compliance Badge for Repositories: An initiative that provides a badge for GitHub repositories that conform to the TypeScript guidelines. The tool runs automated checks on public repositories and awards the badge upon passing.
Benefits
- Emphasizes adherence to TypeScript standards, promoting clear, consistent code with detailed type declarations and proper naming conventions for all identifiers.
- Encourages modular architecture and best practices specific to NestJS, including domain-specific modules, encapsulation, and the use of MikroORM for persistence.
- Strong emphasis on testing, advocating for comprehensive unit and acceptance tests using Jest, and implementing test doubles and conventions like Arrange-Act-Assert.
Synopsis
Developers working with TypeScript and NestJS can use this prompt to create clean, maintainable, and well-documented code by following best practices and design patterns.
Overview of .cursorrules prompt
The .cursorrules file provides a comprehensive set of guidelines and best practices for TypeScript programming with a focus on the NestJS framework. It includes principles for general TypeScript usage, such as enforcing type declarations, avoiding blank lines within functions, and adhering to specific naming conventions for different code components. The file also outlines recommended practices for writing clean and efficient functions, managing data with immutability, and adhering to SOLID principles in classes. Additionally, it provides guidance on error handling using exceptions, structured testing practices, and specific architectural principles for building applications using NestJS, including modular architecture and API encapsulation. Testing recommendations using Jest are also included, emphasizing unit, acceptance, and end-to-end testing for controllers, services, and API modules.