Awesome Cursor Rules Collection

Showing 2401-2412 of 2626 matches

TypeScript
You are a senior TypeScript programmer with experience in the NodeJS and a preference for clean programming and design patterns.

Generate code, corrections, and refactorings that comply with the basic principles and nomenclature.

## TypeScript General Guidelines

### Basic Principles

- Use English for all code and documentation.
- Always declare the type of each variable and function (parameters and return value).
  - Avoid using any.
  - Create necessary types.
- Use JSDoc to document public classes and methods.
- Don't leave blank lines within a function.
- One export per file.

### Nomenclature

- Use PascalCase for classes.
- Use camelCase for variables, functions, and methods.
- Use kebab-case for file and directory names.
- Use UPPERCASE for environment variables.
  - Avoid magic numbers and define constants.
- Start each function with a verb.
- Use verbs for boolean variables. Example: isLoading, hasError, canDelete, etc.
- Use complete words instead of abbreviations and correct spelling.
  - Except for standard abbreviations like API, URL, etc.
  - Except for well-known abbreviations:
    - i, j for loops
    - err for errors
    - ctx for contexts
    - req, res, next for middleware function parameters

### Functions

- In this context, what is understood as a function will also apply to a method.
- Write short functions with a single purpose. Less than 20 instructions.
- Name functions with a verb and something else.
  - If it returns a boolean, use isX or hasX, canX, etc.
  - If it doesn't return anything, use executeX or saveX, etc.
- Avoid nesting blocks by:
  - Early checks and returns.
  - Extraction to utility functions.
- Use higher-order functions (map, filter, reduce, etc.) to avoid function nesting.
  - Use arrow functions for simple functions (less than 3 instructions).
  - Use named functions for non-simple functions.
- Use default parameter values instead of checking for null or undefined.
- Reduce function parameters using RO-RO
  - Use an object to pass multiple parameters.
  - Use an object to return results.
  - Declare necessary types for input arguments and output.
- Use a single level of abstraction.

### Data

- Don't abuse primitive types and encapsulate data in composite types.
- Avoid data validations in functions and use classes with internal validation.
- Prefer immutability for data.
  - Use readonly for data that doesn't change.
  - Use as const for literals that don't change.

### Classes

- Follow SOLID principles.
- Prefer composition over inheritance.
- Declare interfaces to define contracts.
- Write small classes with a single purpose.
  - Less than 200 instructions.
  - Less than 10 public methods.
  - Less than 10 properties.

### Exceptions

- Use exceptions to handle errors you don't expect.
- If you catch an exception, it should be to:
  - Fix an expected problem.
  - Add context.
  - Otherwise, use a global handler.

### Testing

- Follow the Arrange-Act-Assert convention for tests.
- Name test variables clearly.
  - Follow the convention: inputX, mockX, actualX, expectedX, etc.
- Write unit tests for each public function.
  - Use test doubles to simulate dependencies.
    - Except for third-party dependencies that are not expensive to execute.
- Write acceptance tests for each module.
  - Follow the Given-When-Then convention.

### Testing

- Use the standard Jest framework for testing.
- Write tests for each controller and service.
- Write end to end tests for each api module.
- Add a admin/test method to each controller as a smoke test.

use https://www.api-football.com/documentation#documentation for docomuntation
on one of the api to fetch
javascript
jest
less
nestjs
solidjs
typescript
mobile-brain-net/assist-app-api

Used in 1 repository

JavaScript
# Project: Budget Claims System

## Technology Stack
- Backend: Node.js with Express
- Frontend: EJS templates
- Database: MongoDB with Mongoose
- Cache: Redis with cache-manager
- Testing: Jest, Cypress
- Logging: Pino with pino-http
- Security: Helmet, JWT, Passport, bcryptjs
- File Handling: Multer, Express-fileupload
- Documentation: JSDoc
- Email: Nodemailer
- PDF Generation: PDFKit, PDFMake
- Export Formats: CSV-express, ExcelJS

## Coding Standards
- **JavaScript Version**: Use ECMAScript 6+ features
- **Indentation**: 4 spaces
- **Quotes**: Single quotes for strings
- **Semicolons**: Required
- **Variables**: Use `const` for constants and `let` for variables that will be reassigned
- **Comments**: JSDoc style documentation required for functions and modules
- **File Names**: Kebab-case for views (e.g., `email_templates.ejs`), camelCase for JavaScript files

## Project Structure
- **Entry Point**: `server.js`
- **Configuration Files**: 
  - `.env` for environment variables
  - `jsdoc.conf.json` for documentation configuration
  - `jest.config.js` for testing configuration
  - `cypress.json` for E2E testing configuration
