Directory Overview
Core Files Explained
HTML Pages
The application consists of four main pages:index.html - Dashboard
index.html - Dashboard
Purpose: Main landing page with overview statisticsKey Features:
- Displays today’s sales, total sales, transaction count, and product count
- Quick action buttons to navigate to other pages
- Recent transactions list
- Navigation bar with links to all pages
pos.html - Point of Sale
pos.html - Point of Sale
Purpose: Transaction interface for creating salesKey Features:
- Product selection grid
- Shopping cart with add/remove items
- Total calculation
- Checkout functionality
- Real-time cart updates
products.html - Product Management
products.html - Product Management
Purpose: Add, view, and delete productsKey Features:
- Product listing table
- Add new product form
- Delete product functionality
- Product count display
- Price formatting with ₹ (Indian Rupee)
reports.html - Sales Analytics
reports.html - Sales Analytics
Purpose: View and analyze sales dataKey Features:
- Date range filtering
- Sales summary statistics
- Detailed transaction table
- CSV export functionality
- Time-based sales analysis
JavaScript Modules
The application uses ES6 modules for code organization:Database Layer
Products Store
Products Store
Sales Store
Sales Store
Shared Utilities
Page-Specific Modules
dashboard.js
dashboard.js
Responsibilities:
- Load and display statistics (sales, transactions, products)
- Fetch recent transactions from database
- Render transaction list
- Update stats on page load
loadStats()- Calculates today’s and total salesloadRecentTransactions()- Displays last 10 transactions
pos.js
pos.js
Responsibilities:
- Load product catalog
- Manage shopping cart state
- Handle add/remove item actions
- Process checkout and save sales
- Calculate totals
loadProducts()- Renders product gridaddToCart(product)- Adds item to cartremoveFromCart(index)- Removes item from cartcheckout()- Saves sale to database
products.js
products.js
Responsibilities:
- Display product list
- Handle product creation
- Handle product deletion
- Update product count
loadProducts()- Renders product tableaddProduct(name, price)- Creates new productdeleteProduct(id)- Removes product
reports.js
reports.js
Responsibilities:
- Filter sales by date range
- Calculate sales statistics
- Render transaction table
- Export data to CSV
loadReports(fromDate, toDate)- Filters and displays salesexportCSV()- Generates CSV download
Styling Architecture
Tailwind Configuration
tailwind.config.js
The
content array tells Tailwind which files to scan for class names. This is crucial for tree-shaking unused styles.CSS Source Files
PWA Components
Service Worker
File:sw.js (root directory)
Purpose: Enables offline functionality and app caching
Features:
- Caches local assets (HTML, CSS, JS, images)
- Provides offline fallback
- Handles cache updates
The service worker only caches local resources. It gracefully handles failures and doesn’t cache external CDN assets.
Web App Manifest
File:manifest.json (root directory)
Assets Organization
Icons Directory
favicon.ico- Browser tab iconicon-192.png- PWA icon (192x192)icon-512.png- PWA icon (512x512)apple-touch-icon.png- iOS home screen icon
Images Directory
logo.svg- Codecraft by Syed branding (495KB)pos.svg- POS icon used in header (657KB)screenshots/- App preview images
Logos are displayed with
rounded-full class for circular appearance. Replace logo.svg to customize branding.Module Dependencies
The application follows this dependency flow:Next Steps
Local Setup
Set up your development environment
Customization
Learn how to customize the system