lacymorrow illish .cursorrules file for TypeScript

# Always consider:

This is a Next.js project using App Router, Shadcn/UI, Tailwind, Resend, Builder.io, Payload CMS 3, NextAuth/AuthJS@v5, TypeScript, using PNPM as the package manager.
Be aware of the latest versions of all libraries.
Your plans should be documented into a ai.mdx file. Check to see if it exists. If it does, pick up where you left off. Mark completed steps with a checkbox. Update the file as you work, so another AI can continue from where you left off.

## Don't

Don't delete environment variables.
Don't nest server components in client components unless passed through props.

## Comments

pre-emptively add comments to explain "why" behind the code.
do not modify comments or functionality unrelated to the prompt unless you have a very good reason.
You will preserve all existing comments unless specifically asked to modify them
When showing code changes, use comments like // ... to indicate unchanged sections of code
We like comments with callouts and examples, like:

```
/*
 * Logging configuration
 * @see https://nextjs.org/docs/app/api-reference/next-config-js/logging
 */
```

## File structure

Prefer `hyphen-case.ext` over `CamelCase.ext`.
Use `@/server/actions` for all server actions.
Use `@/server/services` for all internal services.

## Coding conventions

pre-emptively ask questions if you are unsure about the requirements.
pre-emptively optimize code for production.
pre-emptively add types to all functions and variables.
pre-emptively fix any typescript errors or warnings.

Use open-source libraries when they would enhance the user/developer experience.
Use best practices, write production-ready code.
Fix bugs and improve performance.
Comment any complex or hard-to-read code.
fix all typescript errors and warnings.

## React

Use functional components and hooks for state management.
Ensure components are reusable and maintainable.
Prefer server actions for internal API requests.
Maintain a separation of concerns between client and server components.

Prefer arrow functions for React components:
✅ export const Component = () => { ... }
❌ export function Component() { ... }
❌ export default function Component() { ... }


## Next.js

Don't use server actions to fetch data.

## When interacting with the database

1. Ensure all required fields are provided when interacting with the database.
2. Check for potential undefined values and handle them appropriately.
3. Use TypeScript's type system to enforce correct data structures.
4. Implement error handling for database operations and API requests.
5. Validate input data to prevent runtime errors and ensure data integrity.
6. Add comments to explain complex logic or important decisions in the code.
7. Regularly review and test code to catch and fix errors early.
8. Use the `db.transaction` method to ensure atomicity when performing multiple database operations.
9. don't use boolean values for anything, use dates instead. (e.g. isActive: boolean -> activeAt: Date)

## API Integration

- Use environment variables for sensitive data like API keys.
- Handle API errors gracefully and provide user feedback.
- Use async/await for asynchronous operations to improve readability.
- Document API interactions and expected responses.

## UI/UX Design

- Follow Tailwind CSS conventions for styling.
- Ensure responsive design for all components.
- Use Shadcn/UI components for consistency in UI elements.
- Prioritize accessibility in UI design.

## Performance Optimization

- Optimize images and assets for faster load times.
- Use lazy loading for components and images where applicable.
- Minimize the use of heavy libraries and dependencies.
- Regularly audit and improve performance metrics.
css
golang
nestjs
shadcn/ui
typescript
javascript
less
shell
+7 more

First Time Repository

TypeScript

Languages:

CSS: 9.1KB
JavaScript: 8.5KB
MDX: 57.2KB
Shell: 2.8KB
TypeScript: 2832.4KB
Created: 12/29/2024
Updated: 1/1/2025

All Repositories (2)