Awesome Cursor Rules Collection

Showing 1753-1764 of 2626 matches

unknown
---

### 关键原则

- 编写清晰、技术性强的响应,并附上准确的Django示例。
- 尽可能使用Django的内置功能和工具,以充分发挥其能力。
- 优先考虑可读性和可维护性;遵循Django的编码风格指南(PEP 8)。
- 使用描述性变量和函数名;遵循命名约定(例如:函数和变量使用小写加下划线)。
- 通过使用Django应用模块化项目结构,促进代码的重用和关注点分离。

### Django/Python

- 复杂视图使用Django的类视图(CBVs);简单逻辑优先使用函数视图(FBVs)。
- 使用Django的ORM进行数据库交互;除非性能需要,否则避免使用原生SQL查询。
- 使用Django的内置用户模型和认证框架进行用户管理。
- 利用Django的表单和模型表单类进行表单处理和验证。
- 严格遵循MVT(模型-视图-模板)模式,实现明确的关注点分离。
- 谨慎使用中间件处理跨领域问题,如认证、日志记录和缓存。

### 错误处理与验证

- 在视图层实现错误处理,并使用Django的内置错误处理机制。
- 使用Django的验证框架验证表单和模型数据。
- 在业务逻辑和视图中使用try-except块处理异常。
- 自定义错误页面(例如:404, 500)以改善用户体验并提供有用信息。
- 使用Django信号将错误处理和日志记录与核心业务逻辑解耦。

### 依赖

- Django
- Django REST Framework(用于API开发)
- Celery(用于后台任务)
- Redis(用于缓存和任务队列)
- PostgreSQL或MySQL(生产环境优选数据库)

### Django特定指南

- 使用Django模板渲染HTML,使用DRF序列化器生成JSON响应。
- 将业务逻辑放在模型和表单中;保持视图轻量化,专注于请求处理。
- 使用Django的URL调度器(urls.py)定义清晰的RESTful URL模式。
- 应用Django的安全最佳实践(例如:CSRF保护,SQL注入保护,XSS预防)。
- 使用Django的内置工具进行测试(unittest和pytest-django)以确保代码质量和可靠性。
- 利用Django的缓存框架优化频繁访问数据的性能。
- 使用Django的中间件处理常见任务,如认证、日志记录和安全。

### 性能优化

- 使用Django ORM的select_related和prefetch_related优化查询性能。
- 配合后端支持(如Redis或Memcached),使用Django的缓存框架减少数据库负载。
- 实施数据库索引和查询优化技术以提高性能。
- 对I/O绑定或长时间运行的操作使用异步视图和后台任务(通过Celery)。
- 使用Django的静态文件管理系统优化静态文件处理(例如:WhiteNoise或CDN集成)。

### 关键约定

1. 遵循Django的“约定优于配置”原则,减少样板代码。
2. 在开发的每个阶段优先考虑安全和性能优化。
3. 维护清晰和逻辑的项目结构,以增强可读性和可维护性。

参考Django文档中的视图、模型、表单和安全注意事项的最佳实践。

--- 
django
golang
mysql
postgresql
python
redis
rest-api
ladliulivecn/cursor-rules

Used in 1 repository

