48 lines
2.2 KiB
Markdown
48 lines
2.2 KiB
Markdown
# Repository Guidelines
|
|
|
|
## Project Structure & Module Organization
|
|
|
|
- `mengyaprofile-frontend/`: React (Create React App) UI (`src/`, `public/`).
|
|
- `mengyaprofile-backend/`: Flask API (`app.py`) plus site content in `data/*.json` and assets in `data/logo/`, `data/background/`.
|
|
- Root `*.bat`: Windows helper scripts for starting/building locally.
|
|
|
|
## Build, Test, and Development Commands
|
|
|
|
```bash
|
|
# Backend (Flask API)
|
|
cd mengyaprofile-backend
|
|
python -m pip install -r requirements.txt
|
|
python app.py # http://localhost:5000
|
|
|
|
# Frontend (React)
|
|
cd ../mengyaprofile-frontend
|
|
npm install
|
|
npm start # http://localhost:3000
|
|
npm test # Jest/RTL in watch mode
|
|
npm run build # production build to ./build
|
|
```
|
|
|
|
- Windows shortcuts: `start-backend.bat`, `start-frontend.bat`, `build-frontend.bat`.
|
|
- Docker (optional): `docker compose -f mengyaprofile-backend/docker-compose.yml up -d --build` (adjust the volume path for your machine).
|
|
|
|
## Coding Style & Naming Conventions
|
|
|
|
- Python: PEP 8, 4-space indents; keep API routes under `/api/*` in `mengyaprofile-backend/app.py`.
|
|
- React: 2-space indents; components live in `mengyaprofile-frontend/src/components/` with `PascalCase` filenames (e.g., `TechStackSection.js`).
|
|
- Data files: edit `mengyaprofile-backend/data/*.json` (UTF-8). Prefer stable keys and keep lists ordered to produce readable diffs.
|
|
|
|
## Testing Guidelines
|
|
|
|
- Frontend tests live in `mengyaprofile-frontend/src/**/*.test.js` (example: `src/App.test.js`); run via `npm test`.
|
|
- Backend currently has no test suite; if adding one, use `pytest` and place tests under `mengyaprofile-backend/tests/`.
|
|
|
|
## Commit & Pull Request Guidelines
|
|
|
|
- Current Git history uses short subjects (e.g., “Initial commit”, “初始化提交”); keep messages concise and scoped (`frontend: ...`, `backend: ...`).
|
|
- PRs: describe behavior changes, link issues, include screenshots for UI changes, and call out any `data/*.json` schema updates.
|
|
|
|
## Security & Configuration Tips
|
|
|
|
- “Admin mode” is client-side (`/admin?token=...`) and not a security boundary—do not store secrets in this repo.
|
|
- Useful env vars: backend `RUN_MODE`, `DATA_DIR`, `BACKGROUND_DIR`, `PORT`; frontend `REACT_APP_API_URL` (use `.env.local`).
|