vercel setup - nself-org/nchat GitHub Wiki

Vercel Deployment Setup - Complete Guide

This document provides an overview of the Vercel deployment infrastructure created for nchat.

Created: 2026-01-31 Status: Ready for Deployment


What Was Created

1. Configuration Files

/vercel.json

Optimized Vercel configuration with:

  • Next.js framework preset
  • pnpm package manager
  • Security headers (CSP, X-Frame-Options, etc.)
  • Cache control for API routes and static assets
  • Clean URLs and trailing slash handling
  • Function timeout configuration

/.vercelignore

Excludes unnecessary files from deployment:

  • Backend services (.backend/)
  • Development files (tests, docs, etc.)
  • Build artifacts
  • IDE and OS files
  • CI/CD configurations

2. Documentation

/docs/guides/deployment/vercel-deployment.md (16KB)

Comprehensive deployment guide covering:

  • Why Vercel?
  • Prerequisites
  • Quick start with one-click deploy
  • Manual deployment steps
  • Environment variables setup (required and optional)
  • Backend configuration (Nhost Cloud vs self-hosted)
  • Custom domain setup
  • Deployment monitoring
  • 10 Common Issues with Solutions
  • Advanced configuration
  • Cost estimation
  • Post-deployment checklist

/docs/guides/deployment/README.md

Quick reference guide with:

  • Links to all deployment guides
  • Deployment options comparison table
  • Backend requirements
  • Quick start instructions

/docs/guides/deployment/DEPLOYMENT-CHECKLIST.md (6KB)

Production deployment checklist with:

  • Pre-deployment checklist (8 sections, 50+ items)
  • Vercel-specific checklist
  • Post-deployment verification
  • Ongoing maintenance schedule
  • Troubleshooting quick links

3. In-App Helper Components

/src/components/admin/deployment/VercelDeployButton.tsx (19KB)

Interactive deployment wizard featuring:

  • One-click "Deploy to Vercel" button
  • Step-by-step accordion guide (5 steps)
  • Environment variable reference with copy buttons
  • Status indicators for configured variables
  • Links to documentation and resources
  • Backend setup options (Nhost vs self-hosted)
  • Visual progress tracking

Key Features:

  • Checks if environment variables are set
  • Copy-to-clipboard for env var examples
  • Expandable/collapsible step guide
  • External links to Vercel, Nhost, GitHub
  • Responsive design with Radix UI components

/src/components/admin/deployment/DeploymentStatusChecker.tsx (13KB)

Real-time health monitoring dashboard:

  • Overall health status with progress bar
  • Service health checks:
    • Frontend status
    • GraphQL API connectivity
    • Authentication service
    • Storage service
    • Database accessibility
  • Deployment information:
    • Environment
    • Region
    • Version
    • Commit SHA
    • Build time
  • Auto-refresh functionality
  • Health status indicators (healthy/degraded/unhealthy)
  • Warning alerts for dev mode and issues

/src/components/admin/deployment/index.ts

Export file for deployment components

4. Admin Panel Integration

/src/app/admin/deployment/page.tsx

Admin deployment page with:

  • Tabbed interface:
    • "Deploy to Vercel" tab
    • "Deployment Status" tab
  • Full integration with admin layout
  • Metadata for SEO

Updated /src/components/admin/admin-sidebar.tsx

  • Added "Deployment" navigation item with Rocket icon
  • Positioned between "Advanced" and "Settings"
  • Requires owner role
  • Highlighted in sidebar when active

Updated /src/components/admin/index.ts

  • Exported deployment components for easy imports

How to Use

For Beginners: One-Click Deployment

  1. Access Admin Panel

    Login as owner → /admin/deployment
    
  2. Click "Deploy to Vercel"

    • Opens Vercel with pre-configured settings
    • Repository, env vars, and project name pre-filled
  3. Add Environment Variables

    • Copy examples from the UI
    • Paste into Vercel dashboard
    • Configure backend URLs (Nhost or self-hosted)
  4. Deploy

    • Click "Deploy" in Vercel
    • Wait 2-3 minutes
    • Visit your new deployment URL
  5. Monitor Status

    • Switch to "Deployment Status" tab
    • View real-time health checks
    • Verify all services are healthy

For Developers: Manual Deployment

  1. Read the Guide

    /docs/guides/deployment/vercel-deployment.md
    
  2. Install Vercel CLI

    pnpm install -g vercel
    vercel login
  3. Deploy

    cd /path/to/nself-chat
    vercel
  4. Configure Environment

    • Add env vars in Vercel dashboard
    • Or use vercel env add
  5. Deploy to Production

    vercel --prod

Environment Variables Required

Critical (Must Set)

Variable Description Example
NEXT_PUBLIC_USE_DEV_AUTH Disable dev auth false
NEXT_PUBLIC_APP_URL Your deployment URL https://nchat.vercel.app
NEXT_PUBLIC_GRAPHQL_URL Hasura endpoint https://api.project.nhost.run/v1/graphql
NEXT_PUBLIC_AUTH_URL Auth service https://auth.project.nhost.run/v1/auth
NEXT_PUBLIC_STORAGE_URL Storage service https://storage.project.nhost.run/v1/storage

Optional (Recommended)

Variable Description
NEXT_PUBLIC_SENTRY_DSN Error tracking
NEXT_PUBLIC_GA_ID Google Analytics
GOOGLE_CLIENT_ID Google OAuth
GITHUB_CLIENT_ID GitHub OAuth

See full list in deployment guide.


File Structure

nself-chat/
├── .vercelignore                          # Deployment exclusions
├── vercel.json                            # Vercel configuration
├── VERCEL-DEPLOYMENT-SETUP.md             # This file
├── docs/
│   └── guides/
│       └── deployment/
│           ├── README.md                  # Quick reference
│           ├── vercel-deployment.md       # Full guide (60KB)
│           └── DEPLOYMENT-CHECKLIST.md    # Production checklist
└── src/
    ├── app/
    │   └── admin/
    │       └── deployment/
    │           └── page.tsx               # Deployment page
    └── components/
        └── admin/
            ├── deployment/
            │   ├── VercelDeployButton.tsx           # Deploy wizard
            │   ├── DeploymentStatusChecker.tsx      # Health monitor
            │   └── index.ts                         # Exports
            ├── admin-sidebar.tsx          # Updated with nav
            └── index.ts                   # Updated exports

Features

Deployment Helper Features

  • ✅ One-click deploy button
  • ✅ Step-by-step visual guide
  • ✅ Environment variable reference
  • ✅ Copy-to-clipboard for examples
  • ✅ Required vs optional variable indicators
  • ✅ Backend setup options (Nhost vs self-hosted)
  • ✅ Links to documentation and resources
  • ✅ Status tracking for configured variables

Health Monitoring Features

  • ✅ Real-time service health checks
  • ✅ Frontend status
  • ✅ GraphQL API connectivity test
  • ✅ Authentication service check
  • ✅ Storage service check
  • ✅ Database accessibility via GraphQL
  • ✅ Overall health percentage
  • ✅ Deployment information (version, region, commit)
  • ✅ Auto-refresh functionality
  • ✅ Visual status indicators
  • ✅ Warning alerts for issues

Documentation Features

  • ✅ Beginner-friendly language
  • ✅ Screenshots and examples
  • ✅ Troubleshooting section (10+ common issues)
  • ✅ Backend configuration guide
  • ✅ Custom domain setup
  • ✅ Cost estimation
  • ✅ Deployment checklist (50+ items)
  • ✅ Ongoing maintenance schedule

Troubleshooting Quick Reference

Build Fails

  • Check package.json has "packageManager": "[email protected]"
  • Ensure pnpm-lock.yaml exists

Auth Not Working

  • Set NEXT_PUBLIC_USE_DEV_AUTH=false
  • Verify NEXT_PUBLIC_AUTH_URL is correct

GraphQL Errors

  • Check NEXT_PUBLIC_GRAPHQL_URL
  • Test URL in browser/Postman
  • Verify CORS settings in backend

Images Not Loading

  • Verify NEXT_PUBLIC_STORAGE_URL
  • Configure CORS for storage service

See full troubleshooting guide in /docs/guides/deployment/vercel-deployment.md#troubleshooting


Next Steps

  1. Review the Documentation

    • Read /docs/guides/deployment/vercel-deployment.md
    • Review /docs/guides/deployment/DEPLOYMENT-CHECKLIST.md
  2. Prepare Backend

    • Set up Nhost project OR deploy nself backend
    • Get GraphQL, Auth, and Storage URLs
  3. Deploy

    • Login as owner → /admin/deployment
    • Click "Deploy to Vercel"
    • Configure environment variables
    • Deploy!
  4. Monitor

    • Check "Deployment Status" tab
    • Verify all services are healthy
    • Test application functionality
  5. Configure

    • Run setup wizard
    • Customize branding
    • Invite team members

Support


Technical Details

Technologies Used

  • Next.js 15.5.10: React framework
  • Vercel: Deployment platform
  • Radix UI: Component primitives
  • Tailwind CSS: Styling
  • Lucide Icons: Icon system

Component Dependencies

// VercelDeployButton.tsx
import { Button, Card, Badge, Alert, Accordion } from '@/components/ui'

// DeploymentStatusChecker.tsx
import { Button, Card, Badge, Alert, Progress, Separator } from '@/components/ui'

Environment Detection

// Checks if running in dev mode
const isDevMode = process.env.NEXT_PUBLIC_USE_DEV_AUTH === 'true'

// Checks if env var is set
const isSet = Boolean(process.env[varName])

Health Check Logic

// Tests GraphQL connectivity
fetch(graphqlUrl, {
  method: 'POST',
  body: JSON.stringify({ query: '{ __typename }' }),
})

// Tests service endpoints
fetch(`${authUrl}/healthz`)

Changelog

2026-01-31 - Initial Release

  • Created Vercel deployment configuration
  • Added comprehensive deployment guide (60KB)
  • Built in-app deployment helper components
  • Integrated with admin panel
  • Added health monitoring dashboard
  • Created deployment checklist
  • Updated admin navigation

Status: ✅ Ready for Production Deployment Tested: Local development environment Platform: Vercel (recommended) Difficulty: Beginner-friendly

⚠️ **GitHub.com Fallback** ⚠️