Skip to content

Configure the Environment

TT Time Tracker uses two environment files:

FileUsed by
.envVue frontend (Vite) — values are inlined at build time
.env.backendNestJS API and BullMQ worker — loaded at runtime

Client environment (.env)

Copy from .env.example:

bash
cp .env.example .env
VariableRequiredDefaultDescription
VITE_API_URLYeshttp://localhost:3000Base URL of the API. Change to your production API URL for production builds.
VITE_APP_VERSIONNo0.0.0Version string shown in the UI.
VITE_APP_BASE_URLNohttp://localhost:5173Public base URL of the client. Used for OAuth redirects.

WARNING

VITE_* variables are inlined at build time. If you change them, you must rebuild the frontend. They are visible in the compiled JavaScript — do not put secrets here.

Backend environment (.env.backend)

Copy from .env.backend.example:

bash
cp .env.backend.example .env.backend

Required

VariableDescription
DATABASE_URLPostgreSQL connection string, e.g. postgresql://tt:password@localhost:5432/tt?schema=public
POSTGRES_PASSWORDPassword for the postgres Docker container (must match DATABASE_URL)
REDIS_URLRedis connection string, e.g. redis://localhost:6379
BETTER_AUTH_SECRETSession signing secret. Generate with openssl rand -base64 32. Minimum 32 characters.
BETTER_AUTH_URLPublic URL of the API, e.g. http://localhost:3000. Used for OAuth redirect URIs.
RUSTFS_ACCESS_KEYAccess key for the S3-compatible file store.
RUSTFS_SECRET_KEYSecret key for the S3-compatible file store.

Google OAuth (required for login)

VariableDescription
GOOGLE_CLIENT_IDOAuth client ID from Google Cloud Console
GOOGLE_CLIENT_SECRETOAuth client secret

Create credentials at console.cloud.google.com → APIs & Services → Credentials → Create OAuth 2.0 Client. Set the authorized redirect URI to {BETTER_AUTH_URL}/api/auth/callback/google.

File storage

VariableDefaultDescription
RUSTFS_ENDPOINThttp://localhost:9000S3-compatible storage endpoint
RUSTFS_BUCKETtt-invoicesBucket name for invoice files

In production you can point this at AWS S3 or MinIO by changing RUSTFS_ENDPOINT and using the appropriate credentials.

Invoice OCR (optional)

VariableDescription
OPENAI_KEYOpenAI API key for extracting structured data from OCR text
GOOGLE_APPLICATION_CREDENTIALSPath to a GCP service account JSON file with Cloud Vision API access

Without these, uploaded invoices will remain in a pending state and no OCR extraction will occur.

Observability (optional)

All observability integrations are no-ops when their environment variables are unset — safe to skip in local development.

VariableDescription
SENTRY_DSNSentry DSN for backend (api + worker) error tracking
SENTRY_DSN_FRONTENDSentry DSN for frontend error tracking (returned via /config)

TT Time Tracker — Internal Documentation