Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CodecraftBySyed/Mini-POS-System/llms.txt
Use this file to discover all available pages before exploring further.
Architecture
The Mini POS System uses IndexedDB for client-side data persistence. The database provides a simple, promise-based API for managing products and sales records.Database Configuration
Schema
The database contains two object stores:Products Store
- Name:
products - Key Path:
id(auto-increment) - Indexes: None
- Structure:
Sales Store
- Name:
sales - Key Path:
id(auto-increment) - Indexes:
date(for range queries) - Structure:
Core Functions
openDB()
Opens a connection to the IndexedDB database. Creates object stores if they don’t exist.Resolves with the database connection
js/db.js
- Rejects if the database cannot be opened
- Rejects if there are permission issues
- Rejects if IndexedDB is not supported
tx()
Helper function for executing transactions. Simplifies transaction management by handling connection and cleanup.Name of the object store (‘products’ or ‘sales’)
Transaction mode: ‘readonly’ or ‘readwrite’
Callback function that receives the object store and performs operations
Resolves with the result of the transaction
js/db.js
- Rejects if the database connection fails
- Rejects if the transaction fails
- Rejects if the object store doesn’t exist
Connection Management
The database connection is managed automatically:openDB()is called for each transaction- IndexedDB returns cached connections when available
- Connections are automatically closed after transactions complete
- Schema upgrades happen automatically on version changes