|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +- `npm run dev` - Start development server |
| 8 | +- `npm run build` - Build for production |
| 9 | +- `npm run lint` - Run ESLint and Stylelint |
| 10 | +- `npm run lint:fix` - Auto-fix linting issues |
| 11 | +- `npm run typecheck` - Run TypeScript type checking |
| 12 | +- `npm run storybook` - Start Storybook development server |
| 13 | + |
| 14 | +## Architecture Overview |
| 15 | + |
| 16 | +This is a React + TypeScript application built with Vite for a collaborative letter-writing platform called "Ittory". |
| 17 | + |
| 18 | +### State Management |
| 19 | +- **Redux Toolkit** with persistence for letter writing data and order management |
| 20 | +- **React Query (TanStack Query)** for server state management and API calls |
| 21 | +- **Redux Persist** for maintaining write/order data across sessions |
| 22 | + |
| 23 | +### Key Application Flow |
| 24 | +The app follows a collaborative letter-writing workflow: |
| 25 | +1. **Create** - User creates a letter and invites participants |
| 26 | +2. **Invite/Join** - Other users join the letter creation process |
| 27 | +3. **Write** - Participants write in a predetermined order |
| 28 | +4. **Share/Receive** - Final letter is shared and received |
| 29 | + |
| 30 | +### WebSocket Integration |
| 31 | +- Custom type-safe WebSocket wrapper (`SharedTypeSafeWebSocket`) built on STOMP |
| 32 | +- Real-time collaboration features for letter writing |
| 33 | +- Automatic reconnection and subscription management |
| 34 | +- Queue-based message handling for connection reliability |
| 35 | + |
| 36 | +### API Layer Structure |
| 37 | +- **Services** - Business logic layer (AuthService, LetterService, etc.) |
| 38 | +- **Models** - TypeScript interfaces for API data |
| 39 | +- **Queries** - React Query hooks organized by domain |
| 40 | +- **Config** - API configuration, interceptors, and token management |
| 41 | + |
| 42 | +### Mobile-First Design |
| 43 | +- Built as a web app designed for mobile webview integration |
| 44 | +- iOS SafeArea handling |
| 45 | +- React Native WebView console logging integration |
| 46 | +- Responsive design with viewport height calculations |
| 47 | + |
| 48 | +### Development Tools |
| 49 | +- **MSW (Mock Service Worker)** for API mocking during development |
| 50 | +- **Storybook** for component development and documentation |
| 51 | +- **Sentry** for error tracking |
| 52 | +- **Hotjar** for user analytics (production only) |
| 53 | +- **Lefthook** for git hooks with commitlint |
| 54 | + |
| 55 | +### Environment Configuration |
| 56 | +Required environment variables: |
| 57 | +- `VITE_DEPLOY_ENV` - Deployment environment |
| 58 | +- `VITE_KAKAO_KEY` - Kakao OAuth key |
| 59 | +- `VITE_SERVER_URL` - Backend API URL |
| 60 | +- `VITE_SENTRY_DSN` - Sentry DSN (optional) |
| 61 | +- `VITE_HOTJAR_SITE_ID` - Hotjar site ID (optional) |
| 62 | + |
| 63 | +### Key Directories |
| 64 | +- `src/pages/` - Top-level route components |
| 65 | +- `src/components/` - Reusable UI components organized by page |
| 66 | +- `src/api/` - API layer (services, models, queries, websockets) |
| 67 | +- `src/utils/SessionLogger/` - Custom logging system for debugging |
| 68 | +- `src/layout/` - App layout components with mobile-specific features |
0 commit comments