How basava97/shopledger works
ShopLedger is a small-shop POS and bookkeeping application. The main workflow is order entry: the API resolves products, checks inventory, calculates prices and coupons, optionally charges a customer’s Khata account, records the order, and saves the updated state. Separate capabilities cover customer accounts and settlements, product and coupon lookup, dashboard/GST reconciliation, and printable tax invoices. The excerpts show server routing and core order, storage, reporting, and invoice logic; customer-route and browser behavior are represented only where the file tree or source index supports them.
Main entry points: server.js Express server · orders.js Order routes · store.js JSON storage · products.js Product routes
Components 19
Web and API
- Express server
server.js - POS interface
public/js/app.js - Product routes
routes/products.js - Order routes
routes/orders.js - Customer routes
routes/customers.js - Report routes
routes/reports.js
Sales and Inventory
- Inventory
lib/inventory.js - Order management
lib/orders.js - Pricing
lib/pricing.js - Coupons
lib/coupons.js - Reporting
lib/reports.js
Accounts and Tax
- Customer ledger
lib/ledger.js - Tax invoices
lib/invoice.js - GST rates
lib/tax.js - Date utilities
lib/dates.js
Configuration and Data
- Shop settings
config.js - JSON storage
lib/store.js - Shop data
data/db.json
Other components
- Shop operator
Connections 38
- Shop operator → POS interface: uses
- Express server → Product routes: mounts routes
server.js - Express server → Order routes: mounts routes
server.js - Express server → Customer routes: mounts routes
server.js - Express server → Report routes: mounts routes
server.js - Express server → JSON storage: reads order data
server.js - Express server → Order management: looks up order
server.js - Express server → Tax invoices: renders invoice
server.js - Express server → POS interface: serves static files
server.js - Product routes → JSON storage: reads products
routes/products.js - Product routes → Inventory: gets stock
routes/products.js - Product routes → GST rates: gets GST slab
routes/products.js - Product routes → Coupons: lists coupons
routes/products.js - Order routes → JSON storage: reads and writes
routes/orders.js - Order routes → Inventory: checks and reserves
routes/orders.js - Order routes → Pricing: computes totals
routes/orders.js - Order routes → Coupons: validates code
routes/orders.js - Order routes → Order management: creates or cancels
routes/orders.js - Order routes → Customer ledger: charges Khata
routes/orders.js - Customer routes → JSON storage: reads and writes
routes/customers.js - Customer routes → Customer ledger: uses customer ledger
routes/customers.js - Report routes → JSON storage: reads data
routes/reports.js - Report routes → Reporting: gets reports
routes/reports.js - Report routes → Pricing: previews totals
routes/reports.js - Report routes → Coupons: validates preview
routes/reports.js - Reporting → Inventory: summarizes stock
lib/reports.js - Reporting → Customer ledger: totals balances
lib/reports.js - Reporting → Tax invoices: reconciles invoices
lib/reports.js - Order management → Inventory: releases stock
lib/orders.js - Order management → Customer ledger: reverses Khata debit
lib/orders.js - Customer ledger → Date utilities: dates settlements
lib/ledger.js - Pricing → GST rates: uses tax rates
lib/pricing.js - Pricing → Coupons: calculates discounts
lib/pricing.js - Inventory → Shop settings: reads stock defaults
lib/inventory.js - Coupons → Shop settings: reads coupon rules
lib/coupons.js - GST rates → Shop settings: reads GST slabs
lib/tax.js - Tax invoices → Shop settings: reads shop and tax settings
lib/invoice.js - JSON storage → Shop data: reads and writes
lib/store.js