The backend now serves the Vue admin UI as static files with SPA fallback, eliminating the need for a separate web server. Dockerfile builds both frontend and backend in a multi-stage pipeline. Added build:web and build:all scripts, updated CI to verify frontend builds, and fixed vitest config to exclude Playwright tests. Co-Authored-By: Paperclip <noreply@paperclip.ing>
2.2 KiB
2.2 KiB
Contributing to CookieBridge
Getting Started
- Fork and clone the repository.
- Install dependencies:
npm install - Start the dev server:
npm run dev - Run tests:
npm test
Development Setup
Prerequisites:
- Node.js 22+
- npm
Relay server:
npm install
npm run dev # Starts with file watching on :8080
npm test # Run test suite
npm run typecheck # Type checking only
Admin panel (frontend):
cd web
npm install
npm run dev # Starts Vite dev server on :5173 (proxies API to backend)
The frontend dev server proxies /api, /admin, /ws, and /health to http://localhost:8100. Start the backend first with npm run dev (or adjust the proxy target in web/vite.config.ts).
Full production build:
npm run build:all # Builds backend (tsc) + frontend (vite) → copies to public/
npm start # Serves everything on :8080
Extension:
cd extension
npm install
node esbuild.config.mjs --browser=chrome
Load the unpacked extension from extension/build/chrome/ in your browser.
Making Changes
- Create a branch from
main. - Make focused, small commits. Each commit should do one thing.
- Run
npm testandnpm run typecheckbefore pushing. - Open a pull request against
main.
Code Style
- TypeScript strict mode everywhere.
- No frameworks on the server — use Node.js built-ins where possible.
- Use libsodium for all cryptographic operations. No
crypto.subtleor OpenSSL. - Keep dependencies minimal.
Testing
Tests use Vitest. Run with npm test.
tests/crypto.test.ts— Encryption and signing primitives.tests/pairing.test.ts— Device pairing flow.tests/conflict.test.ts— LWW conflict resolution.tests/integration.test.ts— Full server integration tests.
Add tests for new features. Integration tests should start a real server instance.
Commit Messages
Use clear, imperative commit messages:
feat: add cookie expiry sync support
fix: handle WebSocket reconnect on network change
docs: update self-hosting guide
Reporting Issues
Open an issue with:
- What you expected to happen.
- What actually happened.
- Steps to reproduce.
- Browser and OS version (for extension issues).