Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Smart Return Approval System

A full-stack web application for managing product return requests with automated approval/rejection based on a scoring system.


📖 Project Overview

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.


🛠 Technologies Used

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

📁 Folder Structure

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

⚡ Setup Instructions

Prerequisites

  • Node.js v18 or later
  • npm v9 or later

1. Clone the repository

git clone <repo-url>
cd smart-return-system

2. Start the Backend

cd server
npm install
node server.js

The API server will start at http://localhost:5000.

3. Start the Frontend

cd client
npm install
npm run dev

The React app will open at http://localhost:5173.


📡 API Documentation

POST /returns

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."
}

GET /returns

Fetch all return requests. Supports optional query parameter ?search= to filter by Order ID.

GET /returns/:id

Fetch a single return request by its numeric ID.


🧠 Scoring & Decision Logic

Criterion Points
Within 30 days +50
Condition: New +50
Condition: Good +30
Condition: Damaged −20
Total Score Decision
≥ 80 ✅ Approved
< 80 ❌ Rejected

✅ Validation Rules

  • 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.

🔑 Assumptions

  1. One return request per unique Order ID.
  2. The scoring algorithm uses only days since purchase and item condition.
  3. The 30-day window is calculated from the purchase date to the current server date.
  4. SQLite is used for simplicity — the database.db file is auto-created on first run.
  5. No authentication is required; any user can submit and view returns.

🤖 AI-Assisted Development

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.


📄 License

MIT

About

Smart Return Approval System built with React, Node.js, Express, and SQLite. Automates return request validation and approval based on business rules.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages