Modern, responsive web UI for the Smart Inventory Hub inventory management system.
This UI provides a complete frontend for managing product inventory with:
- ✅ Dashboard with real-time metrics
- ✅ Product CRUD operations
- ✅ Search and filter functionality
- ✅ Interactive charts and visualizations
- ✅ Low stock alerts with visual indicators
- ✅ Responsive design (mobile-first)
- ✅ Premium dark theme with glassmorphism
- ✅ Demo mode for local testing
| File | Description |
|---|---|
index.html |
Main HTML file with UI structure |
app.js |
JavaScript application logic |
styles.css |
Additional CSS styles |
- HTML5 - Semantic markup
- Tailwind CSS (CDN) - Modern styling
- Vanilla JavaScript - No framework dependencies
- Chart.js - Interactive data visualization
- Font Awesome - Rich iconography
-
Open the UI locally:
# Navigate to UI directory cd ui-src # Open in browser (macOS) open index.html # Or use a simple HTTP server python3 -m http.server 8000 # Then open: http://localhost:8000
-
The UI will start in Demo Mode with mock data
- No backend required
- Sample products pre-loaded
- All CRUD operations work with local data
- Deploy the stack following the deployment guide
- The UI sync job will automatically configure the API endpoint
- Access via CloudFront at your subdomain
The UI uses placeholder variables that are replaced during deployment:
| Placeholder | Description | Example |
|---|---|---|
{{API_ENDPOINT}} |
API Gateway endpoint | https://abc123.execute-api.us-east-2.amazonaws.com/dev |
{{COGNITO_USER_POOL_ID}} |
Cognito User Pool ID | us-east-2_ABC123 |
{{COGNITO_CLIENT_ID}} |
Cognito App Client ID | abc123def456ghi789 |
{{COGNITO_DOMAIN}} |
Cognito hosted UI domain | hkc-sample.auth.us-east-2.amazoncognito.com |
{{COGNITO_REGION}} |
Cognito region | us-east-2 |
These are replaced by the UI sync job when deploying instances.
Demo Mode (default):
- Uses mock data stored in
app.js - No API calls
- Perfect for UI development and testing
- Toggle with "Demo Mode" button
Live Mode:
- Connects to real API
- All operations persist to DynamoDB
- Requires deployed backend
- Toggle with "Live Mode" button
Metrics Cards:
- Total Products
- Total Inventory Value
- Low Stock Items (with alerts)
- Number of Categories
Charts:
- Inventory by Category (Doughnut chart)
- Stock Status (Bar chart: Healthy, Low, Out of Stock)
Add Product:
- Click "Add Product" button
- Fill in product details
- Save to create
Edit Product:
- Click edit icon on any product row
- Modify details
- Save to update
Delete Product:
- Click delete icon
- Confirm deletion
Search & Filter:
- Search by name, SKU, or brand
- Filter by category
- Real-time results
The UI uses Tailwind CSS. To customize colors, edit the Tailwind classes in index.html:
<!-- Primary color (orange) -->
<button class="bg-orange-500 hover:bg-orange-600">
<!-- Success color (green) -->
<span class="text-green-500">
<!-- Warning color (yellow) -->
<span class="text-yellow-500">Charts are configured in app.js in the initializeCharts() function:
// Change chart type
categoryChart = new Chart(categoryCtx, {
type: 'doughnut', // Change to: 'pie', 'bar', 'line'
// ...
});Add/remove categories in index.html:
<select id="productCategory">
<option value="">Select category</option>
<option value="Electronics">Electronics</option>
<option value="YourCategory">Your Category</option>
</select>The UI is automatically deployed by the RGD's UI sync job:
- Source: UI files are stored in the platform assets bucket
- Sync Job: Copies files to shared UI bucket with subdomain prefix
- Configuration: Replaces placeholder variables with actual values
- CloudFront: Serves the UI via the shared distribution
# Upload to platform assets bucket
aws s3 sync . s3://hkc-sample-assets/ui/inventory-app/v5/ \
--exclude "README.md" \
--exclude ".DS_Store" \
--region us-east-2- ✅ Chrome 90+
- ✅ Firefox 88+
- ✅ Safari 14+
- ✅ Edge 90+
If you see CORS errors in the browser console:
- Check API Gateway CORS configuration in the RGD
- Verify CORS allows your domain
- Verify API is deployed: Check instance status
- Test API directly: Use curl to test the endpoint
- Check CloudWatch Logs: Review Lambda function logs
- Check CloudFront propagation: Wait 15-20 minutes after deployment
- Verify DNS record: Check Route 53 record exists
- Check S3 sync job: Review job logs for errors
After deploying the UI:
- Access via your subdomain (e.g.,
https://john-inventory-dev.example.com) - Toggle to "Live Mode" to connect to the API
- Create, edit, and delete products
- Monitor the dashboard metrics
See ../docs/DEPLOYMENT-GUIDE.md for complete deployment instructions.