Skip to main content

Overview

BudgetView is a Next.js application designed for deployment on modern hosting platforms. This guide covers production deployment, environment configuration, and best practices.
BudgetView is optimized for serverless deployment with automatic scaling and global CDN distribution.

Deployment Options

Vercel

Recommended platform with zero-config Next.js support and automatic CI/CD

Netlify

Alternative platform with similar features and generous free tier

Self-Hosted

Docker or Node.js deployment on your own infrastructure

Prerequisites

Before deploying, ensure you have:
1

Supabase Project

Active Supabase project with database and authentication configured
2

Git Repository

Source code pushed to GitHub, GitLab, or Bitbucket
3

Environment Variables

Supabase URL and API key from project settings
4

Domain Name

Custom domain for production (optional but recommended)

Initial Setup

1

Connect Repository

  1. Visit vercel.com and sign in
  2. Click “Add New Project”
  3. Import your Git repository
  4. Select the repository containing BudgetView
2

Configure Build Settings

Vercel auto-detects Next.js projects. Verify these settings:
  • Framework Preset: Next.js
  • Build Command: npm run build
  • Output Directory: .next (auto-detected)
  • Install Command: npm install
  • Node Version: 18.x or higher
3

Set Environment Variables

Add required variables in Vercel dashboard:
VariableValueSource
NEXT_PUBLIC_SUPABASE_URLhttps://xxxxx.supabase.coSupabase → Settings → API
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYeyJhbGc...Supabase → Settings → API → anon public
Use the anon key, NOT the service_role key for NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY.
4

Deploy

Click “Deploy” and wait for build completion (typically 2-3 minutes)
5

Verify Deployment

  1. Visit the generated URL (e.g., your-project.vercel.app)
  2. Test login functionality
  3. Create a test wallet and transaction
  4. Verify data appears in Supabase dashboard

Continuous Deployment

Vercel automatically deploys on Git push:
# Make changes and commit
git add .
git commit -m "Update dashboard UI"
git push origin main

# Vercel builds and deploys automatically
# View deployment at https://vercel.com/your-username/your-project
Branch deployments:
  • main branch → Production deployment
  • Feature branches → Preview deployments with unique URLs
  • Pull requests → Automatic preview comments

Custom Domain

Add a custom domain in Vercel:
1

Add Domain

  1. Go to project Settings → Domains
  2. Enter your domain (e.g., budgetview.com)
  3. Click “Add”
2

Configure DNS

Add DNS records at your domain registrar:
Type: A
Name: @
Value: 76.76.21.21

Type: CNAME
Name: www
Value: cname.vercel-dns.com
3

Verify Domain

Vercel automatically provisions SSL certificate (via Let’s Encrypt)

Netlify Deployment

Setup Instructions

1

Connect Repository

  1. Visit netlify.com and sign in
  2. Click “Add new site → Import an existing project”
  3. Choose your Git provider and repository
2

Build Configuration

Configure build settings:
netlify.toml
[build]
  command = "npm run build"
  publish = ".next"

[[plugins]]
  package = "@netlify/plugin-nextjs"
3

Environment Variables

Add in Site settings → Environment variables:
  • NEXT_PUBLIC_SUPABASE_URL
  • NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
4

Deploy

Click “Deploy site” and monitor build logs

Netlify-Specific Configuration

Create a netlify.toml file in your project root:
[build]
  command = "npm run build"
  publish = ".next"

[[plugins]]
  package = "@netlify/plugin-nextjs"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

[build.environment]
  NODE_VERSION = "18"

Self-Hosted Deployment

Using Node.js

Deploy directly on a VPS or dedicated server:
1

Install Dependencies

# On your server
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install -g pm2  # Process manager
2

Clone Repository

git clone https://github.com/your-username/budgetview.git
cd budgetview
npm install
3

Configure Environment

# Create .env.local file
cat > .env.local << EOF
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-anon-key
EOF
4

Build Application

npm run build
5

Start with PM2

pm2 start npm --name "budgetview" -- start
pm2 save
pm2 startup  # Enable auto-restart on server reboot
6

Configure Nginx

server {
  listen 80;
  server_name budgetview.com;
  
  location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}
Enable SSL with Certbot:
sudo certbot --nginx -d budgetview.com

Using Docker

Create a Dockerfile:
FROM node:18-alpine AS builder

WORKDIR /app

COPY package*.json ./
RUN npm ci

COPY . .
RUN npm run build