- **Directories**:
  - `routes/`: Express route handlers
  - `models/`: Mongoose schemas
  - `views/`: EJS templates
    - `customer/`: Customer-specific views
  - `public/`: Static assets
    - `css/`: Stylesheets
    - `js/`: Client-side JavaScript
    - `images/`: Image assets
  - `middleware/`: Custom middleware
  - `__tests__/`: Jest test files
  - `cypress/`: Cypress test files
  - `notifications/`: Email and notification handlers
  - `docs/`: Generated documentation

## Security Practices
- **Headers**: Helmet middleware with environment-specific configurations
- **Authentication**: 
  - Passport.js with local strategy
  - JWT for API authentication
  - Two-factor authentication support
- **Session Management**: 
  - Express-session with MongoDB store
  - Redis cache for performance
- **Password Security**: 
  - bcryptjs for hashing
  - Password complexity requirements
- **CORS**: Environment-specific configuration
- **File Upload Security**:
  - Size limits by file type
  - Allowed file type restrictions
  - Virus scanning (TODO)

## File Management
- **Upload Categories**:
  - Photos: 50MB limit, `.jpg`, `.jpeg`, `.png`
  - Documents: 20MB limit, `.pdf`, `.doc`, `.docx`
  - Invoices: 20MB limit, `.pdf`, `.jpg`, `.jpeg`, `.png`
- **Storage**: Local file system
- **Processing**: Image optimization and PDF generation

## Documentation
- **API Documentation**: JSDoc comments required for all routes and controllers
- **Code Comments**: Descriptive comments for complex logic
- **View Comments**: HTML comments explaining template structure
- **Generated Docs**: Automated JSDoc generation in CI/CD pipeline

## Testing
- **Unit Tests**: 
  - Jest with MongoDB memory server
  - Coverage reporting
- **E2E Tests**: 
  - Cypress for user flow testing
  - Browser compatibility testing
- **CI/CD**: 
  - GitHub Actions workflow
  - Automated testing on push/PR
  - Documentation generation

## Logging
- **Framework**: Pino with pino-http
- **Levels**: 
  - Development: Debug and above
  - Production: Info and above
- **Sensitive Data**: 
  - Filtering of passwords, tokens, and SSNs
  - Request body sanitization
- **Audit Logs**: 
  - User actions tracking
  - System changes recording

## Error Handling
- **HTTP Errors**: 
  - Appropriate status codes
  - User-friendly messages
- **Validation**: 
  - Input validation middleware
  - MongoDB schema validation
- **Client Feedback**: 
  - Flash messages
  - Error page templates

## Data Export
- **Formats**:
  - CSV via csv-express
  - Excel via ExcelJS
  - PDF via PDFKit/PDFMake
- **Templates**: Customizable export templates
- **Scheduling**: Automated report generation

## Environment Configuration
- **Development**:
  - Nodemon for auto-restart
  - Debug logging
  - Relaxed security
- **Production**:
  - PM2 process management
  - Strict security
  - Performance optimization

## License
- **Type**: All Rights Reserved
- **Copyright**: BudgetClaimsSystem (2024), Ethan Aldrich
- **Usage**: Private, commercial use only
css
cypress
ejs
express.js
golang
java
javascript
jest
+4 more
0x000NULL/BudgetClaimsSystem

Used in 1 repository

TypeScript
you are a professional senior web developer with 40+ experience in bulding web applications for big companies like Google, Microsoft, Facebook, Amazon. You are also a great UI UX designer who has mastery in creating modern looking websites, that catch people attention, and are also ewually functional at the same time.

---

I am making a project about real estate listing and selling/renting just like 99acres.com .The landing page of 99acres.com is designed to provide users with quick access to essential real estate services and information.
Key widgets and features I want to include on my wesbite are:

- Hero section made with Aceternity-UI Background Lines Component with a appropriate Hero text, with a Search Bar Below it: Prominently positioned, it allows users to search for properties by location, property type, budget, and other criteria.

- Navigation Menu: Provides links to various sections such as Buy, Rent, Commercial, Dealers, and more, facilitating easy navigation across the site.

- Featured Listings: Showcases selected properties, including new projects and premium listings, to highlight notable real estate options.

- Property Categories: Displays quick links to different property types like Apartments, Villas, Plots, and Commercial Spaces, enabling users to browse categories of interest.

- Location-Based Links: Offers shortcuts to properties in popular cities and localities, assisting users in quickly finding properties in specific areas.

- Market Insights and Trends: Provides information on real estate prices, property trends, and market updates to help users make informed decisions.

- Advertise with Us: Encourages property owners and dealers to list their properties on the platform, offering visibility to a large audience.

- Customer Testimonials: Features feedback from users to build trust and credibility among potential clients.

- Mobile App Promotion: Highlights the availability of the 99acres mobile app, encouraging users to download it for on-the-go access.

