100 lines
3.2 KiB
Markdown
100 lines
3.2 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
This is a full-stack DZTPS (Users database system) application with a React frontend and Node.js/Express backend. The application appears to be a management system with CRUD operations for languages and other entities, using Firebase Authentication and MySQL database.
|
|
|
|
## Project Structure
|
|
|
|
- **client/**: React frontend application using Vite
|
|
- **server/**: Node.js/Express backend API server
|
|
- **server/server/**: Main server code
|
|
- **server/server/config/**: Firebase service account configuration
|
|
- **server/.env**: Database and environment configuration
|
|
|
|
## Development Commands
|
|
|
|
### Client (Frontend)
|
|
```bash
|
|
cd client
|
|
npm run dev # Start development server
|
|
npm run build # Build for production
|
|
npm run lint # Run ESLint
|
|
npm run preview # Preview production build
|
|
```
|
|
|
|
### Server (Backend)
|
|
```bash
|
|
cd server
|
|
npm start # Start server with nodemon (auto-reload)
|
|
```
|
|
|
|
## Architecture Details
|
|
|
|
### Frontend
|
|
- **Framework**: React 19 with Vite
|
|
- **Styling**: CSS modules
|
|
- **Build Tool**: Vite with HMR support
|
|
- **Linting**: ESLint with React plugins
|
|
- **Main Components**: Located in `client/src/` with App.jsx as entry point
|
|
- **Development Server**: Runs on Vite's default port
|
|
- **API Endpoint**: Configured to connect to `http://localhost:3000`
|
|
|
|
### Backend
|
|
- **Framework**: Express.js server
|
|
- **Authentication**: Firebase Admin SDK
|
|
- **Database**: MySQL with connection pooling
|
|
- **Environment**: Configured via .env file
|
|
- **Port**: 3000 (configurable via PORT env var)
|
|
- **CORS**: Enabled for cross-origin requests
|
|
- **Main Server**: `server/server/index.js`
|
|
|
|
### Database Configuration
|
|
The MySQL database connection uses these environment variables:
|
|
- MYSQL_HOST (default: localhost)
|
|
- MYSQL_USER (default: root)
|
|
- MYSQL_PASSWORD (default: root)
|
|
- MYSQL_DATABASE (default: dztps)
|
|
- MYSQL_PORT (default: 3306)
|
|
|
|
### Firebase Setup
|
|
The server requires a `serviceAccountKey.json` file in `server/server/config/` for Firebase Admin SDK initialization.
|
|
|
|
## Development Workflow
|
|
|
|
1. **Starting Development**:
|
|
- Start MySQL database service
|
|
- Start backend: `cd server && npm start`
|
|
- Start frontend: `cd client && npm run dev`
|
|
|
|
2. **Making Changes**:
|
|
- Frontend changes auto-reload via Vite HMR
|
|
- Backend changes auto-reload via nodemon
|
|
|
|
3. **Code Quality**:
|
|
- Run `npm run lint` in client directory for ESLint checks
|
|
- The project uses modern ES6+ JavaScript/JSX
|
|
|
|
## Key Dependencies
|
|
|
|
### Client
|
|
- React 19 with modern hooks
|
|
- Vite for build tooling and development server
|
|
- ESLint with React-specific rules
|
|
|
|
### Server
|
|
- Express.js for REST API
|
|
- Firebase Admin SDK for authentication
|
|
- MySQL driver for database operations
|
|
- CORS middleware for cross-origin support
|
|
- dotenv for environment configuration
|
|
- nodemon for development auto-reload
|
|
|
|
## Important Notes
|
|
|
|
- The server expects Firebase service account credentials to be properly configured
|
|
- Database connection parameters are environment-dependent
|
|
- The frontend is configured to make API calls to localhost:3000
|
|
- Both client and server have separate package.json files and dependency management |