Spaces:
Runtime error
Runtime error
Contributing to EcoGuide AI
Thank you for your interest in contributing! This document explains how to get started.
Getting Started
- Fork the repository and clone your fork
- Install dependencies:
npm installin bothbackend/andfrontend/ - Copy
.env.exampleto.envin both directories and fill in values - Run migrations:
cd backend && npx prisma migrate deploy - Start dev servers:
npm run devin each directory
Development Workflow
- Branch from
mainwith a descriptive name:feat/my-featureorfix/my-bug - Keep commits focused and use conventional commit messages:
feat:new featurefix:bug fixsecurity:security improvementperf:performance improvementtest:test addition or updatedocs:documentation updatechore:tooling/config change
Code Standards
- No
varβ useconst/let - Strict equality β use
===everywhere - No console in production β use
src/utils/logger.jsin frontend - Sanitize all inputs β use
src/utils/sanitize.jsfor numeric/text fields - JSDoc β add JSDoc to all exported functions in
services/andutils/ - Run
npm run lintbefore opening a PR β zero warnings expected
Testing
All new features must include tests:
cd backend && npm test
cd frontend && npm test
- Backend: add tests in
backend/src/tests/unit/ - Frontend utilities: add tests in
frontend/src/tests/ - Aim for >90% coverage on utility functions
Pull Request Checklist
- Tests pass locally (
npm testin both directories) - No ESLint warnings (
npm run lint) - No hardcoded secrets or API keys
- JSDoc added to new functions
- README updated if adding new env vars or features
Reporting Issues
Please open a GitHub Issue with:
- Steps to reproduce
- Expected vs. actual behaviour
- Browser/Node.js version
Assumptions & Anonymous Sessions
EcoGuide AI operates without user accounts. This means:
- Session identity is an anonymous UUID generated on first visit and stored in
localStorage. Clearing browser storage is equivalent to "logging out". - Cross-device: There is no sync across devices. Each browser gets its own independent session UUID and history.
- No authentication: The backend accepts any UUID as a userId. The
POST /api/assessmentsendpoint auto-creates a placeholder user record if the UUID is unknown (e.g. after a DB wipe or first use), so data is never silently lost. - Synthetic emails: When the backend creates a placeholder user it generates
${uuid}@ecoguide.aias a unique DB key. This is never used for email communication β it exists only to satisfy the database unique constraint. - Privacy by design: No names, real emails, or personally identifiable information are collected at any point. All data can be cleared by the user at any time through browser storage settings.
If you extend the platform to support real accounts (e.g. OAuth), update the useUser hook, the /api/users route, and the Prisma User model β and remove the synthetic email fallback in assessmentService.js.
License
By contributing, you agree your contributions will be licensed under the MIT License.