Manual setup and deployment

Put Nuzul on your own server with HTTPS, and keep it running.

On a Linux server (PM2 + Nginx)

  1. Install Node.js 22.18+ and copy the project to the server (for example /var/www/nuzul).

  2. Create .env as 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_URL must 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 with https://. COMPANY_TIMEZONE decides what "today" is for check-in, past dates and the door code.

  3. Build and create the database:

    npm ci
    npm run setup
    npm run build
    
  4. Keep it running with PM2:

    npm install -g pm2
    pm2 start npm --name nuzul -- start
    pm2 save && pm2 startup
    

    The app listens on port 3304 (npm start). To use another port, change -p 3304 in the start script of package.json.

  5. 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 set X-Forwarded-For as 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:

  1. In prisma/schema.prisma change provider = "sqlite" to provider = "postgresql".
  2. Set DATABASE_URL="postgresql://user:password@host:5432/nuzul".
  3. 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, ...).