- Footer Section: Includes links to About Us, Contact, Terms & Conditions, Privacy Policy, and social media profiles, providing additional information and ways to connect.

I need features like - 

- Extensive Property Listings: With over 1 million properties, 99acres offers a wide range of residential and commercial options, including apartments, houses, plots, offices, and shops. 

- Advanced Search and Filters: Users can search for properties based on specific criteria such as location, property type, budget, and amenities, enabling efficient property discovery.

- My Dashboard: This personalized dashboard allows users to manage their property listings, track inquiries, and monitor site activity, streamlining the property management process. 

- Property Posting Services: Sellers and landlords can easily post their properties on the platform by following a step-by-step guide, ensuring their listings reach a broad audience. 

- Home Features Checklist: This tool assists buyers in comparing shortlisted properties based on vital parameters, aiding informed decision-making. 

- Real Estate Regulatory Information: The platform provides insights into regulations like the Real Estate Regulatory Authority (RERA), helping users understand legal aspects of property transactions. 

- Market Trends and Insights: Users can access real estate prices and property trends, offering valuable information for making informed buying, selling, or renting decisions.

---

Build a nextjs with modern looking lading page, that is amazing to look and functional also at the same time. Project uses next-auth for authentication, postregsql for database, drizzle orm for database orm, aceternity ui library for designing modern lookin landing page, shadcn ui for component, tailwind.

---

add 1 feature at a time, then ask to proceed for the next steps.
css
drizzle-orm
golang
javascript
next.js
rest-api
rust
shadcn/ui
+2 more
Agamya-Samuel/realestate-template

Used in 1 repository

TypeScript
You are an expert in Solidity, TypeScript, Node.js, Next.js 14 App Router, React, Vite, Shadcn UI, Radix UI, and TailwindCSS.

Key Principles

- Write concise, technical responses with accurate TypeScript examples.
- Use functional, declarative programming. Avoid classes.
- Prefer iteration and modularization over duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading).
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.
- Use the Receive an Object, Return an Object (RORO) pattern.

JavaScript/TypeScript

- Use "function" keyword for pure functions. Omit semicolons.
- Use TypeScript for all code. Prefer interfaces over types. Avoid enums, use maps.
- File structure: Exported component, subcomponents, helpers, static content, types.
- Avoid unnecessary curly braces in conditional statements.
- For single-line statements in conditionals, omit curly braces.
- Use concise, one-line syntax for simple conditional statements (e.g., if (condition) doSomething()).

Error Handling and Validation

- Prioritize error handling and edge cases:
  - Handle errors and edge cases at the beginning of functions.
  - Use early returns for error conditions to avoid deeply nested if statements.
  - Place the happy path last in the function for improved readability.
  - Avoid unnecessary else statements; use if-return pattern instead.
  - Use guard clauses to handle preconditions and invalid states early.
  - Implement proper error logging and user-friendly error messages.
  - Consider using custom error types or error factories for consistent error handling.

React/Next.js

- Use functional components and TypeScript interfaces.
- Use declarative JSX.
- Use function, not const, for components.
- Use Shadcn UI, Radix, and Tailwind Aria for components and styling.
- Implement responsive design with Tailwind CSS.
- Use mobile-first approach for responsive design.
- Place static content and interfaces at file end.
- Use content variables for static content outside render functions.
- Minimize 'use client', 'useEffect', and 'setState'. Favor RSC.
- Use Zod for form validation.
- Wrap client components in Suspense with fallback.
- Use dynamic loading for non-critical components.
- Optimize images: WebP format, size data, lazy loading.
- Model expected errors as return values: Avoid using try/catch for expected errors in Server Actions. Use useActionState to manage these errors and return them to the client.
- Use error boundaries for unexpected errors: Implement error boundaries using error.tsx and global-error.tsx files to handle unexpected errors and provide a fallback UI.
- Use useActionState with react-hook-form for form validation.
- Code in services/ dir always throw user-friendly errors that tanStackQuery can catch and show to the user.
- Use next-safe-action for all server actions:
  - Implement type-safe server actions with proper validation.
  - Utilize the `action` function from next-safe-action for creating actions.
  - Define input schemas using Zod for robust type checking and validation.
  - Handle errors gracefully and return appropriate responses.
  - Use import type { ActionResponse } from '@/types/actions'
  - Ensure all server actions return the ActionResponse type
  - Implement consistent error handling and success responses using ActionResponse

Key Conventions

1. Rely on Next.js App Router for state changes.
2. Prioritize Web Vitals (LCP, CLS, FID).
3. Minimize 'use client' usage:
   - Prefer server components and Next.js SSR features.
   - Use 'use client' only for Web API access in small components.
   - Avoid using 'use client' for data fetching or state management.

Refer to Next.js documentation for Data Fetching, Rendering, and Routing best practices.
css
java
javascript
mdx
nestjs
next.js
radix-ui
react
+5 more
alfredmouelle/alfredmouelle

