{"id":30023137,"url":"https://github.com/frckbrice/farming-product-rest-api","last_synced_at":"2026-05-01T17:36:18.955Z","repository":{"id":306245261,"uuid":"1024810592","full_name":"frckbrice/farming-product-REST-api","owner":"frckbrice","description":"REST API backend for a farm marketplace that connects farmers (sellers) with customers (buyers). Built with TypeScript, Express, and PostgreSQL. Intended for consumption by web or mobile clients.","archived":false,"fork":false,"pushed_at":"2026-02-09T04:09:09.000Z","size":3227,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-09T10:23:40.826Z","etag":null,"topics":["api","authentication","backend","dockerfile","expo-push-notifications","expressjs","jwt","nodejs","oauth2-server","otp","postgresql","rest-api","sequelize","supertest","typescript","vitest","zod"],"latest_commit_sha":null,"homepage":"https://farming-product-rest-api.onrender.com","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frckbrice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-23T09:29:05.000Z","updated_at":"2026-02-09T04:16:22.000Z","dependencies_parsed_at":"2025-07-24T15:52:18.147Z","dependency_job_id":"bf17901e-0b4c-496f-ae22-9ec9d529ebbe","html_url":"https://github.com/frckbrice/farming-product-REST-api","commit_stats":null,"previous_names":["frckbrice/farming-product-rest-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/frckbrice/farming-product-REST-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frckbrice%2Ffarming-product-REST-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frckbrice%2Ffarming-product-REST-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frckbrice%2Ffarming-product-REST-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frckbrice%2Ffarming-product-REST-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frckbrice","download_url":"https://codeload.github.com/frckbrice/farming-product-REST-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frckbrice%2Ffarming-product-REST-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32507091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","authentication","backend","dockerfile","expo-push-notifications","expressjs","jwt","nodejs","oauth2-server","otp","postgresql","rest-api","sequelize","supertest","typescript","vitest","zod"],"created_at":"2025-08-06T04:41:05.797Z","updated_at":"2026-05-01T17:36:18.934Z","avatar_url":"https://github.com/frckbrice.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Farm Marketplace API\n\n\n\n[![Node.js](https://img.shields.io/badge/Node.js-20-green.svg)](https://nodejs.org/)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5-blue.svg)](https://www.typescriptlang.org/)\n[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-15-blue.svg)](https://www.postgresql.org/)\n[![Docker](https://img.shields.io/badge/Docker-Ready-blue.svg)](https://www.docker.com/)\n[![CI/CD](https://img.shields.io/badge/CI%2FCD-GitHub%20Actions-green.svg)](https://github.com/features/actions)\n[![Test Coverage](https://img.shields.io/badge/Coverage-80%25+-green.svg)](https://vitest.dev/)\n\n\n![Farm Marketplace API](public/assets/images/farm_marketplace_api.png)\n\nREST API backend for a farm marketplace that connects farmers (sellers) with customers (buyers). Built with TypeScript, Express, and PostgreSQL. Intended for consumption by web or mobile clients.\n\n---\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Tech Stack](#tech-stack)\n- [Features](#features)\n- [Quick Start](#quick-start)\n- [API](#api)\n- [Testing](#testing)\n- [Deployment](#deployment)\n- [Project Structure](#project-structure)\n\n---\n\n## Overview\n\nThe Farm Marketplace API provides:\n\n- **Authentication**: JWT with refresh tokens, role-based access (farmer, buyer, admin). *(OTP verification disabled — keeping auth simple.)*\n- **Product catalog**: CRUD for farmers; search and filtering for customers.\n- **Orders and payments**: Order lifecycle, payment collection via Adwa gateway.\n- **Reviews**: Buyer reviews and ratings for sellers.\n- **Notifications**: Push notifications (Expo) for order updates.\n- **Security**: Rate limiting, Helmet headers, input validation (Zod), bcrypt password hashing.\n\nThe API is documented with OpenAPI 3.0 (Swagger) and runs behind a single Express server with a clear separation of routes, controllers, middleware, and models.\n\n---\n\n## Tech Stack\n\n| Layer | Technologies |\n|-------|--------------|\n| Runtime | Node.js 20 |\n| Language | TypeScript 5 |\n| Framework | Express 4 |\n| Database | PostgreSQL 15, Sequelize (with TypeScript) |\n| Auth | JWT, bcrypt |\n| Validation | Zod |\n| File storage | Multer, Cloudinary |\n| Notifications | Expo Push |\n| Payments | Adwa |\n| Testing | Vitest, Supertest |\n| DevOps | Docker, GitHub Actions |\n\n---\n\n## Features\n\n- **Authentication \u0026 security**: JWT + refresh tokens, RBAC, Zod validation, rate limiting, Helmet.\n- **Products**: Full CRUD, search/filter, image upload (Cloudinary).\n- **Orders**: Create, list, update; dispatch and status tracking.\n- **Payments**: Payment collection and transaction records.\n- **Reviews**: Create and list buyer reviews for farmers.\n- **User profile**: Profile and avatar management.\n- **Health**: `/api/v2/health` with database connectivity check.\n- **Documentation**: Interactive Swagger UI at `/api-docs`.\n\n---\n\n## Quick Start\n\n**Prerequisites:** Node.js 20+, Docker (optional), PostgreSQL.\n\n```bash\ngit clone \u003crepository-url\u003e\ncd farming-product-REST-api\nyarn install\ncp .env.example .env   # Configure database, JWT, and external services\n```\n\n**Local development:**\n\n```bash\nyarn db:migrate\nyarn dev\n```\n\n**Run with Docker:**\n\n```bash\ndocker build -t farming-api .\ndocker run -p 5002:5002 --env-file .env farming-api\n# API: http://localhost:5002  |  Docs: http://localhost:5002/api-docs\n```\n\nDefault port: **5002** (override with `PORT`). API base path: `/api/v2`.\n\n---\n\n## API\n\n| Area | Examples |\n|------|----------|\n| Auth | `POST /api/v2/auth/signup`, `POST /api/v2/auth/login` *(OTP endpoints disabled)* |\n| Users | `GET/PUT /api/v2/users/profile`, `POST /api/v2/users/upload-avatar` |\n| Products | `GET/POST /api/v2/products`, `GET/PUT/DELETE /api/v2/products/:id` |\n| Orders | `GET/POST /api/v2/orders` |\n| Payments | `POST /api/v2/transactions` (payment collection) |\n| Reviews | `GET/POST /api/v2/reviews` |\n| Notifications | `GET/POST /api/v2/notifications` |\n| System | `GET /api/v2/health`, `GET /api-docs` (Swagger) |\n\nProtected routes use `Authorization: Bearer \u003ctoken\u003e`. Full request/response specs and security (JWT, rate limits, validation) are in the Swagger UI.\n\n---\n\n## Testing\n\n```bash\nyarn test          # Run test suite\nyarn coverage      # Coverage report\nyarn test:watch    # Watch mode\n```\n\nTests use Vitest and Supertest; external services (email, payments) are mocked. Target: 80%+ coverage.\n\n---\n\n## Deployment\n\n- **Docker:** Build and run with `docker build -t farming-api .` then `docker run -p 5002:5002 --env-file .env farming-api` (or pass env vars another way).\n- **CI/CD:** GitHub Actions runs lint, format, build, tests, and coverage; builds and pushes a Docker image on push.\n\nKey environment variables: `DATABASE_URL`, `JWT_SECRET`, `JWT_SECRET_REFRESH`, `CLOUDINARY_*`, `ADWA_MERCHANT_KEY`, and any Expo/Nodemailer config as needed.\n\n---\n\n## Project Structure\n\n```\nfarming-product-REST-api/\n├── src/\n│   ├── controllers/     # auth, product, order, review, user, payment, notification\n│   ├── middleware/      # auth-check, errorHandler, rateLimiter, multer\n│   ├── models/          # Sequelize models (user, product, order, transaction, review, etc.)\n│   ├── routes/          # auth, users, products, orders, reviews, transactions, notifications\n│   ├── config/          # config.ts\n│   ├── errors/          # customErrors\n│   └── payment/         # payment provider interface and Adwa implementation\n├── public/              # Static assets, welcome page, 404\n├── tests/               # Vitest tests and mocks\n├── migrations/          # Sequelize migrations\n├── scripts/             # run-migrations, seed-db\n├── app.ts               # Express app, Swagger, static serving\n├── docker-compose.yml\n└── Dockerfile\n```\n\n---\n\n## License\n\nISC. See [LICENSE](LICENSE).\n\n**Author:** [Avom Brice](https://maebrieporfolio.vercel.app)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrckbrice%2Ffarming-product-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrckbrice%2Ffarming-product-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrckbrice%2Ffarming-product-rest-api/lists"}