SrijaAdhya12 prisma-ai .cursorrules file for JavaScript (stars: 2)

You are an expert in Vite, React, JavaScript, ShadCn, Auth0, axios, lucide-react, Stream chat, Framer motion, face-api.js, tailwindcss, radixui, aceternity-ui, Express.js, Node.js, Mongoose, MongoDB, and OpenAI.

Key Principles
- Write concise, technical responses with accurate JavaScript 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-modal).
- Favor named exports for components.
- Use the Receive an Object, Return an Object (RORO) pattern.

JavaScript
- Use "function" keyword for pure functions. Use semicolons.
- File structure: Exported component, subcomponents, helpers, static content.
- 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/Vite
- Use functional components.
- Use declarative JSX.
- Use function, not const, for components.
- Use ShadCn, Radix UI, and Aceternity UI for components and styling.
- Implement responsive design with Tailwind CSS.
- Use mobile-first approach for responsive design.
- Place static content at file end.
- Use content variables for static content outside render functions.
- Use Auth0 for authentication.
- Use axios for API requests.
- Use lucide-react for icons.
- Implement Stream chat for real-time messaging.
- Use Framer Motion for animations.
- Utilize face-api.js for facial recognition features.

Backend (Express.js/Node.js)
- Use Express.js for routing and middleware.
- Implement RESTful API design principles.
- Use Mongoose for MongoDB object modeling.
- Implement proper error handling middleware.
- Use environment variables for configuration.
- Implement input validation and sanitization.
- Use async/await for asynchronous operations.

MongoDB/Mongoose
- Design schemas with proper data types and validation.
- Use indexes for frequently queried fields.
- Implement data pagination for large datasets.
- Use aggregation pipelines for complex queries.

OpenAI Integration
- Implement proper error handling for API calls.
- Use streaming responses when appropriate.
- Implement rate limiting and usage tracking.

Key Conventions
1. Use Vite for fast development and optimized builds.
2. Prioritize Web Vitals (LCP, CLS, FID).
3. Implement proper state management (e.g., React Context, Redux).
4. Use proper security measures (e.g., CORS, helmet for Express).
5. Implement efficient data fetching and caching strategies.

Refer to the documentation of each technology for best practices and up-to-date information.
css
emotion
express.js
golang
html
java
javascript
mongodb
+10 more

First Time Repository

Introducing an AI-driven virtual companion named Prisma AI that provides personalized mental health support tailored to each user’s unique emotional needs. Using advanced mood analysis, it suggests activities and coping strategies based on the user’s current state of mind.

JavaScript

Languages:

CSS: 2.3KB
HTML: 0.7KB
JavaScript: 223.2KB
Created: 9/28/2024
Updated: 1/23/2025

All Repositories (1)

Introducing an AI-driven virtual companion named Prisma AI that provides personalized mental health support tailored to each user’s unique emotional needs. Using advanced mood analysis, it suggests activities and coping strategies based on the user’s current state of mind.