🏪 उधार बुक (Udhar Book) — Store Credit Management System
Features
What's New in v2.0
Tech Stack
Project Structure
Prerequisites
Installation & Setup
Server Start करना
App कैसे Use करें
SMS Setup (Fast2SMS)
API Endpoints
Database Schema
Performance
Troubleshooting
Feature
Description
🔐 Registration & Login
दुकानदार अपना अकाउंट बनाए — नाम, दुकान का नाम, मोबाइल, पासवर्ड
🔢 PIN Lock
4-digit PIN से app को lock करो — extra security layer
👥 Customer Management
ग्राहक add करो with photo, mobile, address
📸 Customer Photos
ग्राहक की photo upload करो — easy identification
🛒 Transaction Tracking
हर उधार entry — सामान, quantity, rate, due date, बिल photo
🧾 Bill Photo Upload
Transaction के साथ बिल की photo attach करो
💰 Partial Payment
थोड़ा-थोड़ा पैसा लो — progress bar + payment history timeline
📱 SMS Reminder
Fast2SMS API से automatic SMS भेजो
💬 WhatsApp Reminder
Pre-typed WhatsApp message — बस send दबाओ
⏰ Auto Daily Reminder
रोज़ सुबह 9 AM — overdue customers को auto SMS
Feature
Description
⭐ Trust Rating
ग्राहकों को 1-5 star rating दो — track करो कौन reliable है
📝 Customer Notes
हर ग्राहक पर personal notes लिखो
📊 Monthly Report
Monthly analytics — total बकाया, collection, Chart.js graph
📅 Calendar View
Calendar में due dates देखो — color-coded (paid/unpaid)
📁 CSV Export
सारा data Excel-friendly CSV में download करो
💾 Database Backup
One-click DB backup + download
🌓 Dark/Light Theme
Toggle between dark glassmorphism & light theme
🌐 Hindi/English
Language switch — पूरा app Hindi या English में
📲 PWA Support
Phone में install करो like a native app — offline caching
🎇 Antigravity Particles
Beautiful floating particle system — orbs, stars, diamonds, rings
🔄 Auto Backup
Daily automatic database backup (cron job)
🎯 Overdue Alerts
Color-coded overdue cards — critical, high, medium severity
🖨️ Print Receipt
Transaction receipt print करो
✅ PIN Lock System — 4-digit security lock
✅ Customer Photos — profile photo upload
✅ Bill Photos — attach bill to transactions
✅ Trust Rating — 1-5 star customer rating
✅ Customer Notes — personal notes per customer
✅ Monthly Report — analytics with Chart.js
✅ Calendar View — visual due date calendar
✅ CSV Export — Excel-friendly data export
✅ Database Backup — one-click backup & download
✅ Dark/Light Theme Toggle
✅ Hindi/English Language Switch
✅ PWA — installable on mobile
✅ Antigravity Particle System — orbs, stars, diamonds, rings
✅ Enhanced Animations — levitate, float, popIn, slideIn effects
✅ Gzip Compression — 78% smaller file transfers
✅ Lazy-loaded Chart.js — faster initial page load
✅ Color-coded Overdue Alerts
✅ Payment History Timeline
✅ Print Receipt Support
Technology
Use
Node.js
Backend runtime
Express.js
Web server & API routes
SQLite (better-sqlite3)
Local database — WAL mode for performance
bcrypt
Password & PIN hashing (secure storage)
express-session
Login session management (7 दिन तक)
multer
File uploads (customer photos, bill photos)
compression
Gzip compression — ~78% smaller transfers
node-cron
Daily backup + reminder scheduler (9 AM)
Chart.js
Monthly report chart (lazy-loaded)
Fast2SMS API
Indian SMS sending service
Service Worker
PWA offline caching
HTML/CSS/JS
Frontend SPA with glassmorphism UI
storeDB/
├── server.js # Express server — सारे API routes
├── database.js # SQLite setup — tables, migrations, backup
├── package.json # Dependencies & scripts
├── udhar_book.db # SQLite database (auto-created)
├── README.md # यह file
├── backups/ # Automatic daily backups
└── public/ # Frontend files
├── index.html # Main HTML — screens, modals, PIN pad
├── manifest.json # PWA manifest — installable app
├── service-worker.js # Offline caching — network-first for API
├── uploads/ # Customer photos & bill photos
├── css/
│ └── style.css # Glassmorphism + antigravity animations
└── js/
└── app.js # Frontend logic — i18n, particles, API calls
https://nodejs.org पर जाओ
LTS version download करो (green button)
Installer run करो → Next-Next-Finish
Verify:
node -- version # v18.x.x या ऊपर
npm -- version # 9.x.x या ऊपर
⚠️ node not found आए तो PC restart करो।
Step 1: Project folder open करो
cd C:\Users\Amitj\OneDrive\Desktop\storeDB
Step 2: Dependencies install करो
यह command इन packages को install करेगा:
better-sqlite3 — SQLite database
bcrypt — Password encryption
express — Web server
express-session — Login sessions
multer — File upload handling
compression — Gzip compression
node-cron — Scheduler
⚠️ better-sqlite3 को C++ build tools चाहिए। Error आए तो:
npm install -- global windows- build-tools
dir node_modules # folder बन गया होना चाहिए
cd C:\Users\Amitj\OneDrive\Desktop\storeDB
node server.js
Output:
🏪 Udhar Book is running!
📍 Open: http://localhost:3000
Browser में खोलो: http://localhost:3000
Server बंद करना: Ctrl + C
💡 Port already in use?
Get-Process - Name " node" | Stop-Process - Force
node server.js
🔐 Step 1: Account बनाओ (Register)
http://localhost:3000 खोलो
"Register" tab → भरो:
आपका नाम — दुकानदार का नाम
दुकान का नाम — जैसे "Sharma General Store"
मोबाइल नंबर — login mobile
पासवर्ड — कम से कम 4 characters
Confirm Password
"Register" दबाओ → Dashboard खुल जाएगा!
🔢 Step 2: PIN Lock Setup (Optional)
⚙️ Settings → PIN Lock section
4-digit PIN enter करो → Save
अब हर बार app खोलोगे तो PIN मांगेगा
"+ ग्राहक जोड़ें" बटन दबाओ
नाम , मोबाइल , पता (optional) भरो
"Save" → ग्राहक list में दिखेगा
ग्राहक detail page पर 📷 icon से photo upload कर सकते हो
ग्राहक पर click → "+ उधार Entry" दबाओ
सामान add करो:
Item Name — "चावल", "दाल", "तेल"
Price ₹ — rate
Qty — quantity
➕ "+ Add Item" — multiple items
Due Date select करो
📷 बिल photo attach करो (optional)
"Save" → Transaction card बन जाएगा
Full Payment:
Transaction पर "✅ पूरा भुगतान" click → green done!
Partial Payment:
"💰 कुछ भुगतान" → amount enter → "Pay"
Progress bar update + payment history timeline दिखेगा
पूरा amount भरने पर auto-complete
⭐ Step 6: Trust Rating & Notes
ग्राहक detail page पर ⭐ stars click करो → rating save
Notes section में कुछ भी लिखो → "Save"
"📱 Remind" बटन दबाओ
SMS setup है → automatic SMS चला जाएगा
SMS fail → "WhatsApp से भेजें" button → pre-typed message
📊 Step 8: Reports & Calendar
Report 📊 → Monthly analytics with chart
Calendar 📅 → Due dates visual calendar (color-coded)
Export 📁 → CSV download (Excel-friendly)
Backup 💾 → Database download
⚙️ Settings → Theme toggle (Dark/Light)
⚙️ Settings → Language (Hindi/English)
https://www.fast2sms.com → Sign Up
Email verify करो
Login → Left sidebar → "Dev API"
API Key Copy करो
⚙️ Settings → API Key paste → "Save Key"
✅ Status: Active दिखेगा
"Test SMS" दबाओ → apne number pe SMS aayega
💡 Fast2SMS नए accounts पर free SMS credits देता है।
Method
Endpoint
Description
POST
/api/register
नया account
POST
/api/login
Login
POST
/api/logout
Logout
GET
/api/me
Current user info
Method
Endpoint
Description
POST
/api/pin/set
PIN set करो
POST
/api/pin/verify
PIN verify करो
POST
/api/pin/remove
PIN हटाओ
Method
Endpoint
Description
GET
/api/customers
सारे ग्राहक
POST
/api/customers
नया ग्राहक
GET
/api/customers/:id
ग्राहक detail
DELETE
/api/customers/:id
ग्राहक delete
POST
/api/customers/:id/photo
Photo upload
PUT
/api/customers/:id/trust
Trust rating
PUT
/api/customers/:id/notes
Notes save
Method
Endpoint
Description
GET
/api/customers/:id/transactions
Transactions list
POST
/api/customers/:id/transactions
नई उधार entry
PUT
/api/transactions/:id/pay
Payment (full/partial)
DELETE
/api/transactions/:id
Transaction delete
Method
Endpoint
Description
POST
/api/customers/:id/remind
Reminder भेजो
GET
/api/report/monthly
Monthly report
GET
/api/calendar
Calendar events
Method
Endpoint
Description
GET
/api/export/csv
CSV download
POST
/api/backup
Manual backup
GET
/api/backup/download
DB download
Method
Endpoint
Description
GET
/api/settings
Settings load
POST
/api/settings
Setting save
POST
/api/settings/test-sms
Test SMS
GET
/api/dashboard
Dashboard stats
SQLite (file: udhar_book.db) — WAL mode, foreign keys enabled
1. store_owners — दुकानदार
Column
Type
Description
id
INTEGER (PK)
Auto ID
name
TEXT
दुकानदार का नाम
shop_name
TEXT
दुकान का नाम
mobile
TEXT (UNIQUE)
मोबाइल नंबर
password
TEXT
Hashed password
pin
TEXT
Hashed 4-digit PIN (optional)
created_at
DATETIME
बनने की date
Column
Type
Description
id
INTEGER (PK)
Auto ID
owner_id
INTEGER (FK)
किस दुकानदार का
name
TEXT
ग्राहक का नाम
mobile
TEXT
मोबाइल नंबर
address
TEXT
पता (optional)
photo
TEXT
Photo file path
trust_rating
INTEGER
1-5 star rating
notes
TEXT
Personal notes
created_at
DATETIME
बनने की date
3. transactions — उधार entries
Column
Type
Description
id
INTEGER (PK)
Auto ID
customer_id
INTEGER (FK)
किस ग्राहक का
owner_id
INTEGER (FK)
किस दुकानदार का
bill_photo
TEXT
Bill photo path
created_at
DATETIME
Entry date
due_date
DATETIME
Due date
is_paid
INTEGER
0=pending, 1=paid
paid_amount
REAL
Partial amount paid
paid_at
DATETIME
Payment date
reminder_sent
INTEGER
Reminder sent flag
4. transaction_items — सामान list
Column
Type
Description
id
INTEGER (PK)
Auto ID
transaction_id
INTEGER (FK)
किस transaction का
item_name
TEXT
सामान का नाम
price
REAL
कीमत
quantity
INTEGER
कितना
5. payment_history — Payment timeline
Column
Type
Description
id
INTEGER (PK)
Auto ID
transaction_id
INTEGER (FK)
किस transaction का
amount
REAL
कितना दिया
paid_at
DATETIME
कब दिया
6. reminders — Reminder history
Column
Type
Description
id
INTEGER (PK)
Auto ID
transaction_id
INTEGER (FK)
किस transaction के लिए
customer_id
INTEGER (FK)
किस ग्राहक को
sent_at
DATETIME
कब भेजा
type
TEXT
manual / auto
7. settings — App settings
Column
Type
Description
id
INTEGER (PK)
Auto ID
owner_id
INTEGER (FK)
किस दुकानदार का
setting_key
TEXT
Key name
setting_value
TEXT
Value
App is optimized for mobile:
Optimization
Impact
Gzip Compression
~78% smaller transfers (112KB → 24KB)
Lazy Chart.js
250KB+ removed from initial load
Static Caching
maxAge: 1 day — browser caches files
Google Fonts
3 weights only (400, 600, 700)
Reduced Particles
12 on mobile, 28 on desktop
Service Worker
Cache-first for static, network-first for API
npm install -- global windows- build-tools
npm install
🔴 EADDRINUSE: port 3000 in use
Get-Process - Name " node" | Stop-Process - Force
node server.js
🔴 Database reset (सारा data delete)
# Server बंद करो पहले (Ctrl+C)
Remove-Item udhar_book.db, udhar_book.db- shm, udhar_book.db- wal - ErrorAction SilentlyContinue
node server.js
# नया database बन जाएगा
Fast2SMS API key check करो (Settings)
Test SMS बटन use करो
Fast2SMS balance check करो
10-digit Indian number होना चाहिए
🔴 Photos upload नहीं हो रही
public/uploads/ folder exist करना चाहिए (auto-created)
File size limit: 5MB
Database reset करना होगा (ऊपर देखो)
या manually DB se PIN column clear करो
🔴 App mobile पर slow load
Server pe gzip compression enabled है (auto)
Browser cache clear करो
WiFi/mobile data check करो
Personal use — Made for Amit Ji 🙏
Made with ❤️ — Udhar Book v2.0
Glassmorphism UI • Antigravity Particles • PWA Ready