챕터
6. 배포

Deployment: Launching to the World

Learning Objectives

  • Understand the difference between local and deployed environments
  • Learn basic Git and GitHub usage
  • Deploy frontend with Vercel
  • Deploy backend with Railway
  • Connect a custom domain

6.1 What is Deployment?

Local vs Deployed

AspectLocalDeployed
Addresslocalhost:3000linkhub.com
AccessOnly your computerAnyone worldwide
ExecutionComputer must be on24/7 automatic
DataStored on your computerStored in the cloud

Services We'll Use

  • Vercel - Frontend deployment (free, Next.js optimized)
  • Supabase - Database (already in use)

6.2 Git Basics

To deploy, you need to upload your code to GitHub. Git is a tool for managing code versions.

Git Basic Concepts

  • Repository - Where the project is stored
  • Commit - A unit for saving changes
  • Push - Upload local commits to the remote

Uploading to GitHub

  1. Create a New Repository on GitHub.com
  2. In your terminal:
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/username/linkhub.git
git push -u origin main

Tip

Ask Claude "How do I upload this project to GitHub?" and it will walk you through it step by step.


6.3 Frontend Deployment - Vercel

Step 1: Sign Up for Vercel

  1. Go to vercel.com
  2. Click "Continue with GitHub"
  3. Link your GitHub account

Step 2: Deploy Your Project

  1. Click "Add New..." → "Project"
  2. Select your GitHub repository
  3. Framework: Next.js auto-detected
  4. Set environment variables (important!)
  5. Click "Deploy"

Environment Variable Setup

Add the same variables from your local .env.local in Settings → Environment Variables:

NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
NEXT_PUBLIC_APP_URL=https://linkhub.com
💡

Auto Deployment

Every time you push to GitHub, Vercel automatically deploys the new version. Just modify → commit → push!


6.4 Backend Deployment - Railway (Optional)

Use Railway when you need a custom API server or background jobs (cron jobs, image processing, etc.). LinkHub uses Supabase Realtime so a separate WebSocket server isn't needed, but you may need a backend server as your service grows.

Step 1: Sign Up for Railway

  1. Go to railway.app
  2. Sign up with GitHub

Step 2: Deploy Your Project

  1. "New Project" → "Deploy from GitHub repo"
  2. Select your server repository
  3. Set root directory (if the server folder is separate)
  4. Set environment variables
  5. Deployment complete!

Domain Setup

Generate a Railway domain via Settings → Networking → Generate Domain, or connect a Custom Domain.


6.5 Connecting a Custom Domain

Buying a Domain

Places to buy domains:

  • Namecheap - Affordable .com domains
  • Cloudflare - Cost-price sales, easy DNS management
  • Google Domains - Simple interface

DNS Basics

RecordPurposeExample
ADomain → IP addresslinkhub.com → 123.45.67.89
CNAMEDomain → Another domainwww → linkhub.com

Using Subdomains

You can split subdomains by purpose:


6.6 Post-Deployment Checklist

💡

Required Checks

  • All pages accessible
  • Login/logout working properly
  • DB connection working (data save/retrieve)
  • WebSocket connection working
  • No missing environment variables
  • HTTPS confirmed (lock icon)
  • Works on mobile too

Common Issues

IssueCauseSolution
Page not loadingMissing env varsCheck environment variables in Vercel
API errorsWrong backend URLCheck NEXT_PUBLIC_SOCKET_URL
Can't loginRedirect URL errorCheck Supabase Auth settings
DB connection failedRLS policy issueCheck Supabase policies

6.7 Checking Logs

The ability to check logs when errors occur is a key skill for solving problems on your own.

Vercel Logs

  1. Vercel Dashboard → Select project
  2. Deployments tab → Click recent deployment
  3. Check real-time logs in the Functions tab
  4. Errors are shown in red

Railway Logs

  1. Railway Dashboard → Select project
  2. Click service → Logs tab
  3. View real-time log streaming
  4. Filter specific errors with search

Reading Logs

Log TypeMeaningAction
INFONormal operation recordCan ignore
WARNWarning (still works)Check later
ERRORError occurredCheck immediately
500 Internal Server ErrorServer code issueCheck code
404 Not FoundPath doesn't existCheck URL, routing
401/403Auth/permission issueCheck token, permissions

Ask AI About Logs

Copy the entire error log and ask Claude "Analyze this error log and tell me the solution" - most issues get resolved this way. It's perfectly fine if you can't read logs yourself!


6.8 Deployment Troubleshooting

CORS / Origin Issues

CORS errors occur when frontend and backend domains are different.

// Express server
import cors from 'cors';
 
app.use(cors({
  origin: ['https://linkhub.com', 'https://www.linkhub.com'],
  credentials: true,
}));

Railway WebSocket Timeout

Railway has a default 60-second timeout. WebSocket requires keepalive settings.

// Client side
const socket = io(SERVER_URL, {
  pingInterval: 25000,
  pingTimeout: 60000,
});

6.9 Operations and Monitoring

Error Tracking: Sentry

Collect frontend and backend errors in real-time.

npm install @sentry/nextjs

Key Metrics Monitoring

MetricMeaningNormal Range
Active usersDAU/MAUCheck growth trend
Page load timeProfile page response speed< 2 seconds
Click rateLink clicks / page viewsService engagement
Error rate500 error ratio< 1%

6.10 Other Deployment Options

Besides Vercel and Railway, there are various deployment platforms available.

Frontend Deployment Options

ServiceFeaturesFree TierRecommended For
VercelNext.js optimized100GB/monthWhen using Next.js (recommended)
NetlifyJAMstack specialized100GB/monthStatic sites, when Forms needed
Cloudflare PagesEdge deployment, fastUnlimitedWhen global speed matters
AWS AmplifyAWS ecosystemFree tierAWS service integration
GitHub PagesCompletely freeUnlimitedSimple static sites

Backend Deployment Options

ServiceFeaturesFree TierRecommended For
RailwayEasy setup, WebSocket support$5/month creditQuick deployment
RenderSimple, auto-scaling750 hours/monthRailway alternative
Fly.ioEdge deployment, Docker-based3 shared VMsWhen global deployment needed
CoolifySelf-hosted PaaSFree (own server)When full control wanted
DigitalOcean App PlatformStable, predictable costs$0 (static)When budget management important

Netlify (Frontend)

Strong for static sites and serverless functions.

Deploy Next.js project to Netlify.
Include netlify.toml config file.
# netlify.toml
[build]
  command = "npm run build"
  publish = ".next"
 
[[plugins]]
  package = "@netlify/plugin-nextjs"

Cloudflare Pages (Frontend)

Served from edge locations worldwide, extremely fast.

Deploy Next.js project to Cloudflare Pages.
Use @cloudflare/next-on-pages.

Cloudflare Advantages

  • Unlimited bandwidth
  • Global edge deployment
  • DDoS protection included
  • Run serverless functions with Workers

Render (Backend)

Similar to Railway but often rated as more stable.

Deploy Node.js WebSocket server to Render.
Include render.yaml config file.
# render.yaml
services:
  - type: web
    name: linkhub-server
    env: node
    buildCommand: npm install && npm run build
    startCommand: npm start
    envVars:
      - key: NODE_ENV
        value: production

Fly.io (Backend)

Deploy Docker containers to edge locations worldwide.

Deploy Node.js server to Fly.io.
Include Dockerfile and fly.toml config.
# fly.toml
app = "linkhub-server"
primary_region = "nrt"  # Tokyo
 
[http_service]
  internal_port = 3000
  force_https = true

Coolify (Self-hosted)

Build a Vercel/Railway-like environment on your own server.

Install Coolify on my server.
Then deploy the LinkHub project.

All-in-One Options

ServiceFeaturesPrice
SupabaseDB + Auth + Storage + Edge FunctionsFree~$25/month
FirebaseGoogle all-in-oneFree~usage-based
ConvexDB + Real-time + ServerlessFree~$25/month

Which One Should You Choose?

SituationFrontendBackend
Easiest startVercelRailway
Minimize costsCloudflare PagesRender (free tier)
Global speedCloudflare PagesFly.io
AWS ecosystemAmplifyAWS Lambda
Full controlCoolifyCoolify
💡

Vibe Coding Tip

Deployment platforms are relatively easy to switch later. Start with Vercel + Railway, then optimize as traffic grows.


Chapter Summary

  • Learned Git and GitHub basics
  • Deployed frontend with Vercel
  • Deployed backend with Railway
  • Connected a custom domain
  • Completed post-deployment checks
  • Learned how to check logs
  • Explored various deployment options

In the next chapter, we'll add payments to start generating revenue!

Chapter 7: Monetization →