Skip to main content

Environment variables

None of these are needed for backend: { type: 'local' } in development.

Identity

VariableRequired forWhere it comes from
COPY_INK_GITHUB_CLIENT_IDSign-inAn OAuth App, or a GitHub App's client credentials
COPY_INK_GITHUB_CLIENT_SECRETSign-inThe same app

Without both, GET /auth/signin fails with CONFIG_INVALID and copy-ink doctor reports oauth-credentials.

The app's callback URL must be https://your-site.com/api/copy-ink/auth/callback — or the same path under a custom apiPath.

Sessions

VariableRequired forWhere it comes from
COPY_INK_SESSION_SECRETSessions that outlive one processopenssl rand -base64 32

Set it on anything serverless, or anything running more than one instance — which is most production hosting. Without it sessions live in one process's memory, so a client is signed out the moment a request lands somewhere else. copy-ink doctor reports session-secret when it is missing.

The same value has to be set everywhere the site runs, and changing it signs everyone out. See Sessions.

Committing

Pick one of the two groups.

VariableWhere it comes from
COPY_INK_GITHUB_APP_IDThe App's settings page
COPY_INK_GITHUB_PRIVATE_KEYA generated private key, PEM format
COPY_INK_GITHUB_INSTALLATION_IDThe installation's settings URL

The App needs one repository permission: Contents: Read and write. Install it on the single repository named by backend.repo.

COPY_INK_GITHUB_PRIVATE_KEY is a multi-line PEM. Keep the newlines when pasting it into a host's environment UI, or store it base64-encoded and decode it before handing it over.

Personal access token

VariableWhere it comes from
COPY_INK_GITHUB_TOKENA fine-grained PAT with Contents: write on the repo

A PAT works as a ContentBackend but never as auth — a shared token cannot identify who made a change. copy-ink doctor warns (pat-backend) when one is in use. It is a reasonable choice for a staging environment and a poor one for a site a client edits.

If neither group is present, setupCopyInk throws CONFIG_INVALID on the first publish attempt and doctor reports github-credentials.

Standard Node variables

VariableEffect
NODE_ENV=productionDisables the local auth provider unconditionally, whatever the config says
NO_COLORTurns off CLI colour

Local development

.env.local
# Nothing at all — this is the point of the local backend.
copy-ink.config.ts
backend: { type: 'local' }

Outside production, the local backend installs a local auth provider that signs you straight in. No App, no OAuth credentials, no allowlist check.

A production .env

COPY_INK_GITHUB_CLIENT_ID=Iv1.0123456789abcdef
COPY_INK_GITHUB_CLIENT_SECRET=
COPY_INK_SESSION_SECRET=
COPY_INK_GITHUB_APP_ID=123456
COPY_INK_GITHUB_INSTALLATION_ID=12345678
COPY_INK_GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----

-----END RSA PRIVATE KEY-----"

Verify with:

npx copy-ink doctor

against the deployed environment, not your laptop.