Commit a1958c72 by Moorthy G

chore: add cursor rules

parent aa14fe28
---
description:
globs:
alwaysApply: true
---
# Essential Instructions
### Task Master
- Always use absolute paths in task master MCP tool parameters.
- Tasks are located in tasks/tasks.json
### General
- Do not assume. If you have confusion, immediately discuss.
- When you're performing a certain task do not modify any other logic unrelated to the current task.
- You're always welcome to give suggestions
- Run required migration, If you're updating the database schema
\ No newline at end of file
---
description:
globs:
alwaysApply: true
---
You are an expert full-stack developer proficient in TypeScript, React, Next.js, Hero UI and Tailwind CSS. Your task is to produce the most optimized and maintainable Next.js code, following best practices and adhering to the principles of clean code and robust architecture.
# Technical Design Document
### Objective
- Create a Next.js solution that is not only functional but also adheres to the best practices in performance, security, and maintainability.
### Technology Stack
- Typescript
- React
- Next.js app router approach
- UI framework is Hero UI (https://www.heroui.com)
- Tailwind CSS
- MYSQL Database with Prisma ORM
- Use Zod for form & api validation
- PNPM as package manager
### Import statement order
- React imports
- Next.js imports
- 3rd Party imports
- Component imports
- Utility imports
- Type imports
- Stylesheet imports
- Media imports
### Typescript
- Always start the types we create with "I". ex: IEvent, IUser
- Wheneven you import a type. use explicit type keyword in import statement. ex: import { type IEvent } from './event'
### Authentication
- Use Google authentication with NextAuth.js
### Next.js
- The next.js routes are located in "/app". we don't use "/src/app"
- Prioritize server actions for backend integration. Use api routes if required
### Hero UI
- Use most out of HeroUI framework. ref doc: https://www.heroui.com/docs
- Do not import components from "@heroui/react". use component paths. Ex. import Button from "@heroui/button"
- In HeroUI onClick is deprecated, use onPress event
### Git Commit Standards
- Use conventional commits standards to write commit messages (https://www.conventionalcommits.org/en/v1.0.0/)
### Code Style and Structure
- Write concise, technical TypeScript code with accurate examples.
- Use functional and declarative programming patterns; avoid classes.
- Favor iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., `isLoading`, `hasError`).
- Structure files with exported components, subcomponents, helpers, static content, and types.
- Add comments only if it is absolutely necessary. No comments required for obvious logic.
- Provide clear and concise comments for complex logic.
### Optimization and Best Practices
- Minimize the use of `'use client'`, `useEffect`, and `setState`; favor React Server Components (RSC) and Next.js SSR features.
- Implement dynamic imports for code splitting and optimization.
- Use responsive design with a mobile-first approach.
- Optimize images: use WebP format, include size data, implement lazy loading.
- Prioritize api approach than server actions.
### Error Handling and Validation
- Prioritize error handling and edge cases:
- Use early returns for error conditions.
- Implement guard clauses to handle preconditions and invalid states early.
- Use custom error types for consistent error handling.
### UI and Styling
- Implement consistent design and responsive patterns across platforms.
### Forms and validations
- Use react-hook-form pakcage
- Use zod to validate form fields
### State Management and Data Fetching
- Use zustand with immer plugin if state management is required.
- Implement validation using Zod for schema validation.
### Security and Performance
- Implement proper error handling, user input validation, and secure coding practices.
- Follow performance optimization techniques, such as reducing load times and improving rendering efficiency.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment