Skip to main content
Deploy your ToughTongue AI application to production.

Environment Variables

Before deploying, ensure you have all required environment variables:
.env.local
# Required
TOUGH_TONGUE_API_KEY=your_api_key_here

# Development mode (disable in production)
NEXT_PUBLIC_IS_DEV=false

# Admin token (change for production!)
ADMIN_TOKEN=your_secure_admin_token

# Optional: Firebase (for Google OAuth)
NEXT_PUBLIC_FIREBASE_API_KEY=...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=...
NEXT_PUBLIC_FIREBASE_PROJECT_ID=...
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=...
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=...
NEXT_PUBLIC_FIREBASE_APP_ID=...
Important for production: - Set NEXT_PUBLIC_IS_DEV=false to disable the admin panel - Use a strong, unique ADMIN_TOKEN - Never commit .env.local to version control

1

Push to GitHub

Commit your code to a GitHub repository.
2

Import in Vercel

  1. Go to vercel.com/new 2. Import your repository 3. Set Root Directory to nextjs-minimal if using the monorepo structure
3

Add Environment Variables

In Project Settings → Environment Variables, add: - TOUGH_TONGUE_API_KEY = your API key - NEXT_PUBLIC_IS_DEV = false - ADMIN_TOKEN = your secure token - Firebase variables (if using)
4

Deploy

Click Deploy. Vercel will auto-deploy on future git pushes.

Vercel Project Settings

SettingValue
FrameworkNext.js (auto-detected)
Build Commandpnpm build
Output Directory.next
Install Commandpnpm install
Root Directorynextjs-minimal (if monorepo)

Custom Domain

After deployment, add a custom domain:
  1. Go to Project Settings → Domains
  2. Add your domain
  3. Update DNS records as instructed
  4. SSL is automatic

Other Platforms

Netlify

# Install Netlify CLI
npm install -g netlify-cli

# Build and deploy
cd nextjs-minimal
pnpm build
netlify deploy --prod
Add environment variables in Netlify dashboard.

Docker

FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install
COPY . .
RUN pnpm build

FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 3000
CMD ["npm", "start"]

Self-Hosted

# Build
pnpm build

# Start production server
pnpm start

# Or use PM2
pm2 start npm --name "ttai-app" -- start

Customization

App Branding

Edit lib/config.ts:
export const AppConfig = {
  app: {
    name: "Your App Name",
    shortName: "App",
    description: "Your app description",
  },
};

Scenario IDs

Update lib/ttai/constants.ts with your scenarios:
export const SCENARIOS = {
  PERSONALITY_TEST: "your_test_scenario_id",
  PERSONALITY_COACH: "your_coach_scenario_id",
  // Add more scenarios
  SALES_TRAINING: "your_sales_scenario_id",
} as const;

Styling

Customize the theme in tailwind.config.ts:
export default {
  theme: {
    extend: {
      colors: {
        primary: "#your-color",
      },
    },
  },
};

Production Checklist

Set NEXT_PUBLIC_IS_DEV=false
Use strong ADMIN_TOKEN
Verify TOUGH_TONGUE_API_KEY is correct
Configure Firebase authorized domains
Test all user flows
Monitor API usage in Developer Portal
Set up error monitoring (optional)

Troubleshooting

Check:
  • Root directory is set correctly (nextjs-minimal if monorepo)
  • All environment variables are added
  • No TypeScript errors: run pnpm build locally first
Solution: - Add your production domain to Firebase authorized domains - Go to Firebase Console → Authentication → Settings → Authorized domains
Check: - TOUGH_TONGUE_API_KEY is set in Vercel environment variables - API key has correct permissions - Check Vercel function logs for errors
Solution:
  • Ensure NEXT_PUBLIC_IS_DEV=false is set
  • Redeploy after changing environment variables

Learn More

API Reference

Full API documentation

Troubleshooting

Common issues and solutions

Developer Portal

Manage API keys and usage