- Initialize Git repository with main branch - Create comprehensive .gitignore for Node.js, React, and environment files - Set up directory structure (frontend/, backend/, docs/) - Create detailed README.md with project overview and setup instructions - Add .env.example with all required environment variables - Configure Prettier for consistent code formatting All acceptance criteria met: ✅ Git repository initialized with appropriate .gitignore ✅ Directory structure matches Technical Assumptions ✅ README.md created with project overview and setup docs ✅ .env.example file with all required environment variables ✅ Prettier config files added for code formatting consistency 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
2.3 KiB
Markdown
41 lines
2.3 KiB
Markdown
# Coding Standards
|
|
|
|
## Critical Fullstack Rules
|
|
|
|
- **API Error Handling:** All API routes must use the centralized error handler middleware. Never send raw errors to clients.
|
|
|
|
- **Input Validation:** All POST/PUT endpoints must validate inputs using express-validator. Frontend should also validate before sending.
|
|
|
|
- **Database Access:** Always use Prisma ORM for database operations. Never write raw SQL queries (except for complex queries Prisma can't handle).
|
|
|
|
- **Environment Variables:** Access environment variables only through centralized config. Never use `process.env` or `import.meta.env` directly in components/controllers.
|
|
|
|
- **Date Handling:** Use date-fns for all date manipulation. Never use vanilla JavaScript Date methods for calculations.
|
|
|
|
- **Component Structure:** React components must be functional with hooks. No class components.
|
|
|
|
- **State Updates:** Never mutate state directly. Use setState/setters or Context dispatch actions.
|
|
|
|
- **API Calls:** Never make direct fetch calls in components. Always use the service layer (booksService, logsService).
|
|
|
|
- **Error Boundaries:** Critical routes must have React Error Boundaries to catch and display errors gracefully.
|
|
|
|
- **Prisma Schema Changes:** Never modify database directly. Always create Prisma migrations for schema changes.
|
|
|
|
## Naming Conventions
|
|
|
|
| Element | Frontend | Backend | Example |
|
|
|---------|----------|---------|---------|
|
|
| **Components** | PascalCase | - | `BookCard.jsx`, `LogProgressModal.jsx` |
|
|
| **Hooks** | camelCase with 'use' prefix | - | `useBooks.js`, `useProgress.js` |
|
|
| **Services** | camelCase with 'Service' suffix | camelCase with 'Service' suffix | `booksService.js`, `openLibraryService.js` |
|
|
| **Controllers** | - | camelCase with 'Controller' suffix | `booksController.js` |
|
|
| **API Routes** | - | kebab-case | `/api/books`, `/api/books/:id/logs` |
|
|
| **Database Tables** | - | PascalCase (Prisma convention) | `Book`, `ReadingLog` |
|
|
| **Files** | kebab-case | kebab-case | `book-card.jsx`, `pace-calculation-service.js` |
|
|
| **CSS Classes** | kebab-case (Tailwind) | - | `text-blue-500`, `book-card-container` |
|
|
| **Functions** | camelCase | camelCase | `calculateRequiredPace()`, `handleLogClick()` |
|
|
| **Constants** | SCREAMING_SNAKE_CASE | SCREAMING_SNAKE_CASE | `API_BASE_URL`, `MAX_QUERY_LENGTH` |
|
|
|
|
---
|