On a Linux server (PM2 + Nginx)
Install Node.js 22.18+ and copy the project to the server (for example
/var/www/nuzul).Create
.envas in Installation, and set the public address and the time zone of your stays:SITE_URL="https://stays.your-company.com" COMPANY_TIMEZONE="Asia/Muscat"SITE_URLmust be the exact HTTPS address guests use: Thawani sends paying guests back to it, the sitemap uses it, and the session cookie is marked secure when it starts withhttps://.COMPANY_TIMEZONEdecides what "today" is for check-in, past dates and the door code.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 nuzul -- start pm2 save && pm2 startupThe app listens on port 3304 (
npm start). To use another port, change-p 3304in thestartscript ofpackage.json.Put Nginx in front for HTTPS:
server { server_name stays.your-company.com; client_max_body_size 5m; # photo uploads (4 MB max) location / { proxy_pass http://127.0.0.1:3304; 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). Nginx must setX-Forwarded-Foras above: the request limits on bookings, lookups and sign-in count per visitor address.
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 nuzul
Backups
With SQLite the whole company is the file prisma/nuzul.db plus uploaded photos in public/uploads. Back up both every night, for example:
sqlite3 prisma/nuzul.db ".backup /backups/nuzul-$(date +%F).db"
tar czf /backups/uploads-$(date +%F).tgz public/uploads
Moving to PostgreSQL
SQLite is fine for one company with dozens of stays. For several server instances or a managed database:
- In
prisma/schema.prismachangeprovider = "sqlite"toprovider = "postgresql". - Set
DATABASE_URL="postgresql://user:password@host:5432/nuzul". - Run
npm run setup.
Nothing else changes: the unique (stay, night) index that prevents double bookings works the same way in PostgreSQL. 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 such as Redis.
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 src/app/api/dashboard/upload/route.ts to save to object storage (S3, R2, ...).