This is a Retail Transaction System. I built a simple Node.js server that reads retail sales data from a CSV file and turns it into API output for filtering and reporting.
What it does:
- loads sales data from
data/retailTransaction.csv - converts CSV rows into JSON transaction objects
- supports filters by payment method and product category
- gives quick API routes for the frontend to use
The main app file.
- uses
express,fs,csv-parse, andcors - reads
data/retailTransaction.csvwhen the server starts - converts each row into a JSON object
- groups transactions by payment method and product category
- exposes REST endpoints for the frontend or browser
Project info and dependencies.
- includes packages like
express,csv-parse, andcors - lets you install everything with
npm install
The data file with retail sales records.
- is in CSV format
- includes fields like customer ID, product ID, payment method, category, price, and total amount
- Server starts and reads the CSV file using
fs.createReadStream(). csv-parseparses each row into an object.- All transaction objects are stored in memory.
- The app builds lookup groups for payment methods and product categories.
- Server runs on
localhost:8081and responds to API calls.
Use these routes to get transaction data:
GET /— basic health checkGET /retailData5— first 5 transactionsGET /byPaymentMethod/:paymentMethod— transactions by payment methodGET /byProductCategory/:productCategory— transactions by categoryGET /productCategory— list of available categoriesGET /paymentMethod— list of available payment methods
From the project root run:
npm install
node server.jsThen open http://localhost:8081 in a browser or use the API routes.
This project helped me practise reading CSV data in Node.js, building simple REST APIs, and connecting backend data with a frontend app. It was a good exercise for understanding basic server logic and filtering data in a real project.




