# gt-node: General Translation Node.js SDK: Configuring gt-node
URL: https://generaltranslation.com/en-US/docs/node/guides/configuring.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: How to initialize General Translation gt-node with locales, credentials, and translation delivery.

`gt-node` is configured entirely through the [`initializeGT`](/docs/node/reference/functions/initialize-gt) call you make once at startup. This guide covers what to pass and how translations are delivered.

*Note: Unlike `gt-next`, `gt-node` does not read `gt.config.json` automatically — import that file explicitly to share its locale settings with the runtime. It does read `GT_PROJECT_ID`, `GT_API_KEY`, and `GT_DEV_API_KEY` as credential fallbacks.*

## Initialize at startup [#initialize]

Call [`initializeGT`](/docs/node/reference/functions/initialize-gt) once, before any request is handled, with your locales and credentials.

```ts title="server.js"
import { initializeGT } from 'gt-node';

initializeGT({
  defaultLocale: 'en',
  locales: ['en', 'es', 'fr'],
});
```

To keep values in sync with the CLI, import your `gt.config.json` and spread its fields into the call.

## Add credentials [#credentials]

Set your project ID and API keys in the environment where the service runs. [`initializeGT`](/docs/node/reference/functions/initialize-gt) uses them when you omit the matching fields:

```bash
export GT_PROJECT_ID="your-project-id"
export GT_DEV_API_KEY="gtx-dev-..."
export GT_API_KEY="gtx-api-..."
```

Values passed directly to [`initializeGT`](/docs/node/reference/functions/initialize-gt) take precedence over environment variables. An empty explicit value falls back to the environment value.

In development, a project ID and development API key enable on-demand translation and hot reload, so new strings translate as you work. In production, translations come from your pre-generated files or the CDN. See the [Configuration reference](/docs/node/reference/config) for every option.

## Choose how translations are delivered [#delivery]

`gt-node` resolves translations in one of these modes:

- **General Translation CDN:** provide a `projectId` (without a custom loader) to fetch translations from GT's CDN.
- **Local files:** provide a [`loadTranslations`](/docs/react/reference/functions/load-translations) callback that returns translations for a locale. See [Storing translations locally](/docs/node/guides/storing-translations).
- **Custom endpoint:** set a custom `cacheUrl` to load from your own host, or `null` to disable remote loading.

## Handle missing translations [#missing]

When a translation is missing, `gt-node` returns the source string interpolated with your variables rather than throwing, so a request always renders. Dictionary lookups via [`getTranslations`](/docs/node/reference/functions/get-translations) are the exception: an unknown dictionary id throws. Keep [`initializeGT`](/docs/node/reference/functions/initialize-gt) values aligned with what the CLI generates so production has translations ready.

## Next steps

- /docs/node/guides/translating-strings
- /docs/node/guides/detecting-locale
- /docs/node/guides/storing-translations

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