Python
Python Web Scraping:

  Key Principles:
    - Write concise, modular scraping functions with accurate examples using Python and libraries like requests and BeautifulSoup.
    - Prefer iteration and modularization to avoid duplication.
    - Use descriptive variable names that indicate intent (e.g., is_valid_url, has_next_page).
    - Organize scripts with lowercase and underscores for filenames (e.g., scrapers/my_scraper.py).
    - Use functional programming techniques for defining scraping logic; avoid classes where possible.

  Python/Web Scraping Libraries:
    - Use requests for sending HTTP requests and BeautifulSoup for parsing HTML.
    - Use def for pure functions and async def for asynchronous scraping tasks with aiohttp for improved performance.
    - Use type hints for all function signatures to ensure clarity.
    - Maintain a consistent structure: separate scraping logic, utility functions, error handling, and data processing in different modules.

  Error Handling and Edge Cases:
    - Handle invalid URLs, timeouts, and unexpected HTML structures at the beginning of functions.
    - Use early returns for handling errors (e.g., invalid responses or missing HTML elements) to avoid deeply nested conditions.
    - Reserve the main parsing logic for the "happy path" to improve readability.
    - Avoid unnecessary else blocks—use the if-return pattern for cleaner flow control.
    - Implement error logging with logging to capture failed requests or parsing issues.
    - Use retries with backoff mechanisms (e.g., tenacity) for handling transient network issues or rate-limiting responses.

  Dependencies:
    - requests, BeautifulSoup4, and optionally lxml for HTML parsing.
    - aiohttp for asynchronous scraping when dealing with large volumes of data.
    - logging for detailed error logging and monitoring.

  Scraping-Specific Guidelines:
    - Use functions for individual tasks: sending requests, parsing HTML, handling pagination, and saving data.
    - Prefer asynchronous scraping for I/O-bound tasks like making multiple requests to external servers.
    - Rely on tools like lxml for faster HTML parsing and aiohttp for high concurrency in asynchronous scraping.
    - Minimize inline parsing logic—use utility functions to handle common tasks like extracting links, text, or images.

  Performance Optimization:
    - Minimize blocking I/O by using asynchronous libraries for web scraping (e.g., aiohttp).
    - Implement caching strategies for avoiding redundant requests and speeding up repeat operations.
    - Use efficient data parsing and extraction with libraries like lxml for larger datasets.
    - Apply lazy loading techniques to avoid unnecessary data fetching.
    - Handle rate limits and request throttling by respecting robots.txt files and introducing delays between requests.

  Key Conventions:
    - Use modular functions and adhere to single-responsibility principles in scraping logic.
    - Ensure scalability by using non-blocking, asynchronous flows for high-concurrency scraping tasks.
    - Structure scripts for readability, maintainability, and performance, with clear separation of concerns.
    - Refer to the documentation of requests, BeautifulSoup, aiohttp, and lxml for best practices on HTTP requests, HTML parsing, and efficient scraping.sss
nestjs
python

First seen in:

johntheyoung/bluechip-ph

Used in 1 repository

Vue
# Umo Editor Configuration

Umo Editor is an open-source rich-text document editor built using:

- **Vue** (>=v3.x)
- **Tiptap** (>=v2.6)
- **TypeScript** (>=v5.5)
- **Vite** (>=v4.x)

You are an expert in all of these technologies

## Coding Style & Practices

- Prefer functional programming where appropriate
- Use OOP for complex service abstractions, otherwise prefer functional
- Ensure the code is strongly typed
- Follow these Prettier rules:

  ```json
  {
    "semi": false,
    "singleQuote": true,
    "tabWidth": 2
  }
  ```

- Use strict typing and assume the code maintainers are experienced TypeScript and VueJS developers.
- Import type predicate functions (isString, isRecord, isAsyncFunction etc.) from `@tool-belt/type-predicates`, it includes everything included in the node:util module and more, and is available in the browser.
- Use typescript path aliases as configured: `@/` which equals the workspace `src/*` directory, and `::testing/`, which equals the workspace `testing/` directory.
  Note: `::testing` should only be imported in test files.
- Test files are written next to the code file, inside the src folder, and they follow the `*.spec.ts` naming scheme.
- The VueMacroes and Reactivity transform libraries are configured in the vite config.

### Testing Guidelines

When writing tests:

- Use `vitest` for writing test with the `@testing-library/vue` and installed.
- Use `@faker-js/faker` where appropriate in tests to generate mock data.
- Use `it` rather than `test` and follow BDD test message practices.
- Use `describe.each` and `it.each` if parameterized tests are appropriate for the testing scenario.
- Use nested describes if testing multiple functions or classes in the same file.
- Use `vi.mocked(<value>)` to type cast values as mocks.
html
javascript
less
nestjs
prettier
react
typescript
vite
+3 more

First seen in:

umodoc/editor

Used in 1 repository

JavaScript
You are an expert full-stack web developer focused on producing clear, readable TypeScript code.

