-
Notifications
You must be signed in to change notification settings - Fork 208
Expand file tree
/
Copy path.cursorrules
More file actions
140 lines (114 loc) · 4.77 KB
/
.cursorrules
File metadata and controls
140 lines (114 loc) · 4.77 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Opensox AI - Cursor Rules
## Code Style
### Comments
- always use lowercase when writing comments
- avoid unnecessary comments; code should be self-documenting when possible
- use comments to explain "why", not "what"
## UI Component Guidelines
### Design System - CRITICAL
**Always follow the design system defined in `apps/web/src/lib/design-tokens.ts` and `apps/web/tailwind.config.ts`**
#### Color Usage
- **NEVER** use hardcoded hex values (e.g., `#5519f7`) directly in components
- **ALWAYS** reference colors from the design token system using Tailwind classes
- Use semantic color names that describe purpose, not appearance
#### Available Color Palettes
**Brand Colors:**
- `bg-brand-purple` - primary brand color for ctas, highlights
- `bg-brand-purple-light` - hover states
- `bg-brand-purple-dark` - depth and contrast
**Background/Surface Colors (Landing Page):**
- `bg-surface-primary` - main app background (#101010)
- `bg-surface-secondary` - sidebar, secondary surfaces (#141414)
- `bg-surface-tertiary` - content areas, cards (#1A1A1A)
- `bg-surface-elevated` - elevated cards, modals (#1E1E1E)
- `bg-surface-hover` - hover states for dark surfaces
- `bg-surface-card` - card backgrounds
**Background/Surface Colors (Dashboard):**
- `bg-dash-base` - page background (darkest)
- `bg-dash-surface` - panels, cards, navbars
- `bg-dash-raised` - buttons, inputs, interactive surfaces
- `bg-dash-hover` - hover states for raised items
- `bg-dash-border` - thin dividers, borders
**Border Colors:**
- `border` or `border-border` - primary border (#252525)
- `border-light` - lighter borders for nested elements
- `border-dark` - darker borders
- `border-focus` - focus states (brand purple)
**Text Colors:**
- `text-text-primary` - primary white text (#ffffff)
- `text-text-secondary` - secondary text (#e1e1e1)
- `text-text-tertiary` - tertiary/muted text (#d1d1d1)
- `text-text-muted` - very muted text (#a1a1a1)
- `text-text-light` - light gray for copyright/footer
**Link Colors:**
- `text-link` - default link color (blue-400)
- `text-link-hover` - hover state (blue-300)
**Status Colors:**
- Success: `bg-success-bg`, `text-success-text`, `border-success-border`
- Error: `bg-error-bg`, `text-error-text`, `border-error-border`
- Warning: `bg-warning-bg`, `text-warning-text`, `border-warning-border`
- Info: `bg-info-bg`, `text-info-text`, `border-info-border`
#### Typography
- Use `font-sans` for standard UI text (Geist Sans)
- Use `font-mono` for code, technical content, or monospace needs (DM Mono)
#### Spacing
- Follow Tailwind's spacing scale (0.25rem increments)
- For section padding:
- Mobile: `p-4` (1rem)
- Desktop: `p-[60px]`
#### Border Radius
- Small elements: `rounded-lg` (0.5rem)
- Medium elements: `rounded-xl` (1rem)
- Large elements: `rounded-2xl` (1.5rem)
- Buttons: `rounded-[16px]`
#### Animations
- Fast transitions: `duration-100` (0.1s)
- Normal transitions: `duration-300` (0.3s)
- Slow transitions: `duration-600` (0.6s)
- Available custom animations:
- `animate-accordion-down`, `animate-accordion-up`
- `animate-scrollRight`, `animate-scrollLeft`
- `animate-customspin`, `animate-spin-slow`, `animate-spin-slow-reverse`
- `animate-marquee`, `animate-marquee-vertical`
- `animate-shine`
### Component Structure
- prefer functional components with typescript
- use proper typescript types, avoid `any`
- extract reusable logic into custom hooks
- keep components focused and single-responsibility
### Props & State
- use descriptive prop names
- define prop types using typescript interfaces or types
- prefer controlled components over uncontrolled
- use zustand for global state (located in `src/store/`)
### Imports
- organize imports: react → third-party → local components → utils → types
- use absolute imports from `@/` prefix when available
- remove unused imports
## File Organization
- place shared components in `apps/web/src/components/`
- place page-specific components near their page
- co-locate tests with the code they test
- keep utility functions in `apps/web/src/lib/` or `apps/web/src/utils/`
## Naming Conventions
- components: PascalCase (e.g., `UserProfile.tsx`)
- files/folders: kebab-case or camelCase for utilities
- constants: UPPER_SNAKE_CASE
- functions/variables: camelCase
- types/interfaces: PascalCase with descriptive names
## Accessibility
- include proper aria labels
- ensure keyboard navigation works
- maintain proper heading hierarchy
- provide alt text for images
## Performance
- use dynamic imports for code splitting when appropriate
- optimize images (use next/image)
- memoize expensive computations
- avoid unnecessary re-renders
## Monorepo Structure
- this is a turborepo monorepo
- shared packages live in `packages/`
- apps live in `apps/` (web, api, backend, docs)
- respect package boundaries
- use workspace dependencies properly