Build & Deploy
While SparkFeed is primarily designed as a local-first application, you can build it for production to run it continuously on a home server, a NAS device, or a VPS.
Production Build
Section titled “Production Build”To build the optimized production bundle:
npm run buildThis compiles the frontend React app and the Nitro backend into a single output directory:
dist/├── client/ # Static frontend assets (JS, CSS, images)└── server/ # Nitro server bundleRunning in Production
Section titled “Running in Production”After building, start the production server:
node dist/server/index.mjsOr use the npm script:
npm run startThe server will start on the port defined in your .env file (default: 3000).
Home Server Deployment
Section titled “Home Server Deployment”SparkFeed is perfect for a home server or Raspberry Pi. Here’s a minimal setup:
1. Clone and build on the server
Section titled “1. Clone and build on the server”git clone https://github.com/sparkfeed/sparkfeed.gitcd sparkfeednpm installnpm run db:migratenpm run build2. Start with PM2
Section titled “2. Start with PM2”npm install -g pm2pm2 start dist/server/index.mjs --name sparkfeedpm2 save3. Access from your local network
Section titled “3. Access from your local network”If your home server’s local IP is 192.168.1.100, you can access SparkFeed from any device on your network at:
http://192.168.1.100:3000VPS Deployment (Advanced)
Section titled “VPS Deployment (Advanced)”If you want to access SparkFeed from anywhere, you can deploy it to a VPS (DigitalOcean, Linode, Hetzner, etc.).
Caddy reverse proxy example
Section titled “Caddy reverse proxy example”# Caddyfilesparkfeed.yourdomain.com { reverse_proxy localhost:3000 basicauth * { youruser JDJhJDE0JG... # bcrypt hash of your password }}Environment Variables (Production)
Section titled “Environment Variables (Production)”Make sure your .env file is configured for production:
DATABASE_URL=./data/sparkfeed.dbPORT=3000NODE_ENV=production