Deployment Guide logo

Deployment Guide

Community
sabahattink
deployment-guide

Vercel frontend + Railway/Fly.io backend deployment, env vars, health checks. Use when deploying a Next.js frontend to Vercel or a NestJS backend to Railway or Fly.io, or troubleshooting a deployment issue.

Overview

Publishersabahattink
Repositoryantigravity-fullstack-hq
Skill namedeployment-guide
Stars
31
Forks
9
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by sabahattink on GitHub. Read the source before you install it.

Installation

Install the Deployment Guide AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/sabahattink/antigravity-fullstack-hq/tree/main/skills/deployment-guide
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/sabahattink/antigravity-fullstack-hq.git /tmp/antigravity-fullstack-hq
mkdir -p .claude/skills
cp -r /tmp/antigravity-fullstack-hq/skills/deployment-guide .claude/skills/deployment-guide
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Deployment Guide in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Deployment Guide on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Deployment Guide is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Deployment Guide

Frontend — Vercel

Setup

bash
# Install Vercel CLI
npm i -g vercel

# Login
vercel login

# Link project (run once in the project root)
vercel link

# Deploy to preview
vercel

# Deploy to production
vercel --prod

vercel.json

json
{
  "framework": "nextjs",
  "buildCommand": "pnpm run build",
  "installCommand": "pnpm install --frozen-lockfile",
  "outputDirectory": ".next",
  "regions": ["iad1"],
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "X-Frame-Options",        "value": "DENY" },
        { "key": "X-XSS-Protection",       "value": "1; mode=block" },
        { "key": "Referrer-Policy",        "value": "strict-origin-when-cross-origin" }
      ]
    },
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "Cache-Control", "value": "no-store, max-age=0" }
      ]
    },
    {
      "source": "/_next/static/(.*)",
      "headers": [
        { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
      ]
    }
  ],
  "rewrites": [
    {
      "source": "/api/:path*",
      "destination": "https://api.example.com/api/:path*"
    }
  ]
}

Vercel Environment Variables

bash
# Set env vars per environment
vercel env add NEXT_PUBLIC_API_URL production
vercel env add NEXT_PUBLIC_API_URL preview
vercel env add NEXT_PUBLIC_API_URL development

# Pull to local .env.local
vercel env pull .env.local

next.config.ts for Production

typescript
import type { NextConfig } from 'next'

const config: NextConfig = {
  output: 'standalone',

  // Strict mode catches side effects in development
  reactStrictMode: true,

  // Image optimization
  images: {
    domains: ['cdn.example.com', 'avatars.githubusercontent.com'],
    formats: ['image/avif', 'image/webp'],
  },

  // Bundle analyzer (install @next/bundle-analyzer)
  // ...(process.env.ANALYZE === 'true' && require('@next/bundle-analyzer')())

  // Security headers
  async headers() {
    return [
      {
        source: '/(.*)',
        headers: [
          { key: 'X-DNS-Prefetch-Control', value: 'on' },
        ],
      },
    ]
  },

  // Redirects
  async redirects() {
    return [
      { source: '/old-path', destination: '/new-path', permanent: true },
    ]
  },
}

export default config

Backend — Railway

Setup

bash
# Install Railway CLI
npm i -g @railway/cli

# Login
railway login

# Initialize (run in project root)
railway init

# Deploy
railway up

# Open dashboard
railway open

# View logs
railway logs

# Run commands in service
railway run pnpm run migration:run

railway.json

json
{
  "$schema": "https://railway.app/railway.schema.json",
  "build": {
    "builder":      "DOCKERFILE",
    "dockerfilePath": "apps/api/Dockerfile"
  },
  "deploy": {
    "startCommand": "node dist/main",
    "healthcheckPath": "/health/liveness",
    "healthcheckTimeout": 30,
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 3
  }
}

Required Environment Variables (Railway)

bash
# Set via Railway dashboard or CLI
DATABASE_URL    = ${{Postgres.DATABASE_URL}}   # Railway managed Postgres
REDIS_URL       = ${{Redis.REDIS_URL}}          # Railway managed Redis
NODE_ENV        = production
PORT            = ${{PORT}}                     # Railway injects this
JWT_SECRET      = <generate: openssl rand -base64 32>
CORS_ORIGINS    = https://your-app.vercel.app
LOG_LEVEL       = info

Backend — Fly.io (Alternative)

Setup

bash
# Install flyctl
curl -L https://fly.io/install.sh | sh

# Login
fly auth login

# Launch app (creates fly.toml)
fly launch --name my-api --region iad --no-deploy

# Deploy
fly deploy

# Scale
fly scale count 2
fly scale memory 512

