Add comprehensive messenger features and improvements
- Backend improvements: flexible user authentication, nullable fields - Frontend enhancements: new screens (NewMessage, UserInfo), improved UI/UX - Chat functionality: real-time messaging with polling, message actions - Visual upgrades: gradient backgrounds, better themes, modern design - Added project documentation (CLAUDE.md) and development guidelines 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
92
CLAUDE.md
Normal file
92
CLAUDE.md
Normal file
@ -0,0 +1,92 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
Prism is a real-time messenger built with Expo (React Native) frontend and NestJS backend using GraphQL and PostgreSQL. The project is structured as a monorepo with separate frontend and backend directories.
|
||||
|
||||
## Development Commands
|
||||
|
||||
### Backend (NestJS)
|
||||
```bash
|
||||
cd backend
|
||||
npm run start:dev # Development server with hot reload
|
||||
npm run build # Build for production
|
||||
npm run test # Run unit tests
|
||||
npm run test:e2e # Run end-to-end tests
|
||||
npm run lint # ESLint with auto-fix
|
||||
npm run format # Prettier formatting
|
||||
```
|
||||
|
||||
### Frontend (Expo/React Native)
|
||||
```bash
|
||||
cd frontend
|
||||
npx expo start # Start Expo development server
|
||||
npx expo start --ios # Start with iOS simulator
|
||||
npx expo start --android # Start with Android emulator
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
### Backend Architecture
|
||||
- **Framework**: NestJS with TypeScript
|
||||
- **API**: GraphQL using code-first approach with auto-generated schema
|
||||
- **Database**: PostgreSQL with TypeORM (synchronize enabled in development)
|
||||
- **Authentication**: JWT with Passport strategy
|
||||
- **Real-time**: GraphQL Subscriptions for live updates
|
||||
- **Module Structure**:
|
||||
- `auth/` - JWT authentication and guards
|
||||
- `users/` - User management and profiles
|
||||
- `conversations/` - Chat/conversation management
|
||||
- `messages/` - Message handling and real-time updates
|
||||
|
||||
### Frontend Architecture
|
||||
- **Framework**: Expo with React Native and TypeScript
|
||||
- **State Management**: Apollo Client for GraphQL state management
|
||||
- **UI Framework**: React Native Paper with custom theming
|
||||
- **Navigation**: React Navigation with stack and tab navigators
|
||||
- **Storage**: AsyncStorage for token persistence
|
||||
- **Key Contexts**: AuthContext for authentication state
|
||||
|
||||
### Data Flow
|
||||
- Frontend communicates with backend exclusively through GraphQL
|
||||
- Real-time updates via GraphQL subscriptions
|
||||
- JWT tokens stored in AsyncStorage and included in GraphQL requests via authLink
|
||||
- Apollo Client handles caching with cache-and-network fetch policy
|
||||
|
||||
## Database Configuration
|
||||
|
||||
The project supports both remote and local PostgreSQL:
|
||||
- Remote database is the default (configured in backend .env)
|
||||
- Local database can be enabled by uncommenting postgres service in docker-compose.yml
|
||||
- TypeORM synchronize is enabled in development (automatic schema updates)
|
||||
|
||||
## Environment Configuration
|
||||
|
||||
### Backend Environment Variables
|
||||
Required in `backend/.env`:
|
||||
```
|
||||
DATABASE_HOST=
|
||||
DATABASE_PORT=5432
|
||||
DATABASE_USERNAME=
|
||||
DATABASE_PASSWORD=
|
||||
DATABASE_NAME=prism_messenger
|
||||
JWT_SECRET=
|
||||
JWT_EXPIRATION=7d
|
||||
```
|
||||
|
||||
### Frontend API Configuration
|
||||
Update `frontend/src/config/api.ts` based on development environment:
|
||||
- iOS simulator: http://localhost:3000/graphql
|
||||
- Android emulator: http://10.0.2.2:3000/graphql
|
||||
- Physical device: http://YOUR_IP:3000/graphql
|
||||
|
||||
## Key Implementation Details
|
||||
|
||||
- GraphQL schema is auto-generated at `backend/src/schema.gql`
|
||||
- All GraphQL queries, mutations, and subscriptions are centralized in `frontend/src/graphql/`
|
||||
- Authentication uses JWT with bearer token authorization
|
||||
- Real-time features implemented via GraphQL subscriptions with graphql-ws
|
||||
- Frontend theme system supports both light and dark modes
|
||||
- Message features include send, edit, delete with real-time updates
|
Reference in New Issue
Block a user