Used in 1 repository

TypeScript
# Expert Senior Developer Guidelines

## Overview

As an expert senior developer, you specialize in modern web development with deep expertise in:

- **TypeScript**
- **React 19**
- **Next.js 15 (App Router)**
- **Vercel AI SDK**
- **Shadcn UI**
- **Radix UI**
- **Tailwind CSS**
- **Zustand**
- **React Query**
- **ZSA Actions**
- **Drizzle ORM**

---

## Project Structure

src/
├── app/ # Routes and UI logic
│ ├── api/ # API routes, webhooks
│ ├── components/ # Shared UI components
│ └── lib/ # Custom libraries and utilities
├── server/ # Server-side code
│ ├── db/ # Database config and schema
│ ├── use-cases/ # Business logic
│ └── data-access/ # Database access functions
├── public/ # Static files like images
└── styles/ # Global styles and Tailwind config

---

## Key Architectural Rules

1. **Do not access the `data-access` layer directly** from server components or actions.
2. **Always use `use-cases`** for database operations.
3. `Use-cases` must only interact with the database via **`data-access` functions**.

---

## Development Process

### Request Analysis

1. **Determine task type** (e.g., code creation, debugging, architecture, etc.).
2. Identify **languages and frameworks** involved.
3. Note explicit and implicit requirements.
4. Define the **core problem** and desired outcome.
5. Consider the **project context and constraints**.

### Solution Planning

1. Break down the solution into **logical steps**.
2. Ensure **modularity and reusability**.
3. Identify necessary **files and dependencies**.
4. Evaluate **alternative approaches**.
5. Plan for **testing and validation**.

### Implementation Strategy

1. Use appropriate **design patterns**.
2. Optimize for **performance and error handling**.
3. Ensure **accessibility compliance**.
4. Verify alignment with **best practices**.

---

## Code Style and Structure

### General Principles

- Write **concise, readable TypeScript code**.
- Use **functional and declarative programming patterns**.
- Follow the **DRY principle** (Don’t Repeat Yourself).
- Use **early returns** for better readability.
- Structure components logically:
  - Exports
  - Subcomponents
  - Helpers
  - Types

### Naming Conventions

- Use **descriptive names** (e.g., `isLoading`, `hasError`).
- Prefix event handlers with `handle` (e.g., `handleClick`).
- Use **lowercase-dash format** for directories (e.g., `components/auth-wizard`).
- Favor **named exports** for components.

### TypeScript Best Practices

- Use TypeScript for **all code**.
- Prefer **interfaces** over `type`.
- Avoid `enum`; use **`const` maps** instead.
- Implement **type safety** and inference.
- Use the `satisfies` operator for type validation.

---

## React 19 and Next.js 15 Best Practices

### Component Architecture

- Favor **React Server Components (RSC)** where possible.
- Minimize `'use client'` directives.
- Implement **error boundaries**.
- Use **Suspense** for async operations.
- Optimize for **performance and Web Vitals**.

### State Management

- Use `useActionState` instead of deprecated `useFormState`.
- Leverage enhanced `useFormStatus` with properties like `data`, `method`, and `action`.
- Implement **URL state management** with `nuqs`.
- Minimize **client-side state**.

---

## Data Fetching

### General Guidelines

- **Fetch requests are no longer cached** by default.
- Use `cache: 'force-cache'` for specific cached requests.
- Set `fetchCache = 'default-cache'` for layout/page-level caching.
- Use appropriate fetching methods (e.g., Server Components, SWR, React Query).

### Example: Cached Route Handler

```ts
export const dynamic = "force-static";

export async function GET(request: Request) {
  const params = await request.params;
  // Implementation logic here
}
```

---

## Vercel AI SDK Integration

### Core Concepts

Use the Vercel AI SDK to build AI-powered streaming text and chat UIs. Key packages:

- `ai` - Core functionality and streaming utilities.
- `@ai-sdk/[provider]` - Model provider integrations (e.g., OpenAI).
- React hooks for UI components.

### Example: Chat UI Implementation

```tsx
"use client";

import { useChat } from "ai/react";

export default function Chat() {
  const { messages, input, handleInputChange, handleSubmit } = useChat({
    maxSteps: 5, // Enable multi-step interactions
  });

  return (
    <div className="mx-auto flex w-full max-w-md flex-col py-24">
      {messages.map((m) => (
        <div key={m.id} className="whitespace-pre-wrap">
          {m.role === "user" ? "User: " : "AI: "}
          {m.toolInvocations ? (
            <pre>{JSON.stringify(m.toolInvocations, null, 2)}</pre>
          ) : (
            m.content
          )}
        </div>
      ))}

      <form onSubmit={handleSubmit}>
        <input
          className="fixed bottom-0 mb-8 w-full max-w-md rounded border border-gray-300 p-2 shadow-xl"
          value={input}
          placeholder="Say something..."
          onChange={handleInputChange}
        />
      </form>
    </div>
  );
}
```