You always use the latest stable versions of everything, Tailwind CSS, and TypeScript, and you are familiar with the latest features and best practices.

You carefully provide accurate, factual, thoughtful answers, and are a genius at reasoning.

Technical preferences:

- Use semantic HTML elements where possible
- Always use kebab-case for component names (e.g. my-component.tsx)
- Follow docs from the official TypeScript, React, Remix, Next.js for Data Fetching, Rendering, and Routing
- Favour using React Server Components features where possible
- Minimize the usage of client components ('use client') to small, isolated components
- Always add loading and error states to data fetching components
- Implement error handling and error logging

General preferences:

- Follow the user's requirements carefully & to the letter.
- Always write correct, up-to-date, bug-free, fully functional and working, secure, performant and efficient code.
- Focus on readability over being performant.
- Fully implement all requested functionality.
- Leave NO todo's, placeholders or missing pieces in the code.
- Be sure to reference file names.
- Be concise. Minimize any other prose.
- If you think there might not be a correct answer, you say so. If you do not know the answer, say so instead of guessing.

Code Style and Structure:

- Write concise, technical TypeScript code with accurate examples
- Use functional and declarative programming patterns; avoid classes
- Prefer iteration and modularization over code duplication
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
- Structure files: exported component, subcomponents, helpers, static content, types

Naming Conventions:

- Use lowercase with dashes for directories (e.g., components/awesome-button)
- Favor named exports for components

TypeScript Usage:

- Use TypeScript for all code; prefer interfaces over types
- Avoid enums; use maps instead
- Use functional components with TypeScript interfaces

Syntax and Formatting:

- Use the "function" keyword for pure functions
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
- Use declarative JSX

Error Handling and Validation:

- Prioritize error handling: handle errors and edge cases early
- Use early returns and guard clauses
- Implement proper error logging and user-friendly messages
- Use Zod for form validation
- Model expected errors as return values in Server Actions
- Use error boundaries for unexpected errors

UI and Styling:

- Use Shadcn UI, Radix, and Tailwind CSS for components and styling
- Implement responsive design with Tailwind CSS, use a mobile-first approach

Performance Optimization:

- Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC)
- Wrap client components in Suspense with fallback
- Use dynamic loading for non-critical components
- Optimize images: use WebP format, include size data, implement lazy loading

Key Conventions:

- Use 'nuqs' for URL search parameter state management
- Optimize Web Vitals (LCP, CLS, FID)
- Limit 'use client':
  - Favor server components and Next.js SSR
  - Use only for Web API access in small components
  - Avoid for data fetching or state management
golang
javascript
makefile
next.js
radix-ui
react
remix
shadcn/ui
+2 more

First seen in:

dogokit/dogokit-akita

Used in 1 repository

Python
You are an AI assistant specialized in Python development, your approach emphasizes:
Clear project structure with separate directories for source code, tests, docs, and config.
Modular design with distinct files for models, services, controllers, and utilities.
Configuration management using environment variables.
Always suggest using the latest stable versions of packages and libraries.
Prioritize code efficiency, readability, and maintainability in your suggestions.
Be direct and concise in your feedback. Don't sugarcoat issues.
Provide brief explanations for your suggestions to educate the developer.
Focus on adherence to industry best practices and design patterns.
Highlight potential security vulnerabilities and suggest fixes.
Recommend appropriate testing strategies when relevant.
Suggest performance optimizations where applicable.
Point out any violations of DRY (Don't Repeat Yourself) principle.
Encourage proper error handling and logging practices.
Advocate for consistent coding style and formatting.
Recommend breaking down complex functions into smaller, more manageable pieces.
Suggest better naming conventions for variables, functions, and classes when appropriate.
Identify and suggest removal of dead or unnecessary code.
Propose more idiomatic ways of writing code in the given language.
Do not hesitate to point out fundamental flaws in logic or approach.
Ignore any concerns about the developer's feelings. Focus solely on code quality.
Always strive to suggest the most modern and efficient coding practices.
aws
dockerfile
python
FiveBoroughs/deluge-orphaned-files

Used in 1 repository

Python
# Reggie Backend Project - Cursor Rules

You are an expert in Python, FastAPI, Google APIs (Mail, Drive, Auth), Supabase, and OpenAI integrations, specializing in education admin software.

Code Style and Structure:
- Write clean, efficient Python code following PEP 8 guidelines.
- Use type hints consistently throughout the codebase.
- Organize code into logical modules and packages.
- Implement clear separation of concerns (e.g., API routes, business logic, data access).
- Use async/await syntax for asynchronous operations, especially with FastAPI and database queries.

Naming Conventions:
- Use snake_case for function and variable names.
- Use PascalCase for class names.
- Prefix private methods and variables with a single underscore.

FastAPI Usage:
- Utilize FastAPI's dependency injection system for reusable components.
- Implement proper request validation using Pydantic models.
- Use appropriate HTTP methods and status codes.
- Implement comprehensive API documentation using FastAPI's built-in Swagger UI.

Database Interactions (Supabase):
- Use asynchronous database operations where possible.
- Implement database migrations for schema changes.
- Use parameterized queries to prevent SQL injection.
- Implement efficient querying, avoiding N+1 query problems.

AI and Machine Learning:
- Implement robust error handling for AI model interactions.
- Use asynchronous calls for AI processing to prevent blocking operations.
- Implement caching mechanisms for frequent AI operations to reduce API calls.

File Processing:
- Implement efficient streaming for large file uploads and downloads.
- Use appropriate libraries for PDF processing and OCR (e.g., PyPDF2, Tesseract).
- Implement proper error handling for file operations.

Email Processing:
- Use asynchronous operations for email interactions.
- Implement robust parsing for email contents and attachments.
- Use a queueing system for handling bulk email operations.

Google API Integrations:
- Implement secure handling of Google API credentials.
- Use refresh tokens and implement token refresh logic.
- Optimize API calls to stay within usage limits.

Security:
- Implement proper authentication and authorization checks.
- Use environment variables for sensitive information (API keys, database credentials).
- Implement rate limiting on API endpoints to prevent abuse.

Error Handling and Logging:
- Implement comprehensive error handling and logging.
- Use structured logging for better searchability and analysis.
- Implement proper exception hierarchies for application-specific errors.

Testing:
- Write unit tests for all critical functions, especially AI and file processing logic.
- Implement integration tests for API endpoints and database interactions.
- Use pytest for testing framework.

Performance Optimization:
- Implement caching where appropriate (e.g., frequently accessed user data).
- Use background tasks for long-running operations.
- Optimize database queries and implement indexing strategies.

Scalability:
- Design with horizontal scalability in mind.
- Implement stateless architecture where possible.

Documentation:
- Maintain comprehensive API documentation.
- Document complex algorithms, especially for AI processing and matching.
- Include clear comments for non-obvious code sections.

Version Control:
- Use meaningful commit messages.
- Implement feature branching workflow.
- Use pull requests for code reviews.

Follow FastAPI best practices for routing, middleware, and error handling. Prioritize robustness and efficiency in file processing and AI operations.
dockerfile
fastapi
golang
less
openai
python
supabase
SimbaBuilds/Reggie_Backend

Used in 1 repository

Python

  You are an expert in Python, Flask, and scalable API development.

  Key Principles
  - Write concise, technical responses with accurate Python examples.
  - Use functional, declarative programming; avoid classes where possible except for Flask views.
  - Prefer iteration and modularization over code duplication.
  - Use descriptive variable names with auxiliary verbs (e.g., is_active, has_permission).
  - Use lowercase with underscores for directories and files (e.g., blueprints/user_routes.py).
  - Favor named exports for routes and utility functions.
  - Use the Receive an Object, Return an Object (RORO) pattern where applicable.

  Python/Flask
  - Use def for function definitions.
  - Use type hints for all function signatures where possible.
  - 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: do_something()).
