28 lines
521 B
Markdown
28 lines
521 B
Markdown
# Code Patterns
|
|
|
|
## Project Conventions
|
|
|
|
|
|
### TypeScript Guidelines
|
|
|
|
- Use strict mode
|
|
- No `any` types
|
|
- Use interfaces for object shapes
|
|
- Use type guards for narrowing
|
|
- Export types from `types/index.ts`
|
|
|
|
### API Patterns
|
|
|
|
- Use middleware for cross-cutting concerns
|
|
- Validate all input
|
|
- Return consistent error responses
|
|
- Use proper HTTP status codes
|
|
- Log all requests
|
|
|
|
## Error Handling
|
|
|
|
- Always catch and handle errors
|
|
- Log errors with context
|
|
- Return user-friendly messages
|
|
- Never expose internal details
|