-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.cursorrules
115 lines (103 loc) · 3.7 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* Cursor rules for maintaining code quality and consistency
*/
{
"rules": {
"file-header-docs": {
"description": "All source files must have a header comment explaining their purpose",
"pattern": "src/**/*.js",
"check": {
"type": "regex",
"value": "^/\\*\\*\\n \\* [^\\n]+\\n \\* [^\\n]+\\n \\* [^\\n]+\\n \\*/\\n",
"message": "File must start with a header comment block (3 lines) explaining its purpose"
}
}
}
}
# Project Principles
# Code Philosophy
- Keep code simple, smart, and follow best practices
- Don't over-engineer for the sake of engineering
- Use standard conventions and patterns
- Write human-readable code
- Keep it simple so the app just works
- Follow the principle: "Make it work, make it right, make it fast"
- Comments should explain "why" behind the code in more complex functions
- Overcommented code is better than undercommented code
# Commit Conventions
- Use Conventional Commits format:
- feat: new features
- fix: bug fixes
- docs: documentation changes
- style: formatting, missing semi colons, etc.
- refactor: code changes that neither fix bugs nor add features
- test: adding or modifying tests
- chore: updating build tasks, package manager configs, etc.
- Each commit should be atomic and focused
- Write clear, descriptive commit messages
# Project Structure
# Root Directory
- Keep root directory clean with only essential files
- Production configuration files in root:
- docker-compose.yml
- Dockerfile
- .env.example
- package.json
- README.md
# Source Code (/src)
- All application source code in /src directory
- app.js: Application setup and configuration
- server.js: Server entry point
- routes/: Route handlers
- middleware/: Custom middleware
- utils/: Helper functions and utilities
- models/: Data models (if applicable)
- services/: Business logic
# Development
- All development configurations in /dev directory
- Development specific files:
- /dev/docker-compose.dev.yml
- /dev/.env.dev.example
- /dev/README.md (development setup instructions)
# Static Assets and Uploads
- Static assets in /public directory
- Upload directories:
- /uploads (production)
- /local_uploads (local development)
# Documentation
- Main README.md in root focuses on production deployment
- Development documentation in /dev/README.md
- Code must be self-documenting with clear naming
- Complex logic must include comments explaining "why" not "what"
- JSDoc comments for public functions and APIs
# Docker Configuration
- Use environment-specific .dockerignore files:
- .dockerignore: Production defaults (most restrictive)
- dev/.dockerignore: Development-specific (allows test/dev files)
- Production .dockerignore should exclude:
- All test files and configurations
- Development-only dependencies
- Documentation and non-essential files
- Local development configurations
- Development .dockerignore should:
- Allow test files and configurations
- Allow development dependencies
- Still exclude node_modules and sensitive files
- Keep Docker-specific files excluded
- Docker Compose configurations:
- Production: docker-compose.yml in root
- Development: docker-compose.dev.yml in /dev
- Use BuildKit features when needed
- Document any special build arguments
- Multi-stage builds:
- Use appropriate base images
- Minimize final image size
- Separate development and production stages
- Use specific version tags for base images
# Code Style
- Follow ESLint and Prettier configurations
- Use meaningful variable and function names
- Keep functions small and focused
- Maximum line length: 100 characters
- Use modern JavaScript features appropriately
- Prefer clarity over cleverness