On a Linux server (PM2 + Nginx)
Install Node.js 22+ and copy the project to the server (for example
/var/www/sufra).Create
.envas in Installation, and set the public address:SITE_URL="https://order.your-restaurant.com"SITE_URLmust be the exact HTTPS address customers use: Thawani sends paying customers back to it, and the session cookie is marked secure when it starts withhttps://.Build and create the database:
npm ci npm run setup npm run buildKeep it running with PM2:
npm install -g pm2 pm2 start npm --name sufra -- start pm2 save && pm2 startupThe app listens on port 3301 (
npm start). To use another port, change-p 3301in thestartscript ofpackage.json.Put Nginx in front for HTTPS:
server { server_name order.your-restaurant.com; client_max_body_size 5m; # dish photo uploads (4 MB max) location / { proxy_pass http://127.0.0.1:3301; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }Then get a certificate (for example
certbot --nginx).X-Forwarded-Formatters: the request limits (orders, sign-in) count per visitor IP.
Updating
git pull # or copy the new files
npm ci
npx prisma db push # applies new tables or columns, keeps your data
npm run build
pm2 restart sufra
Backups
With SQLite, the whole restaurant is the file prisma/sufra.db plus your uploaded photos in public/uploads. Back up both, for example every night:
sqlite3 prisma/sufra.db ".backup /backups/sufra-$(date +%F).db"
tar czf /backups/uploads-$(date +%F).tgz public/uploads
Moving to PostgreSQL
SQLite is fine for one restaurant. For several server instances or a managed database:
- In
prisma/schema.prismachangeprovider = "sqlite"toprovider = "postgresql". - Set
DATABASE_URL="postgresql://user:password@host:5432/sufra". - Run
npm run setup.
Nothing else changes. With more than one instance, also move uploads to shared storage and replace the in-memory request limiter in src/lib/api.ts with a shared store (see Troubleshooting).
Hosting platforms
Any host that runs a Node.js server works. On platforms with a read-only or temporary disk (many serverless hosts), SQLite and public/uploads do not persist: use PostgreSQL and change the upload route src/app/api/dashboard/upload/route.ts to save to object storage (S3, R2, ...).