A full-stack web application for managing product return requests with automated approval/rejection based on a scoring system.
Customers submit return requests through a modern web form. The system evaluates each request using a scoring algorithm based on the return window and item condition, then automatically approves or rejects the request.
A real-time dashboard shows all return requests, approval/rejection statistics, and supports search by Order ID.
| Layer | Technology |
|---|---|
| Frontend | React.js (Vite) + Tailwind CSS v4 |
| Backend | Node.js + Express.js |
| Database | SQLite (via better-sqlite3) |
| HTTP | Axios |
| Routing | React Router v6 |
smart-return-system/
├── client/ # React Vite frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── Navbar.jsx
│ │ │ ├── StatCard.jsx
│ │ │ ├── ReturnTable.jsx
│ │ │ ├── StatusBadge.jsx
│ │ │ └── Notification.jsx
│ │ ├── pages/
│ │ │ ├── Dashboard.jsx
│ │ │ └── SubmitReturn.jsx
│ │ ├── services/
│ │ │ └── api.js
│ │ ├── App.jsx
│ │ ├── main.jsx
│ │ └── index.css
│ ├── index.html
│ └── vite.config.js
│
├── server/
│ ├── server.js # Express API server
│ └── database.db # Auto-created at runtime
│
└── README.md
- Node.js v18 or later
- npm v9 or later
git clone <repo-url>
cd smart-return-systemcd server
npm install
node server.jsThe API server will start at http://localhost:5000.
cd client
npm install
npm run devThe React app will open at http://localhost:5173.
Submit a new return request.
Request Body:
{
"customer_name": "John Smith",
"order_id": "ORD-2024-001",
"product_name": "Wireless Headphones",
"purchase_date": "2026-06-01",
"return_reason": "Item arrived with a cracked housing",
"item_condition": "New"
}Response (201):
{
"success": true,
"data": { "id": 1, "score": 100, "status": "Approved", "..." : "..." },
"message": "Return request Approved."
}Fetch all return requests. Supports optional query parameter ?search= to filter by Order ID.
Fetch a single return request by its numeric ID.
| Criterion | Points |
|---|---|
| Within 30 days | +50 |
| Condition: New | +50 |
| Condition: Good | +30 |
| Condition: Damaged | −20 |
| Total Score | Decision |
|---|---|
| ≥ 80 | ✅ Approved |
| < 80 | ❌ Rejected |
- All fields are required.
- Order ID must be unique (no duplicate returns).
- Purchase Date cannot be in the future.
- Return Reason must be at least 10 characters.
- One return request per unique Order ID.
- The scoring algorithm uses only days since purchase and item condition.
- The 30-day window is calculated from the purchase date to the current server date.
- SQLite is used for simplicity — the
database.dbfile is auto-created on first run. - No authentication is required; any user can submit and view returns.
AI-Assisted Development
This project was developed using AI-assisted tools including ChatGPT and GitHub Copilot. These tools helped generate the initial project structure, API endpoints, validation logic, and frontend components. AI assistance accelerated development by providing code suggestions and implementation guidance.
The generated code was reviewed, customized, tested, and debugged manually. Integration between the frontend, backend, and database was implemented and verified through testing to ensure the application met the specified requirements.
MIT