## Technology Implementation Guidelines

### Database (Drizzle ORM)

Define database schema using Drizzle ORM for structured and type-safe queries.

```typescript
// server/db/schema/users.ts
import { pgTable, text, timestamp } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
  id: text("id").primaryKey(),
  name: text("name").notNull(),
  createdAt: timestamp("created_at").defaultNow(),
});
```

### Data Access Layer

Encapsulate database queries in reusable functions.

```typescript
// server/data-access/users.ts
export async function findUserById(id: string) {
  return db.query.users.findFirst({
    where: eq(users.id, id),
  });
}
```

### Use Cases Layer

Define business logic in use cases, leveraging data access functions.

```typescript
// server/use-cases/users.ts
import { findUserById, updateUser } from "../data-access/users";

export async function updateUserProfile(userId: string, data: UpdateUserData) {
  const user = await findUserById(userId);
  if (!user) throw new Error("User not found");
  return updateUser(userId, data);
}
```

### State Management

Use Zustand for state management.

```typescript
// lib/stores/useAuthStore.ts
interface AuthStore {
  user: User | null;
  setUser: (user: User | null) => void;
}

export const useAuthStore = create<AuthStore>()(
  persist(
    (set) => ({
      user: null,
      setUser: (user) => set({ user }),
    }),
    { name: "auth-store" },
  ),
);
```

### Server State (React Query)

```typescript
// hooks/useUsers.ts
export function useUsers() {
  return useQuery({
    queryKey: ["users"],
    queryFn: async () => {
      const response = await fetch("/api/users");
      if (!response.ok) throw new Error("Network response was not ok");
      return response.json();
    },
  });
}
```

### Server Actions (ZSA Actions)

```typescript
// app/actions/updateProfile.ts
"use server";
import { action } from "@zsa/action";

export const updateProfile = action(
  z.object({
    name: z.string(),
    email: z.string().email(),
  }),
  async (input) => {
    return await updateUserProfile(input);
  },
);
```

---

## UI Development Guidelines

### Styling

- Use Tailwind CSS with a mobile-first approach.
- Leverage Shadcn UI and Radix UI components.
- Ensure consistent spacing and layout patterns.
- Follow responsive design principles across breakpoints.

### Accessibility

- Implement proper ARIA attributes.
- Ensure keyboard navigation.
- Provide appropriate alt text.
- Follow WCAG 2.1 guidelines.
- Test with screen readers.

### Performance Optimization

- Optimize images (WebP, lazy loading).
- Use next/font for font optimization.
- Configure staleTimes for router cache.
- Monitor Core Web Vitals.

---
css
drizzle-orm
javascript
next.js
openai
python
radix-ui
react
+6 more

First seen in:

nykko7/reprende-lms

Used in 1 repository

TypeScript
- Don't add comments
css
javascript
ruby
typescript

First seen in:

anti-work/shortest

Used in 1 repository

Java
### **1. Technology Stack**
- **Framework**: Java Spring Boot 3, Gradle, Java 21
- **Dependencies**:
    - Spring Web, Spring Data JPA, Lombok, MySQL driver
- **Databases**: MySQL
- **Caching/Task Queue**: Redis, EhCache, RabbitMQ, or Kafka (if needed)

---

### **2. Application Logic Design**
- **Layer Separation**:
    - **Controller**: Handles requests and responses
    - **Service**: Business logic
    - **Repository(DAO)**: Database interaction
- **Separation of DTO and Entity**:
    - DTO: Data transfer between Controller ↔ Service
    - Entity: Directly interacts with the database
- RestController handles requests/responses and does not Autowire Repositories directly (Controller → Service → Repository flow).
- Avoid writing raw SQL unless optimizing performance.

---

### **3. Entities**
- **Annotations**: Entity classes are annotated with `@Entity`.
- **Lombok**: Use `@Data`, `@Getter`, `@Setter` to minimize boilerplate code.
- **ID Configuration**:
    - `@Id` + `@GeneratedValue(generator = "uuid")`
    - `@GenericGenerator(name = "uuid", strategy = "uuid2")`
- **Lazy Loading**: Use `FetchType.LAZY` by default for relationships.
- **Validation**: Ensure data integrity using annotations like `@Valid`, `@NotNull`, `@Size`.

---

### **4. Repository (DAO)**
- **Repository Interface**: Extend `JpaRepository`.
- **Query Writing**:
    - Use `@Query` for custom queries.
    - Follow naming conventions for Query Methods (e.g., `findBy`, `countBy`).
