Backend API for Agric Connect, a platform that connects farmers and buyers across East Africa. Built with Node.js, Express, MongoDB, and JWT authentication.
# 🌱 Agric-Connect Backend
The backend API for **Agric-Connect**, a web platform designed to connect farmers and buyers across East Africa.
Agric-Connect provides a secure and scalable REST API for user authentication, farmer product management, product discovery, and role-based access control.
## 🚀 Features
* 🔐 JWT-based authentication
* 👥 Role-based access control (RBAC)
* 👨🌾 Farmer and buyer user roles
* 📦 Product management
* 🖼️ Product image uploads using Multer
* 🔎 Product retrieval and filtering
* 🗄️ MongoDB database with Mongoose
* ⚡ Redis caching for improved API performance
* 🔒 Password hashing with bcrypt
* 🛡️ Helmet security middleware
* 🌐 CORS configuration
* 📊 Structured controllers, services, models, and routes
* 🔑 Protected API endpoints
* ⚙️ Environment-based configuration
## 🛠️ Tech Stack
| Technology | Purpose |
| ---------- | ----------------------------- |
| Node.js | Backend runtime |
| Express.js | REST API framework |
| MongoDB | Database |
| Mongoose | MongoDB ODM |
| Redis | Caching |
| JWT | Authentication |
| bcrypt | Password hashing |
| Multer | Image uploads |
| Helmet | HTTP security |
| CORS | Cross-origin resource sharing |
| Postman | API testing |
## 📁 Project Structure
```text
src/
├── config/
│ ├── db.js
│ └── redis.js
│
├── controllers/
│ ├── auth.controller.js
│ └── product.controller.js
│
├── middleware/
│ ├── auth.middleware.js
│ ├── upload.middleware.js
│ └── ...
│
├── models/
│ ├── user.model.js
│ ├── product.model.js
│ ├── role.model.js
│ └── permission.model.js
│
├── routes/
│ ├── auth.route.js
│ └── product.route.js
│
├── services/
│ ├── auth.service.js
│ └── product.service.js
│
├── app.js
└── server.js
uploads/
.env
.gitignore
package.json
README.md
```
## …