@mallardbay/cursor-rules 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,89 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Mallard Bay Backend Development Rules
7
+
8
+ ## Project Structure
9
+
10
+ - `src/` - Main source code directory
11
+ - `gql/` - GraphQL types, models, and resolvers
12
+ - `helpers/` - Utility functions (e.g., algolia.helpers.ts, entity-algolia.helpers.ts)
13
+ - `config/` - Configuration files and environment variables
14
+ - `database/` - Database related code (Firestore, Algolia)
15
+ - `firebase/` - Firebase functions and triggers
16
+ - `services/` - Business logic services
17
+ - `middleware/` - Express middleware
18
+
19
+ ## Environment Setup
20
+
21
+ - Use dotenv-vault for environment management
22
+ - Never commit .env files to git
23
+ - Use different .env files for different environments (dev, test, prod)
24
+
25
+ ## Firebase Development
26
+
27
+ - Use Firestore emulator for local development
28
+ - Start emulator: `gcloud emulators firestore start --host-port=127.0.0.1:8080`
29
+ - Use Firebase Functions for serverless operations
30
+ - Keep Firebase functions in `src/firebase/functions/`
31
+ - Use proper error handling in Firebase functions, use `captureException` helper for it
32
+ - Follow Firebase security rules best practices
33
+
34
+ ## Algolia Integration
35
+
36
+ - Configure Algolia indices using `bin/db/setup-algolia.ts`
37
+ - Follow Algolia index settings in `src/database/algolia/*-index-settings.ts`
38
+ - Use proper searchable attributes and faceting
39
+ - Keep Algolia indexing logic in `src/helpers/algolia.helpers.ts`
40
+ - Follow Algolia query character limits (ALGOLIA_MAX_QUERY_CHARACTER = 512)
41
+ - Use proper error handling for Algolia operations
42
+
43
+ ## Testing
44
+
45
+ - Use Jest as the testing framework
46
+ - Place tests in `__tests__` directories
47
+ - Mock Algolia, and other network requests in tests
48
+ - Use `tests/setupTests.ts` for global test setup
49
+ - Use `tests/teardownTests.ts` for cleanup
50
+ - Use Jest coverage reporting in the CI but not locally
51
+
52
+ ## Code Style
53
+
54
+ - Use TypeScript for all new code
55
+ - Follow ESLint rules from `@mallardbay/eslint-config-mallardbay`
56
+ - Follow existing codebase patterns
57
+ - Rely heavily on constants
58
+ - Copy should be in copy constants
59
+
60
+ ## GraphQL
61
+
62
+ - Define gql types, resolvers and mutations in `[ENTITY].schema.ts` files
63
+
64
+ ## Error Handling
65
+
66
+ - Use proper error types
67
+ - Log errors appropriately
68
+ - Handle edge cases
69
+ - Provide meaningful error messages
70
+ - Use try-catch blocks where appropriate
71
+ - Use Sentry for error tracking, use `captureException` helper for it
72
+
73
+ ## Performance
74
+
75
+ - Optimize Firestore queries
76
+ - Use proper indexing (see `firebase/firestore.indexes.json`)
77
+ - Cache when appropriate
78
+ - Monitor performance
79
+ - Setup new queries with pagination
80
+ - Follow Algolia best practices for search
81
+
82
+ ## Security
83
+
84
+ - Validate all input
85
+ - Sanitize user data
86
+ - Use proper authentication
87
+ - Follow security best practices
88
+ - Keep dependencies secure
89
+ - Use environment variables for sensitive data
package/README.md CHANGED
@@ -4,10 +4,11 @@ A tool for managing Cursor IDE rules across different environment types with sha
4
4
 
5
5
  ## Overview
6
6
 
7
- This project provides a structured way to manage Cursor IDE rules for different development environments while maintaining a shared base configuration. It supports two main environment types:
7
+ This project provides a structured way to manage Cursor IDE rules for different development environments while maintaining a shared base configuration. It supports three main environment types:
8
8
 
9
9
  - `frontend`: Basic frontend development rules
10
10
  - `frontend-lib`: Extended rules for frontend library development, inheriting from frontend rules
11
+ - `backend`: Backend development rules
11
12
 
12
13
  ## Installation
13
14
 
@@ -27,6 +28,7 @@ Where `<env-type>` can be either:
27
28
 
28
29
  - `frontend`
29
30
  - `frontend-lib`
31
+ - `backend`
30
32
 
31
33
  ### Example
32
34
 
@@ -36,6 +38,9 @@ npx @mallardbay/cursor-rules frontend
36
38
 
37
39
  # For frontend library development
38
40
  npx @mallardbay/cursor-rules frontend-lib
41
+
42
+ # For backend development
43
+ npx @mallardbay/cursor-rules backend
39
44
  ```
40
45
 
41
46
  ## Project Structure
@@ -48,8 +53,10 @@ The rules are organized in the following directory structure:
48
53
  │ └── rules/ # Shared base rules
49
54
  ├── frontend/
50
55
  │ └── rules/ # Frontend-specific rules
51
- └── frontend-lib/
52
- └── rules/ # Frontend library-specific rules
56
+ ├── frontend-lib/
57
+ └── rules/ # Frontend library-specific rules
58
+ └── backend/
59
+ └── rules/ # Backend-specific rules
53
60
  ```
54
61
 
55
62
  ## Rule Inheritance
@@ -72,6 +79,7 @@ The rules follow an inheritance pattern:
72
79
  - `.cursor/shared/rules/`: Shared base rules
73
80
  - `.cursor/frontend/rules/`: Frontend-specific rules
74
81
  - `.cursor/frontend-lib/rules/`: Frontend library-specific rules
82
+ - `.cursor/backend/rules/`: Backend-specific rules
75
83
 
76
84
  ## License
77
85
 
@@ -17,6 +17,7 @@ SRC_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd)"
17
17
  SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
18
18
  FRONTEND_DIR="$SRC_DIR/.cursor/frontend/rules"
19
19
  FRONTEND_LIB_DIR="$SRC_DIR/.cursor/frontend-lib/rules"
20
+ BACKEND_DIR="$SRC_DIR/.cursor/backend/rules"
20
21
 
21
22
  mkdir -p .cursor/rules
22
23
 
@@ -36,6 +37,9 @@ case "$ENV_TYPE" in
36
37
  frontend)
37
38
  copy_rules "$FRONTEND_DIR"
38
39
  ;;
40
+ backend)
41
+ copy_rules "$BACKEND_DIR"
42
+ ;;
39
43
  frontend-lib)
40
44
  copy_rules "$FRONTEND_DIR"
41
45
  copy_rules "$FRONTEND_LIB_DIR"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mallardbay/cursor-rules",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Mallard Bay shared cursor rules",
5
5
  "main": "bin/setup-cursor.sh",
6
6
  "repository": "git@github.com:mallardbay/cursor-rules.git",