- There is complete env file and the db also uploaded for the use case of the development for the new developer . To help the new developer i have made followed the practice to let the new developer enjoy the beauty of the backend . Happy learnig .
This is the backend API for Kissan Connect, a platform designed to connect farmers and buyers. It provides user authentication, product listing, bidding system, order management, notifications, and an insurance module.
- User authentication (Signup/Login with role-based access)
- Product listing and management
- Bidding system for buyers and farmers
- Order confirmation and tracking
- Notifications for bids, orders, and updates
- Insurance management (apply, claim)
Ensure you have the following installed:
- Python 3.10+
- FastAPI
- SQLite (or PostgreSQL for production)
- Uvicorn
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
Ensure the database is created:
sqlite3 backend.db "PRAGMA table_info(users);"
Method | Endpoint | Body | Description |
---|---|---|---|
POST | /auth/signup |
{ full_name, email, phone, password, role } |
Register a new user |
POST | /auth/login |
{ username, password } |
Login and get JWT token |
GET | /auth/me |
Headers: Authorization: Bearer {token} |
Get current user details |
Method | Endpoint | Body | Description |
---|---|---|---|
POST | /products/ |
{ name, price, quantity, image_url } |
List a new product (farmer only) |
GET | /products/ |
None | Fetch all available products |
Method | Endpoint | Body | Description |
---|---|---|---|
GET | /bids/ |
None | Fetch bids received by a farmer |
POST | /bids/place |
{ product_id, amount } |
Place a bid on a product (buyer) |
PUT | /bids/{bid_id}/update?status=accepted |
Query: status=accepted/rejected |
Accept or reject a bid |
Method | Endpoint | Body | Description |
---|---|---|---|
POST | /orders/confirm |
{ bid_id } |
Confirm an accepted bid and create an order |
GET | /orders/ |
None | Get all orders for a user |
Method | Endpoint | Body | Description |
---|---|---|---|
GET | /notifications/ |
None | Fetch notifications for the logged-in user |
Method | Endpoint | Body | Description |
---|---|---|---|
GET | /insurance/ |
None | Fetch available insurance plans (filtered by role) |
POST | /insurance/apply |
{ insurance_id } |
Apply for an insurance plan |
POST | /insurance/claim |
{ insurance_id, reason } |
Claim an insurance plan |
- Import the API collection into Postman.
- Set
Authorization
asBearer {access_token}
for protected routes. - Test different functionalities like user signup, bidding, and insurance.
- Login failure: Ensure the credentials are correct and the database has users.
- Unauthorized requests: Include the
Authorization
header in requests. - Database not updating: Run
sqlite3 backend.db
and check data consistency.
This project is licensed under MIT License.
- Shit_code - Lead Developer
For any issues, feel free to open a GitHub issue or contact us. 🚀