lyubo-velikoff automation-tool .cursorrules file for TypeScript

# Cursor Rules for Automation Tool

## Project Structure
- Monorepo using pnpm workspaces and Turborepo
- Next.js frontend in `apps/web`
- Express + Apollo backend in `apps/server`
- Shared packages in `packages/` (future use)

## Code Style & Conventions

### TypeScript
- Strict mode enabled
- No `any` types unless absolutely necessary
- Interfaces over types for object definitions
- Explicit return types on functions
- Use type inference when obvious

### React Components
- Function components with TypeScript
- Props interfaces with descriptive names
- Custom hooks in `hooks/` directory
- Shared UI components in `components/ui/`
- Feature components in respective feature directories

### GraphQL
- TypeGraphQL decorators for schema definition
- Resolvers in `resolvers/` directory
- Type definitions in `schema/` directory
- Mutations and queries in `graphql/` directory
- Use fragments for shared fields

### File Naming
- PascalCase for components: `WorkflowCanvas.tsx`
- camelCase for utilities: `apolloClient.ts`
- kebab-case for configuration: `next-config.ts`
- Consistent extensions: `.tsx` for React, `.ts` for pure TypeScript

### Imports
- Absolute imports using `@/` alias
- Group imports by type (React, third-party, local)
- No relative imports going up more than two levels
- Export named constants and types from `index.ts`

### Testing
- Jest for unit tests
- React Testing Library for components
- Playwright for E2E tests
- Test files co-located with implementation
- Descriptive test names using describe/it pattern

## Safe Commands
The following commands are safe to run without user approval:
- Git commands (except destructive ones)
- pnpm commands for dependencies
- Prisma commands for migrations
- Build and test commands

## Directory Structure
```
automation-tool/
├── apps/
│   ├── web/                 # Next.js frontend
│   │   ├── src/
│   │   │   ├── app/        # Next.js app router pages
│   │   │   ├── components/ # React components
│   │   │   ├── graphql/    # Apollo Client setup
│   │   │   └── lib/        # Utilities
│   │   └── public/         # Static assets
│   └── server/             # Express + Apollo backend
│       ├── src/
│       │   ├── resolvers/  # TypeGraphQL resolvers
│       │   ├── schema/     # Type definitions
│       │   ├── services/   # Business logic
│       │   ├── temporal/   # Temporal.io integration
│       │   │   ├── activities/  # Workflow activities
│       │   │   ├── workflows/   # Workflow definitions
│       │   │   ├── client.ts    # Temporal client setup
│       │   │   └── worker.ts    # Temporal worker setup
│       │   └── types/      # TypeScript types
│       └── tests/          # Server tests
├── packages/               # Shared packages
├── .tasks/                # Task documentation
└── supabase/             # Supabase config
```

## Key Technologies & Versions
- Next.js: 15.1.5
- React: 19.0.0
- TypeScript: 5.x
- Node.js: 20.x
- Express: 4.21.2
- Apollo Server: 3.13.0
- TypeGraphQL: 2.0.0-rc.2
- React Flow: 11.11.4
- shadcn/ui: latest
- pnpm: 8.15.4
- Temporal.io: 1.11.6

## Environment Variables
Required variables:
```bash
# Supabase
SUPABASE_URL=
SUPABASE_ANON_KEY=
SUPABASE_SERVICE_KEY=

# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:4000
CORS_ORIGIN=http://localhost:3000

# Temporal Configuration
TEMPORAL_ADDRESS=localhost:7233
```

## Common Tasks

### Frontend Development
1. Components should be in appropriate directories:
   - UI components in `components/ui/`
   - Workflow components in `components/workflow/`
   - Pages in `app/` directory

2. State management:
   - Apollo Client for GraphQL
   - React Context for UI state
   - Local storage for preferences

### Backend Development
1. GraphQL schema:
   - Use TypeGraphQL decorators
   - Define types in `schema/` directory
   - Implement resolvers in `resolvers/`

2. API endpoints:
   - GraphQL for data operations
   - REST for specific functionality
   - Health checks and monitoring

### Database Operations
1. Supabase:
   - Use service role for admin operations
   - RLS policies for security
   - Migrations in version control

## Error Handling
1. Frontend:
   - GraphQL error handling in Apollo Client
   - Toast notifications for user feedback
   - Error boundaries for component errors

2. Backend:
   - TypeGraphQL validation
   - Custom error types
   - Logging and monitoring

## Testing Strategy
1. Unit Tests:
   - Jest for business logic
   - React Testing Library for components

2. Integration Tests:
   - GraphQL operations
   - API endpoints
   - Database operations

3. E2E Tests:
   - Playwright for critical paths
   - User workflows
   - Authentication flows

---
css
express.js
golang
graphql
javascript
jest
less
next.js
+11 more

First Time Repository

TypeScript

Languages:

CSS: 1.8KB
JavaScript: 2.0KB
PLpgSQL: 1.3KB
Shell: 1.4KB
TypeScript: 241.1KB
Created: 1/18/2025
Updated: 1/23/2025

All Repositories (1)