Sample / DEPLOYMENT.md
SuriRaja's picture
Deploy static build to Hugging Face
b54da4e

SETA Smart Inventory - Static Deployment Guide

This guide explains how to deploy the SETA Smart Inventory app as a static website.

πŸš€ Quick Deploy

Option 1: Vercel (Recommended)

  1. Push your code to GitHub
  2. Connect your repository to Vercel
  3. Vercel will automatically detect Next.js and deploy
  4. Your app will be available at https://your-app.vercel.app

Option 2: Netlify

  1. Run npm run build locally
  2. Upload the out folder to Netlify
  3. Or connect your GitHub repository to Netlify

Option 3: GitHub Pages

  1. Run npm run build
  2. Push the out folder contents to your gh-pages branch
  3. Enable GitHub Pages in repository settings

πŸ“¦ Build Commands

```bash

Install dependencies

npm install

Build for production (static export)

npm run build

The static files will be in the 'out' directory

```

πŸ”§ Configuration

The app is configured for static export with:

  • output: 'export' in next.config.mjs
  • trailingSlash: true for better static hosting compatibility
  • images.unoptimized: true for static image handling

πŸ“ File Structure After Build

``` out/ β”œβ”€β”€ index.html # Dashboard β”œβ”€β”€ inventory/ β”‚ β”œβ”€β”€ index.html # Inventory page β”‚ β”œβ”€β”€ scanner/ β”‚ β”‚ └── index.html # Scanner page β”‚ └── alerts/ β”‚ └── index.html # Alerts page β”œβ”€β”€ customers/ β”‚ └── index.html # Customers page β”œβ”€β”€ whatsapp/ β”‚ └── index.html # WhatsApp page β”œβ”€β”€ analytics/ β”‚ └── index.html # Analytics page β”œβ”€β”€ finance/ β”‚ └── index.html # Finance page β”œβ”€β”€ reports/ β”‚ └── index.html # Reports page β”œβ”€β”€ _next/ # Next.js assets └── static/ # Static assets ```

🌐 Custom Domain

To use a custom domain:

  1. Add a CNAME file to the public folder with your domain
  2. Configure DNS to point to your hosting provider
  3. Enable HTTPS in your hosting provider settings

πŸ“± PWA Features (Optional)

To make the app installable on mobile devices, you can add:

  • Web App Manifest (public/manifest.json)
  • Service Worker for offline functionality
  • App icons in various sizes

πŸ”’ Environment Variables

For static deployment, any environment variables must be prefixed with NEXT_PUBLIC_ to be available in the browser.

Example: ```bash NEXT_PUBLIC_SALESFORCE_API_URL=https://your-salesforce-instance.com ```

πŸ“Š Analytics

You can add analytics by including tracking scripts in the app/layout.tsx file or using Next.js built-in analytics.

🚨 Limitations of Static Export

  • No server-side API routes
  • No server-side rendering (SSR)
  • No incremental static regeneration (ISR)
  • All data must be fetched client-side

For full Salesforce integration, you'll need to use client-side API calls or a separate backend service. ```

Let's also add a simple build script for easier deployment: