Welcome. This guide explains how to contribute safely and consistently to FarmSmart.
- Getting Started
- Development Workflow
- Branch Strategy
- Code Standards
- Commit Guidelines
- Pull Request Process
- Testing Requirements
- Node.js + npm
- MongoDB (local service or Docker)
- Git
- Clone the repository
git clone https://github.com/SaranHiruthikM/FarmSmart.git
cd FarmSmart- Install backend dependencies
Set-Location backend
npm install
Copy-Item .env.example .env- Install frontend dependencies
Set-Location ..\frontend
npm install
Copy-Item .env.example .env- Start development servers
# backend terminal
Set-Location backend
npm run dev
# frontend terminal
Set-Location frontend
npm run devCODEOWNERS currently lists:
@SaranHiruthikM@Vimal-Sabari
# Backend
Set-Location backend
npm run dev# Frontend
Set-Location frontend
npm run devSet-Location backend
docker compose up -dSet-Location backend
npx ts-node src/utils/seedQualityRules.ts
npx ts-node src/utils/seedMarketPrices.tsfeat/<topic>fix/<topic>small/<topic>- occasional direct branch names (for example
schemeIntegration)
Use consistent prefixes for all new work:
feat/<area>-<summary>fix/<area>-<summary>chore/<area>-<summary>docs/<area>-<summary>test/<area>-<summary>
feat/sales-revenue-dashboardfix/dispute-admin-status-updatefix/backend-integrationdocs/api-contract-sync
- Keep controllers focused on request/response logic.
- Keep domain persistence in model/service utilities.
- Use explicit status codes and consistent error messages.
- Preserve role checks using middleware (
authenticate,farmerOnly,adminOnly).
- Route wiring in
frontend/src/App.jsx. - API calls through
frontend/src/services/only. - Keep view components focused on UI concerns.
Set-Location frontend
npm run lintBackend has no dedicated lint script in backend/package.json currently.
Use Conventional Commits:
type(scope): short summary
featfixdocsrefactortestchore
feat(orders): add instant buy flow for buyersfix(disputes): enforce admin role on status updatesdocs(api): align auth OTP flow with backend routes
- Sync with
main. - Re-run relevant checks:
# backend checks
Set-Location backend
npm run build
npm test
# frontend checks
Set-Location ..\frontend
npm run lint
npm run build- Verify env or secret files are not included.
<type>(<scope>): <summary>
## Description
## Type of Change
## Related Issues
## Testing
## Screenshots (if applicable)
## Checklist
- [ ] Backend build passes
- [ ] Backend tests updated/passing where applicable
- [ ] Frontend lint/build passes
- [ ] No secrets or env files committed- At least one code owner/reviewer should approve.
- Resolve all review comments before merge.
- Prefer squash merge for clean history.
Set-Location backend
npm test
npm run test:watch
npm run test:coverageSet-Location frontend
npm run lint
npm run buildNo frontend unit test script is currently defined in frontend/package.json.
- Never commit
.envfiles. - Rotate secrets if exposure is suspected.
- Keep
JWT_SECRETstrong and private. - Review SECURITY_CHECKLIST.md before public releases.