General Translation  
Next.jsTutorials

Deploy to Production (5m)

Let's deploy your Next.js app with GT.

Overview

This is a short tutorial to help you deploy your Next.js app with GT.

We will do this in 2 steps:

Add your production API keys.

Add the translate command to your build script.

Prerequisites

Make sure that you have followed the Quick Start Guide to set up your Next.js app with GT.

Step 1: Add your production API keys 🔑

Add your production API key and Project ID to your production environment variables.

From your dashboard, go to API Keys in the sidebar. Click on Create API Key, and add them to your production envrionment.

GT_API_KEY="YOUR_GT_API_KEY"
GT_PROJECT_ID="YOUR_GT_PROJECT_ID"

Protect Your API Keys!

Production keys should only ever be used in production. Likewise, development keys should only ever be used in development. Never commit your API keys to a public repository!

Step 2: Add the translate command to your build script 🏗️

The next step is to add the translate command to your build script, and specify the locales that you would like to ship to production.

package.json
{
  "scripts": {
    "build": "npx gt-next-cli translate --locales pt es && <YOUR_BUILD_COMMAND>"
  }
}

Here, we have added Portuguese and Spanish to our configuration.

That's it! You are now ready to deploy your Next.js with GT!


Next steps

On this page