# View logs
fly logs

# SSH into instance
fly ssh console

fly.toml

toml
app      = "my-api"
primary_region = "iad"

[build]
  dockerfile = "apps/api/Dockerfile"

[env]
  NODE_ENV  = "production"
  PORT      = "8080"

[http_service]
  internal_port = 8080
  force_https   = true
  auto_stop_machines  = true
  auto_start_machines = true
  min_machines_running = 1

  [http_service.concurrency]
    type       = "connections"
    hard_limit = 200
    soft_limit = 150

[[vm]]
  memory   = "512mb"
  cpu_kind = "shared"
  cpus     = 1

[checks]
  [checks.health]
    grace_period  = "30s"
    interval      = "15s"
    method        = "GET"
    path          = "/health/liveness"
    port          = 8080
    timeout       = "5s"
    type          = "http"

Health Check Endpoints

typescript
// health/health.controller.ts — must respond before traffic is routed

@Controller('health')
export class HealthController {
  constructor(
    private health:  HealthCheckService,
    private db:      TypeOrmHealthIndicator,
  ) {}

  // Liveness: is the process running?
  @Get('liveness')
  liveness() {
    return { status: 'ok', timestamp: new Date().toISOString() }
  }

  // Readiness: can we serve traffic?
  @Get('readiness')
  @HealthCheck()
  readiness() {
    return this.health.check([
      () => this.db.pingCheck('database', { timeout: 3000 }),
    ])
  }

  // Full check: all dependencies
  @Get()
  @HealthCheck()
  full() {
    return this.health.check([
      () => this.db.pingCheck('database'),
    ])
  }
}

Database Migrations on Deploy

typescript
// src/cli.ts — run as a separate Railway service or pre-deploy command
import { NestFactory } from '@nestjs/core'
import { MigrationModule } from './migration/migration.module'

async function runMigrations() {
  const app = await NestFactory.createApplicationContext(MigrationModule)
  const dataSource = app.get(DataSource)

  console.log('Running migrations...')
  const migrations = await dataSource.runMigrations()
  console.log(`Ran ${migrations.length} migrations`)

  await app.close()
  process.exit(0)
}

runMigrations().catch(err => {
  console.error('Migration failed:', err)
  process.exit(1)
})
json
// package.json
{
  "scripts": {
    "migration:run": "ts-node src/cli.ts",
    "start:prod": "node dist/main"
  }
}

Zero-Downtime Deployments

bash
# Railway: automatic rolling deployments (no config needed)
# Fly.io: rolling deployments with health checks

# Ensure your app handles SIGTERM gracefully
typescript
// main.ts — graceful shutdown
async function bootstrap() {
  const app = await NestFactory.create(AppModule)
  app.enableShutdownHooks()

  await app.listen(process.env.PORT ?? 3000)

  // Log when server is ready
  console.log(`API running on port ${process.env.PORT ?? 3000}`)
}

Environment Checklist

Production Environment Variables Checklist:
□ NODE_ENV=production
□ DATABASE_URL (managed service with connection pooling)
□ REDIS_URL (if using caching/sessions)
□ JWT_SECRET (min 32 chars, random)
□ CORS_ORIGINS (exact frontend domains, no wildcards)
□ LOG_LEVEL=info (not debug)
□ PORT (injected by platform)

Frontend:
□ NEXT_PUBLIC_API_URL (production backend URL)
□ No secrets in NEXT_PUBLIC_* vars (they're exposed to browser)

Forbidden Patterns

  • Never deploy with NODE_ENV=development in production
  • Never use the same JWT secret across environments
  • Never skip health check endpoints — platforms use them for traffic routing
  • Never run database migrations during app startup — run them as a separate step
  • Never put NEXT_PUBLIC_* values that are secrets — they're bundled into the browser
  • Never deploy without verifying the build passes CI first
  • Never use 0.0.0.0 as CORS_ORIGINS in production — specify exact origins

Frequently asked questions

What does the Deployment Guide AI skill do?

Vercel frontend + Railway/Fly.io backend deployment, env vars, health checks. Use when deploying a Next.js frontend to Vercel or a NestJS backend to Railway or Fly.io, or troubleshooting a deployment issue.

Why use Deployment Guide on TypingMind?

Because you install it once and use it with any model. Deployment Guide is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Deployment Guide in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/sabahattink/antigravity-fullstack-hq/tree/main/skills/deployment-guide. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Deployment Guide?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Deployment Guide?

As many as you like. As long as a model supports skills, you can use Deployment Guide with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Deployment Guide AI skill free?

Yes. It is published on GitHub by sabahattink under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