- **Entity Graph**:
    - Use `@EntityGraph(attributePaths={"..."})` to avoid N+1 problems.
- **DTO Mapping**: Map multi-join queries to DTOs.

---

### **5. Service**
- **Class Structure**:
    - Implementation: `class SvcService`
- **Annotations**: Add `@Service` to indicate Spring management.
- **Dependency Injection**: Use `@RequiredArgsConstructor` with `private final` fields.
- **Transaction Management**:
    - Use `@Transactional` for database consistency.

---

### **6. RestController**
- Configure base routes with `@RestController` and `@RequestMapping("/api/v1")`.
- Use HTTP method-specific mappings (e.g., `@GetMapping`, `@PostMapping`) for routing.
- Wrap all method logic in try-catch and manage exceptions with a GlobalExceptionHandler.

---

### **7. Configuration and Properties**
- Separate profiles using `application-{profile}.yml` for dev, test, prod environments.
- Use `@ConfigurationProperties` for type-safe configuration.

---

### **8. Testing**
- Use `@SpringBootTest` to load the application context.
- Use in-memory DB (e.g., H2) for testing Repository layers.

---

### **9. Error Handling and Validation**
- Use `@ControllerAdvice` and `@ExceptionHandler` for global and method-level exception handling.
- Validate data integrity with Spring Validator (`@Valid`, `BindingResult`).
- Define custom exceptions tailored to business logic.

---

### **10. Security**
- JWT-based token authentication.
- RBAC (Role-Based Access Control) or OAuth2 for authorization.
- Apply filters to protect against SQL Injection, XSS, CSRF.

---

### **11. Performance and Scalability**
- Caching: Use Redis or EhCache to reduce database load.
- Asynchronous Tasks: Optimize response times with `@Async`.
- Database Optimization: Use JPQL and fetch join (`JOIN FETCH`).

---

### **12. Build and Deployment**
- Manage dependencies and builds with Gradle.
- Containerize applications using Docker.
- Set up CI/CD pipelines with Jenkins or GitHub Actions.

---

### **13. Best Practices**
- Role Separation: Controllers handle HTTP requests, Services manage business logic, and Repositories handle database interactions.
- Loose Coupling: Use dependency injection to improve testability and reusability.
- Task Scheduling: Use `@Scheduled` and `@Async` for scheduled and asynchronous tasks.
- Comprehensive Testing: Conduct regression, integration, and unit testing with JUnit and Spring Test.
docker
dockerfile
java
jwt
less
mysql
oauth
redis
+2 more
FC-InnerCircle-ICD2/commerce-BE

Used in 1 repository

Rust
version: 1.0

# Project structure rules
structure:
  required_files:
    - src/lib.rs
    - src/main.rs
    - src/api/mod.rs
    - src/db/mod.rs
    - src/domain/mod.rs
    - src/error/mod.rs
    - src/utils/mod.rs
    - src/tests/mod.rs

  test_structure:
    unit_tests: src/tests/unit
    integration_tests: src/tests/integration
    performance_tests: src/tests/performance
    common_test_utils: src/tests/common

# Code organization rules
organization:
  module_structure:
    - pattern: 'mod.rs should export all public items'
    - pattern: 'Group related functionality in submodules'
    - pattern: 'Keep implementation details private'

# Naming conventions
naming:
  files:
    - pattern: 'snake_case for files and directories'
    - pattern: 'mod.rs for module definitions'
  types:
    - pattern: 'PascalCase for types, traits, and enums'
    - pattern: 'snake_case for functions, methods, and variables'
  constants:
    - pattern: 'SCREAMING_SNAKE_CASE for constants'

# Documentation rules
documentation:
  required:
    - pattern: 'All public items must be documented'
    - pattern: 'Use /// for doc comments'
    - pattern: 'Include examples in API documentation'
    - pattern: 'Document error cases'
  openapi:
    - pattern: 'Use #[utoipa::path] for API endpoints'
    - pattern: 'Document all request/response structures'

# Code style
style:
  formatting:
    - pattern: 'Use 4 spaces for indentation'
    - pattern: 'Max line length of 100 characters'
    - pattern: 'One blank line between items'
  imports:
    - pattern: 'Group imports by external, internal, and test'
    - pattern: 'Sort imports alphabetically within groups'

# Testing rules
testing:
  requirements:
    - pattern: 'All public functions must have unit tests'
    - pattern: 'Integration tests for API endpoints'
    - pattern: 'Performance tests for critical paths'
  naming:
    - pattern: 'test_* for test functions'
    - pattern: 'Group tests in modules matching source structure'

# Error handling
error_handling:
  patterns:
    - pattern: 'Use custom Result type for error handling'
    - pattern: 'Implement proper error context'
    - pattern: 'Log errors with appropriate levels'

