logo
Custom Server Environment

Deployment

Server Deployment

This guide covers building and deploying the ProShot application on your server using PM2, a production process manager for Node.js. Make sure you have completed all previous steps (environment variables, database, payment gateways, etc.) before deploying.

Upload the Codebase

Create a directory for the application and upload the source code:

mkdir -p /var/www/framecast-ai

Upload the ProShot source code to /var/www/framecast-ai using scp, rsync, or your server's file manager. If you are using Git:

cd /var/www/framecast-ai
git clone https://your-repo-url.git .

Make sure your .env file is placed in the root of this directory with all the environment variables configured from the previous steps.

Install Dependencies

Navigate to the project directory and install all dependencies using pnpm:

cd /var/www/framecast-ai
pnpm install

Always use pnpm as the package manager. The project includes a pnpm-lock.yaml file that ensures consistent dependency versions. Using npm or yarn may result in different dependency resolutions and unexpected behavior.

Build the Application

Run the production build:

pnpm build

This compiles the Next.js application and generates the optimized production output. The build also generates the Pagefind search index via the postbuild script automatically.

Install PM2

Install PM2 globally to manage the application process:

pnpm add -g pm2

Start the Application

Start the application using PM2:

pm2 start pnpm --name "framecast-ai" -- start

This starts the Next.js production server on port 3000, which Nginx (configured in the Getting Started guide) will reverse proxy to your domain.

Verify the application is running:

pm2 status

Configure Auto Restart

Save the PM2 process list and configure it to start automatically on server reboot:

pm2 save
pm2 startup

PM2 will output a command that you need to copy and run. This registers a systemd service so the application starts automatically when the server restarts.

Verify Deployment

Open your browser and visit https://your-domain.com. You should see the ProShot landing page.

ProShot — Landing Page

Useful PM2 commands for ongoing management:

pm2 logs framecast-ai    # View application logs
pm2 restart framecast-ai # Restart the application
pm2 stop framecast-ai    # Stop the application
pm2 monit                # Real time monitoring dashboard

Your ProShot instance is now live and fully functional on your custom server.