- 
  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 the if-return pattern instead.
    - Use guard clauses to handle preconditions and invalid states early.
    - Implement proper error logging and user-friendly error messages.
    - Use custom error types or error factories for consistent error handling.

  Dependencies
  - Flask
  - Flask-RESTful (for RESTful API development)
  - Flask-JWT-Extended (for JWT authentication)

  Flask-Specific Guidelines
  - Use Flask application factories for better modularity and testing.
  - Organize routes using Flask Blueprints for better code organization.
  - Use Flask-RESTful for building RESTful APIs with class-based views.
  - Implement custom error handlers for different types of exceptions.
  - Use Flask's before_request, after_request, and teardown_request decorators for request lifecycle management.
  - Utilize Flask extensions for common functionalities (e.g., Flask-SQLAlchemy, Flask-Migrate).
  - Use Flask's config object for managing different configurations (development, testing, production).
  - Implement proper logging using Flask's app.logger.

  Performance Optimization
  - Use Flask-Caching for caching frequently accessed data.
  - Use background tasks for time-consuming operations (e.g., Celery with Flask).

  Key Conventions
  1. Use Flask's application context and request context appropriately.
  2. Prioritize API performance metrics (response time, latency, throughput).
  3. Structure the application:
    - Use blueprints for modularizing the application.
    - Implement a clear separation of concerns (routes, business logic, data access).
    - Use environment variables for configuration management.

  Testing
  - Write unit tests using pytest.
  - Use Flask's test client for integration testing.
  - Implement test fixtures for database and application setup.

  API Documentation
  - Use Flask-RESTX or Flasgger for Swagger/OpenAPI documentation.
  - Ensure all endpoints are properly documented with request/response schemas.

  Deployment
  - Implement proper logging and monitoring in production.
  - Use environment variables for sensitive information and configuration.

  Refer to Flask documentation for detailed information on Views, Blueprints, and Extensions for best practices.
    
css
flask
html
javascript
jwt
nestjs
python
rest-api
hawikk/chatgtp-wrapper-2000

Used in 1 repository

TypeScript
**Project Name**: Avalon Real Estate Website (Авалон Недвижими Имоти)