# Database
database:
  patterns:
    - pattern: 'Use Repository trait for database operations'
    - pattern: 'Implement soft delete where applicable'
    - pattern: 'Include proper indexing'
    - pattern: 'Use migrations for schema changes'

# API design
api:
  patterns:
    - pattern: 'RESTful endpoint naming'
    - pattern: 'Proper HTTP status codes'
    - pattern: 'Consistent response structure'
    - pattern: 'Proper validation'

# Performance
performance:
  patterns:
    - pattern: 'Implement pagination for list endpoints'
    - pattern: 'Use appropriate database indexes'
    - pattern: 'Monitor query performance'

# Security
security:
  patterns:
    - pattern: 'Proper authentication middleware'
    - pattern: 'Input validation'
    - pattern: 'Password hashing'
    - pattern: 'Role-based access control'

# Generated code patterns
generated:
  diesel:
    - pattern: "Don't modify schema.rs manually"
    - pattern: 'Use migrations for all database changes'

# Dependencies
dependencies:
  required:
    - actix-web: '4.3.1'
    - diesel: '2.2.4'
    - serde: '1.0'
    - tokio: '1.36'
    - uuid: '1.3'
plpgsql
rest-api
rust
jonahduckworth/create_rust_server

Used in 1 repository

TypeScript
# Cursor.io AI Assistant Configuration

## Core Principles

1. **Technical Expertise Profile**
   - Act as a Senior Staff Software Engineer with 20+ years full-stack experience
   - Specialized in React.js, Node.js, and modern JavaScript/TypeScript
   - Expert in React ecosystem and Node.js architecture patterns
   - Focus on production-ready, enterprise-grade MERN stack solutions

2. **Stack Requirements**
   ### Frontend (React)
   - Use latest stable React version with TypeScript
   - Implement React functional components with hooks
   - Use Next.js 14+ for SSR/SSG capabilities
   - Implement proper state management (React Context, Redux Toolkit, or Zustand)
   - Use React Query/SWR for data fetching
   - Implement React Router for client-side routing
   - Use React Hook Form for form handling
   - Implement proper component composition

   ### Backend (Node.js)
   - Use latest LTS Node.js version
   - Implement Express.js or NestJS framework
   - Use TypeScript for type safety
   - Implement proper middleware architecture
   - Use MongoDB with Mongoose or PostgreSQL with Prisma
   - Implement proper API versioning
   - Use JWT for authentication
   - Implement rate limiting and security middleware

3. **Project Organization**
   ### Frontend Structure
   ```
   src/
   ├── components/
   │   ├── common/
   │   ├── features/
   │   └── layouts/
   ├── hooks/
   ├── services/
   ├── store/
   ├── types/
   ├── utils/
   └── pages/
   ```

   ### Backend Structure
   ```
   src/
   ├── controllers/
   ├── services/
   ├── models/
   ├── middleware/
   ├── routes/
   ├── utils/
   ├── config/
   └── types/
   ```

## Implementation Requirements

### React Best Practices
- Use React.memo() for performance optimization
- Implement proper component lazy loading
- Use proper React hooks organization
- Implement custom hooks for reusable logic
- Use proper prop typing with TypeScript
- Implement error boundaries
- Use proper React context organization
- Implement proper form validation

### Node.js Best Practices
- Use proper async/await patterns
- Implement proper error handling middleware
- Use proper dependency injection
- Implement proper logging (Winston/Pino)
- Use proper environment configuration
- Implement proper database transactions
- Use proper caching strategies
- Implement proper API documentation (Swagger/OpenAPI)

### UI Component Requirements
- Use a modern UI library (MUI, Chakra UI, or Tailwind CSS)
- Implement proper component composition
- Use proper styling organization (CSS Modules or Styled Components)
- Implement proper responsive design
- Use proper accessibility patterns
- Implement proper loading states
- Use proper animation patterns
- Implement proper error states

### API Integration
- Use Axios or Fetch with proper interceptors
- Implement proper request/response typing
- Use proper error handling
- Implement proper retry logic
- Use proper caching strategies
- Implement proper authentication headers
- Use proper request cancellation
- Implement proper request queuing

## Feature Implementation

### React Dashboard Requirements
- Use proper data visualization libraries (Recharts/Nivo)
- Implement real-time updates with WebSocket
- Use proper grid layout system
- Implement proper filtering system
- Use proper sorting capabilities
- Implement proper pagination
- Use proper search functionality
- Implement proper export capabilities

### Node.js API Requirements
- Implement proper RESTful endpoints
- Use proper validation (Joi/Zod)
- Implement proper authorization
- Use proper database queries
- Implement proper caching
- Use proper rate limiting
- Implement proper logging
- Use proper error responses

## Development Tools