# Production image
FROM node:18-alpine AS runner

WORKDIR /app

ENV NODE_ENV=production

COPY --from=builder /app/package*.json ./
RUN npm ci --only=production

COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public

EXPOSE 3000

CMD ["npm", "start"]
Build and run:
# Build image
docker build -t budgetview:latest .

# Run container
docker run -d \
  -p 3000:3000 \
  -e NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co \
  -e NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-anon-key \
  --name budgetview \
  --restart unless-stopped \
  budgetview:latest
Docker Compose:
docker-compose.yml
version: '3.8'

services:
  budgetview:
    build: .
    ports:
      - "3000:3000"
    environment:
      - NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}
      - NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=${NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY}
    restart: unless-stopped
Start with:
docker-compose up -d

Environment Variables

Required Variables

The application will not function without these variables properly configured.
VariableRequiredDescriptionExample
NEXT_PUBLIC_SUPABASE_URLYesSupabase project URLhttps://abc123.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYYesSupabase anon public keyeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Optional Variables

VariableDefaultDescription
PORT3000Server port
NODE_ENVproductionEnvironment mode

Validating Configuration

The application checks for required environment variables on startup:
app/login/page.tsx
if (!process.env.NEXT_PUBLIC_SUPABASE_URL || 
    !process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY) {
  throw new Error("Variables de entorno de Supabase no configuradas")
}

Build Configuration

Next.js Config

The next.config.js file can be customized:
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  images: {
    domains: ['your-project.supabase.co'],
  },
  // Disable source maps in production for smaller bundles
  productionBrowserSourceMaps: false,
}

module.exports = nextConfig

Package.json Scripts

{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "eslint ."
  }
}

Performance Optimization

  • Enable SWC minification (default in Next.js 13+)
  • Use npm ci instead of npm install in CI/CD
  • Cache node_modules between builds
  • Disable source maps in production

Monitoring & Logging

Vercel Analytics

Enable in project settings:
  1. Go to Analytics tab
  2. Enable Web Analytics
  3. View real-time metrics: pageviews, unique visitors, top pages

Error Tracking

Integrate Sentry for error monitoring:
npm install @sentry/nextjs
sentry.client.config.js
import * as Sentry from '@sentry/nextjs'

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  environment: process.env.NODE_ENV,
  tracesSampleRate: 1.0,
})

Application Logs

For self-hosted deployments, use PM2 logs:
pm2 logs budgetview          # View live logs
pm2 logs budgetview --lines 100  # Last 100 lines
pm2 flush budgetview         # Clear logs

Database Migrations

Manage Supabase schema changes:
# Install Supabase CLI
npm install -g supabase

# Link to project
supabase link --project-ref your-project-ref

# Create migration
supabase migration new add_new_column

# Apply migration
supabase db push
Always test migrations in a development environment before applying to production.

Security Checklist

1

Environment Variables

✓ Never commit .env.local to Git
✓ Use different Supabase projects for dev/prod
✓ Rotate API keys if exposed
2

HTTPS

✓ Enable SSL certificate (automatic on Vercel/Netlify)
✓ Force HTTPS redirects
✓ Use HSTS headers
3

Database Security

✓ Row Level Security enabled on all tables
✓ Service role key never exposed to client
✓ Regular database backups
4

Authentication

✓ Email verification enabled (optional)
✓ Rate limiting on login attempts
✓ Strong password requirements

Troubleshooting

Rollback Strategy

If a deployment causes issues:
  1. Go to Deployments tab
  2. Find previous working deployment
  3. Click ⋯ → Promote to Production
  4. Instant rollback (no rebuild required)

Backup & Disaster Recovery

Always maintain backups of your database and environment configuration.

Database Backups

Supabase Pro plan includes automatic daily backups. For manual backups:
# Export database
supabase db dump -f backup-$(date +%Y%m%d).sql

# Restore from backup
supabase db reset --db-url postgresql://...

Code Backups

  • Git repository serves as source code backup
  • Tag production releases: git tag v1.0.0
  • Push to multiple remotes for redundancy

Production Checklist

Before going live:
  • Environment variables configured
  • SSL certificate active
  • Database RLS policies tested
  • Error tracking enabled
  • Backup strategy in place
  • Custom domain configured (optional)
  • Analytics enabled
  • Performance tested under load
  • Authentication flows verified
  • Email templates customized (Supabase)

For architecture details, see the System Architecture page.

Build docs developers (and LLMs) love