3.8 KiB
3.8 KiB
Repository Guidelines
Project Structure & Module Organization
backend/contains the unified Node/Express server (backend/unified-server.js) and core backend modules inbackend/src/(services/,routes/,middleware/,graphql/).frontend/is the React app; primary code lives infrontend/src/, and production artifacts are generated infrontend/build/.backend/__tests__/holds backend Jest tests. Cross-stack UI/API checks live intests/(*.spec.jsfor Playwright, Selenium scripts undertests/selenium/).database/andbackend/migrations/contain schema and seed/migration data.docs/stores architecture and operational notes.
Build, Test, and Development Commands
- Install dependencies per package:
npm cicd backend && npm cicd frontend && npm cicd tests && npm ci
- Run backend locally:
cd backend && npm run dev(nodemon) orcd backend && npm start. - Run frontend locally:
cd frontend && npm run dev. - Build frontend:
cd frontend && npm run build. - Backend tests with coverage:
cd backend && npm test -- --coverage --passWithNoTests. - Playwright E2E (local):
cd tests && PLAYWRIGHT_BASE_URL=http://localhost:4032 npx playwright test.
Coding Style & Naming Conventions
- Use JavaScript/React with 2-space indentation and existing semicolon style.
- Prefer
async/await; keep route handlers thin and push business logic intobackend/src/services/. - Naming:
camelCasefor variables/functions,PascalCasefor React components, kebab/camel names aligned to existing files. - Test naming: Jest files as
*.test.js; Playwright files as*.spec.js. - Frontend linting follows
react-scriptsESLint defaults (react-appconfig).
Testing Guidelines
- Primary frameworks: Jest (+ Supertest) for backend and Playwright for E2E. Selenium is available for supplemental UI checks.
- Add or update backend tests for any API/service change; add Playwright coverage for user-facing flow changes.
- Include happy-path and failure-path assertions. For new modules, target at least ~80% coverage.
Commit & Pull Request Guidelines
- Follow Conventional Commit style seen in history (
feat:,fix:,chore:,docs:, optional scopes likechore(docs):). - Keep commits focused and include related migration/test updates.
- PRs should include: concise summary, linked issue (if applicable), test commands run + outcomes, and screenshots for UI changes.
- Ensure CI checks pass before merge (backend tests, frontend build, and security scan).
Security & Configuration Tips
- Never commit plaintext secrets. Runtime secrets belong in
/mnt/HC_Volume_103713257/tilbudsgivern-data;backend/.envmust be a symlink to the environment file there. Use encrypted env files where supported. - Integrationer må kun referere til miljøvariabler som
OSTICKET_API_KEY,SUPPORT_WORKLIST_API_KEY,ORDRESTYRING_API_TOKENogORDRESTYRING_API_KEY; værdierne må kun ligge i den eksterne data-mappes environment-fil og må ikke kopieres til kode, dokumentation ellersystem_settings. - Do not commit logs, test artifacts, or DB backups (
logs/,tests/test-results/,tests/playwright-report/,backups/).
Obsidian Documentation Vault
- Before planning or implementing behavior changes, search
obsidian-vault/00 Start/Dokumentindeks.mdfor relevant project decisions, guides, status reports, and prior implementations. - Treat files under
obsidian-vault/10 Dokumenter/as generated, read-only copies. Useobsidian-vault/00 Start/Kildemanifest.tsvto locate the original repository file and edit that source instead. - After adding or changing repository Markdown, run
./scripts/sync-obsidian-vault.shand include the synchronized vault copy in the same change. - Put new hand-written Obsidian notes outside
10 Dokumenter/, preferably inobsidian-vault/20 Arbejdsnoter/, and never include secrets or customer uploads.