### Frontend Development
- Use proper ESLint configuration
- Implement Prettier for code formatting
- Use proper testing setup (Jest/Testing Library)
- Implement Storybook for component development
- Use proper bundle analysis
- Implement proper performance monitoring
- Use proper TypeScript configuration
- Implement proper PWA setup

### Backend Development
- Use proper debugging configuration
- Implement proper testing (Jest/Supertest)
- Use proper documentation generation
- Implement proper database migrations
- Use proper seed data setup
- Implement proper logging setup
- Use proper monitoring setup
- Implement proper security scanning

## Quality Assurance

### Testing Requirements
- Implement unit tests (Jest)
- Use integration tests (Testing Library)
- Implement E2E tests (Cypress/Playwright)
- Use proper test coverage
- Implement proper mock setup
- Use proper test utilities
- Implement proper test data
- Use proper CI/CD integration

### Performance Requirements
- Implement proper code splitting
- Use proper bundle optimization
- Implement proper image optimization
- Use proper caching strategies
- Implement proper lazy loading
- Use proper performance monitoring
- Implement proper database indexing
- Use proper query optimization

## Security Implementation

### Frontend Security
- Implement proper XSS prevention
- Use proper CSRF protection
- Implement proper input sanitization
- Use proper authentication storage
- Implement proper route guards
- Use proper security headers
- Implement proper error handling
- Use proper sensitive data handling

### Backend Security
- Implement proper authentication
- Use proper authorization
- Implement proper input validation
- Use proper password hashing
- Implement proper rate limiting
- Use proper security headers
- Implement proper logging
- Use proper error handling

## DevOps Requirements

### Development Environment
- Use Docker for development
- Implement proper environment variables
- Use proper development scripts
- Implement proper hot reloading
- Use proper debugging setup
- Implement proper local database
- Use proper service mocking
- Implement proper development data

### Deployment
- Use proper build optimization
- Implement proper environment configuration
- Use proper deployment scripts
- Implement proper health checks
- Use proper monitoring setup
- Implement proper backup strategies
- Use proper rollback procedures
- Implement proper logging setup

## Documentation Requirements

### Technical Documentation
- Include complete API documentation
- Provide component documentation
- Include setup instructions
- Provide deployment guides
- Include troubleshooting guides
- Provide performance optimization guides
- Include security best practices
- Provide development guidelines

### Code Documentation
- Use proper JSDoc comments
- Implement proper type documentation
- Use proper code examples
- Implement proper changelog
- Use proper version documentation
- Implement proper API versioning
- Use proper configuration documentation
- Implement proper error documentation
bun
chakra-ui
cypress
docker
dockerfile
eslint
express.js
golang
+21 more
mford7998a/smshub-manager-application

Used in 1 repository

TypeScript
; 这段文档是Cursor的提示词,用于指导Cursor如何与我交互,放到General - Rules for AI 的文本框中

; You are an AI coding instructor designed to assist and guide me as I learn to code. Your primary goal is to help me learn programming concepts, best practices, and problem-solving skills while writing code. Always assume I'm a beginner with limited programming knowledge.

; Follow these guidelines in all interactions:
; 1. Explain concepts thoroughly but in simple terms, avoiding jargon when possible.
; 2. When introducing new terms, provide clear definitions and examples.
; 3. Break down complex problems into smaller, manageable steps.
; 4. Encourage good coding practices and explain why they are important.
; 5. Provide examples and analogies to illustrate programming concepts.
; 6. Be patient and supportive, understanding that learning to code can be challenging.
; 7. Offer praise for correct implementations and gentle corrections for mistakes.
; 8. When correcting errors, explain why the error occurred and how to fix it.
; 9. Suggest resources for further learning when appropriate.
; 10. Encourage me to ask questions and seek clarification.
; 11. Foster problem-solving skills by guiding me to find solutions rather than always providing direct answers.
; 12. Adapt your teaching style to my pace and learning preferences.
; 13. Provide code snippets to illustrate concepts, but always explain the code line by line.
; 14. Use comments throughout the code to help document what is happening
; 15. All above output should be in Chinese.

; Address the my questions thoroughly, keeping in mind the guidelines above. If the question is unclear or lacks context, ask me for clarification.

; Review the code and provide feedback. If there are errors or areas for improvement, explain them clearly and suggest corrections. If the code is correct, offer praise and explain why it's a good implementation.

; Structure your responses as follows:
; 1. Format your response as markdown
; 2. Answer my question
; 3. Code review and feedback
; 4. Suggestions for further learning or practice

; Remember, your goal is not just to help me write correct code, but to help me understand the underlying principles and develop my programming skills. Always strive to be clear, patient, and encouraging in your responses.



; 这个文件适用于跟随项目的规则定制,可以参考这个链接:
;  https://cursor.document.top/tips/usage/set-rules/
golang
javascript
typescript
chenxian1012/VSCodeMacros

Used in 1 repository