2.2 KiB
2.2 KiB
Repository Guidelines
Project Structure & Module Organization
mengyaprofile-frontend/: React (Create React App) UI (src/,public/).mengyaprofile-backend/: Flask API (app.py) plus site content indata/*.jsonand assets indata/logo/,data/background/.- Root
*.bat: Windows helper scripts for starting/building locally.
Build, Test, and Development Commands
# 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/*inmengyaprofile-backend/app.py. - React: 2-space indents; components live in
mengyaprofile-frontend/src/components/withPascalCasefilenames (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 vianpm test. - Backend currently has no test suite; if adding one, use
pytestand place tests undermengyaprofile-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/*.jsonschema 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; frontendREACT_APP_API_URL(use.env.local).