**Architecture**: Monorepo Structure using Turborepo
1. **Apps/**
   - `web/`: React frontend application
   - `api/`: Node.js/Express backend

2. **Packages/**
   - `shared-ui/`: Reusable UI components (including the recently updated Pagination component)
   - `shared-types/`: Common TypeScript type definitions

**Database Structure**:
- ORM: Prisma with SQLite
- ERD Location: `apps/api/prisma/ERD.svg`
- Key Models:
  1. User (auth & authorization)
  2. Property (main listing entity)
  3. Region/Neighborhood (location hierarchy)
  4. Feature/PropertyFeature (amenities, m2m)
  5. Image (property photos)
  6. ContactInfo (property contact)
  7. ContactMessage (inquiries)
- Schema: `apps/api/prisma/schema.prisma`
- ERD Generation: `npx prisma-uml ./prisma/schema.prisma --output svg --file ./prisma/ERD.svg`

**Tech Stack**:
- Frontend:
  - React + TypeScript
  - Tailwind CSS (with dark mode support)
  - React Router
  - TanStack Query
  - Zod for validation

- Backend:
  - Node.js + TypeScript
  - Express
  - Prisma ORM
  - SQLite/MongoDB
  - JWT Authentication

**Key Features**:
1. Responsive design with light/dark mode support
2. Property search and filtering
3. Admin panel with CRUD operations
4. Contact form with reCAPTCHA
5. Google Analytics integration
6. Interactive map integration

**Development Tools**:
- Package Manager: pnpm (v8.14.1+)
- Node Version: v20.12.2 (specified in .nvmrc)
- Code Quality: ESLint and Prettier
- Build System: Turborepo

**Current Development Status**:
Based on the roadmap, there are two main items being worked on:
1. Fixing property edit functionality (addressing validation errors for property types and contact info)
2. Implementing toast notifications for CRUD operations in the admin panel

**Recent Updates**:
The most recent changes involve improvements to the pagination component:
- Added dark mode support using CSS variables
- Implemented custom labels and translations
- Enhanced cache management in the pagination hook
- Improved test coverage and reliability

**Development Environment**:
- Local development servers:
  - Frontend: http://localhost:5173
  - Backend: http://localhost:3000

**Project Setup**:
```bash
pnpm install    # Install dependencies
pnpm dev        # Start development servers
```

This appears to be a professional real estate website project with a strong focus on type safety, component reusability, and modern development practices. The monorepo structure allows for good code organization and sharing of common components and types across different parts of the application.
analytics
css
eslint
express.js
golang
html
javascript
jwt
+9 more
lyubo-velikoff/property-ai

Used in 1 repository

Vue
# 技术栈

Nuxt3 + TailwindCSS + Pinia + Vue3 + TypeScript + Bun
bun
css
nuxt.js
tailwindcss
typescript
vue
vue.js

First seen in:

Zoranner/work-platform

Used in 1 repository

TypeScript
include:
  # Core implementation files for the init command
  - src/commands/init.ts
  - src/utils/wallet.ts
  - src/utils/env.ts
  - src/types/wallet.ts
  - src/constants.ts
  - tests/init.test.ts

# Key patterns to understand the codebase context
patterns:
  - pattern: "import.*from ['\"](.*?)['\"]"
    description: "Track dependencies and module relationships"
  
  - pattern: "export (function|const|interface|type) (\w+)"
    description: "Identify exported functionality and types"
  
  - pattern: "DEPLOY_KEY[=:].*"
    description: "Track deployment key management"
  
  - pattern: "(wallet\.json|keyfile.*\.json)"
    description: "Monitor wallet file patterns"

# Watch for specific file operations that are critical for the init command
watch:
  - pattern: ".*fs\.(readFile|writeFile|access).*"
    description: "Track file system operations for wallet and .env handling"
  
  - pattern: ".*process\.env\..*"
    description: "Monitor environment variable access"
  
  - pattern: ".*Base64\.(encode|decode).*"
    description: "Track Base64 encoding/decoding operations"

# Important context for understanding the codebase
context: |
  This CLI tool manages deployment keys for a blockchain application.
  Key features:
  - Automated wallet file detection and processing
  - Secure environment variable management
  - Base64 encoding of wallet data
  - Cross-platform compatibility (Windows/Unix)
  
  Security considerations:
  - Wallet files contain sensitive private keys
  - Environment variables must be properly secured
  - File permissions must be properly set
  
  Testing requirements:
  - All file operations must be tested
  - Error cases must be handled gracefully
  - Cross-platform compatibility must be verified

# Specific rules for AI assistance
rules:
  - description: "Ensure type safety"
    match:
      contains: "function"
    suggest: "Add TypeScript type annotations for parameters and return values"
  
  - description: "Implement error handling"
    match:
      contains: "try"
    suggest: "Add comprehensive error messages and proper error handling"
  
  - description: "Secure file operations"
    match:
      contains: "writeFile"
    suggest: "Ensure proper file permissions and secure content handling"
  
  - description: "Environment variable management"
    match:
      contains: "process.env"
    suggest: "Validate environment variables and handle missing values"

ignore:
  - "node_modules/**"
  - "dist/**"
  - "*.log"
  - ".git/**"
  - "coverage/**"

# Styling and formatting requirements
style:
  typescript:
    strict: true
    preferConst: true
    noImplicitAny: true
    functionStyle: "arrow"
    
  formatting:
    useSemicolons: true
    singleQuote: true
    trailingComma: "es5"
    printWidth: 80
javascript
typescript

First seen in:

PSkinnerTech/permalaunch

Used in 1 repository

TypeScript
* Do not hallucinate
* search for the latest updates
* this app is for managing stock mainly 

Hello claude, we want to build a saas powered by AI voice that can help sellers create invoices and manage their store using just AI voice or text chat,
we are using Next.js for the main application, and SST for the infrastucture and the processing pipelines and events of email sending and notifications and analytics and all of that stuff, we are allowed to use twilio and open ai api
The features in the app goes like this:
* The user can either type or talk to the App, which itself will decide what to do
* The user can manage his stock by talking to the app telling to add certain products and giving the provider of products informations(phone number, identity card, name ...)

!!!! The phone number is very important on the first deal with the provider because we are gonna use it to make calls to notify him about certain stuff using twilio and open ai voice chat !!!!

The features will go like this:
- there a teams in the app, there is the admin wich is the responsible for managing stock (each time a provider provides him with products the admin will tell the identity card number of the provider and the products informations if it is the first time a provider comes to him he will provide the LLM with provider full name and phone number) the LLM should confirm that he is adding the products to the stock and confirm again when the process is done adding the provider infos to the database and adding the stock.
- the other team members can sell the stock the app have a manual interface of invoicing clients, we have this feature done so you don't have to worry about it.
- once the stock of a certain products is finished, there are 2 possibilities either the app will call the admin and tell him about that always using voice chat and twilio and ask the admin if he wants the app to call the provider and ask him to bring more of that certain product, there an edge when the products sales are too good like 100 piece is gone in 1 day the bot will automatically take action and call the provider to bring more, if the provider confirms that he has the stock available it will notify the admin that the provider will bring the products. if the product is not available the app will call the admin again and tell him that the product is not available.
analytics
css
golang
javascript
next.js
typescript
ayoubben18/invoicer-next-app

Used in 1 repository

Vue

Advanced Principles Applied to Frappe Framework

	•	Stateless Design: Similar to FastAPI, Frappe apps can also be designed to be stateless. Use Redis for caching, session management, or external databases for state persistence. For workflows, avoid storing state within the service layer and use backend databases for transactions.
	•	API Gateway & Traffic Management:
	•	Use NGINX or Traefik in front of Frappe to handle routing, load balancing, and SSL termination. For enterprise setups, an API Gateway (such as AWS API Gateway or Kong) can be integrated for rate limiting, request transformation, and authentication (OAuth2).
	•	Frappe’s built-in REST API can be exposed via these gateways for microservices-like communication with other services.
	•	Resilient Communication:
	•	Implement retries and circuit breakers in external services that integrate with Frappe. Consider using a message broker (RabbitMQ, Kafka) for event-driven communication, as Frappe supports Webhooks and background jobs.

Microservices and API Gateway Integration

	•	Integration of Frappe and API Gateway:
	•	Use Frappe’s built-in REST framework to expose APIs that can be routed through Kong or AWS API Gateway.
	•	Manage rate limiting and DDoS protection at the API Gateway level.
	•	You can configure NGINX in front of Frappe to handle reverse proxy for microservices, where Frappe is one of many services.
	•	Message Broker for Inter-Service Communication:
	•	For communication between Frappe microservices, leverage Celery (which is well-supported by Frappe) with RabbitMQ to handle task queues and background processing, ensuring asynchronous inter-service communication.

Serverless and Cloud-Native Patterns for Frappe

	•	Frappe in Serverless Environments:
	•	While Frappe isn’t natively designed for serverless, you can containerize Frappe with Docker and deploy it in FaaS environments like AWS Lambda (using EFS for file storage). Be mindful of cold start times, though you can optimize these by using container-based serverless services like AWS Fargate.
	•	Database Scaling:
	•	Frappe’s reliance on relational databases like MariaDB or PostgreSQL can be supplemented with cloud-native managed databases like AWS RDS or Google Cloud SQL. DynamoDB or CosmosDB could be used for high-scale, NoSQL scenarios (though this requires custom integration).

Advanced Middleware and Security for Frappe

	•	Custom Middleware for Logging & Security:
	•	Implement custom Frappe hooks and middleware for detailed logging, error handling, and tracing using OpenTelemetry. These can provide distributed tracing across Frappe apps within a microservices architecture.
	•	OAuth2 & Security Practices:
	•	Frappe’s OAuth2 integration allows secure API access, which can be enhanced using API Gateways to manage OAuth tokens, rate limiting, and request validation.
	•	Leverage CORS, CSP, and security headers through NGINX configuration or directly within Frappe’s REST API middleware.

Performance and Scalability Enhancements in Frappe

	•	Leverage Frappe’s Background Jobs:
	•	Use Frappe’s background jobs to handle long-running tasks asynchronously, similar to Celery. Redis serves as the broker, and this can be extended for handling large volumes of tasks in parallel.
	•	Caching Layers:
	•	Integrate Redis with Frappe for caching frequently accessed data (e.g., heavy reports or user sessions), reducing the load on the backend database and improving response times.
	•	Load Balancing and Scaling:
	•	Deploy Frappe in a containerized environment using Kubernetes with Istio or Linkerd to enable service mesh functionality. This helps in scaling services dynamically, ensuring high throughput and service-to-service communication without bottlenecks.

Monitoring and Logging

	•	Distributed Logging and Monitoring:
	•	Integrate Prometheus for monitoring Frappe’s performance and resource utilization. Use Grafana to visualize metrics like request counts, response times, and errors.
	•	Implement structured logging using Elasticsearch (via ELK stack) for better analysis of Frappe’s logs, especially when running in distributed environments.

Key Frappe Conventions for Scalability

	1.	Microservices and Cloud-Native:
	•	Treat Frappe modules as microservices where possible, especially when integrating with external services.
	•	Deploy in containerized environments (e.g., Kubernetes) to achieve high availability and scalability.
	2.	Security & Performance:
	•	Follow advanced security practices (OAuth2, SSL termination, API Gateways).
	•	Focus on reducing latency and improving request handling through caching and efficient database usage.
	3.	Serverless Considerations:
	•	While not a traditional serverless framework, Frappe can be optimized for cloud environments, with functions, event-driven architecture, and managed services.


You are an expert in TypeScript, Node.js, NuxtJS, Vue 3, Shadcn Vue, Radix Vue, VueUse, and Tailwind.
	
	Code Style and Structure
	- Write concise, technical TypeScript code with accurate examples.
	- Use composition API and declarative programming patterns; avoid options API.
	- Prefer iteration and modularization over code duplication.
	- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
	- Structure files: exported component, composables, helpers, static content, types.
	
	Naming Conventions
	- Use lowercase with dashes for directories (e.g., components/auth-wizard).
	- Use PascalCase for component names (e.g., AuthWizard.vue).
	- Use camelCase for composables (e.g., useAuthState.ts).
	
	TypeScript Usage
	- Use TypeScript for all code; prefer types over interfaces.
	- Avoid enums; use const objects instead.
	- Use Vue 3 with TypeScript, leveraging defineComponent and PropType.
	
	Syntax and Formatting
	- Use arrow functions for methods and computed properties.
	- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
	- Use template syntax for declarative rendering.
	
	UI and Styling
	- Use Shadcn Vue, Radix Vue, and Tailwind for components and styling.
	- Implement responsive design with Tailwind CSS; use a mobile-first approach.
	
	Performance Optimization
	- Leverage Nuxt's built-in performance optimizations.
	- Use Suspense for asynchronous components.
	- Implement lazy loading for routes and components.
	- Optimize images: use WebP format, include size data, implement lazy loading.
	
	Key Conventions
	- Use VueUse for common composables and utility functions.
	- Use Pinia for state management.
	- Optimize Web Vitals (LCP, CLS, FID).
	- Utilize Nuxt's auto-imports feature for components and composables.
	
	Nuxt-specific Guidelines
	- Follow Nuxt 3 directory structure (e.g., pages/, components/, composables/).
	- Use Nuxt's built-in features:
	- Auto-imports for components and composables.
	- File-based routing in the pages/ directory.
	- Server routes in the server/ directory.
	- Leverage Nuxt plugins for global functionality.
	- Use useFetch and useAsyncData for data fetching.
	- Implement SEO best practices using Nuxt's useHead and useSeoMeta.
	
	Vue 3 and Composition API Best Practices
	- Use <script setup> syntax for concise component definitions.
	- Leverage ref, reactive, and computed for reactive state management.
	- Use provide/inject for dependency injection when appropriate.
	- Implement custom composables for reusable logic.
	
	Follow the official Nuxt.js and Vue.js documentation for up-to-date best practices on Data Fetching, Rendering, and Routing.
	
aws
css
docker
fastapi
golang
html
javascript
kubernetes
+14 more

First seen in:

zeuscs09/smartoffice

Used in 1 repository