config module provides centralized access to environment variables and configuration validation for the AnimeThemes Web application.
Import
Configuration Constants
Server-side Only
These environment variables are only available on the server:SERVER_API_URL
ANIMETHEMES_API_URL environment variable.
ANALYZE
ANALYZE environment variable.
MINIMAL_BUILD
MINIMAL_BUILD environment variable.
Usage Example:
AUTH_REFERER
AUTH_REFERER environment variable.
Client-side + Server-side
These environment variables are available on both client and server (prefixed withNEXT_PUBLIC_):
CLIENT_API_URL
NEXT_PUBLIC_API_URL environment variable.
Usage Example:
VIDEO_URL
NEXT_PUBLIC_VIDEO_URL environment variable.
Usage Example:
AUDIO_URL
NEXT_PUBLIC_AUDIO_URL environment variable.
AUTH_PATH
NEXT_PUBLIC_AUTH_PATH environment variable.
Usage Example:
BASE_PATH
NEXT_PUBLIC_BASE_PATH environment variable.
Usage Example:
STAGING
NEXT_PUBLIC_STAGING environment variable.
VERBOSE_LOGS
NEXT_PUBLIC_VERBOSE_LOGS environment variable.
Usage Example:
PAGINATION_PAGE_SIZE
NEXT_PUBLIC_PAGINATION_PAGE_SIZE environment variable.
Usage Example:
Functions
validateConfig
boolean-trueif configuration is valid,falseif critical configuration is missing
- Error: At least one of
SERVER_API_URLorCLIENT_API_URLmust be specified - Warning: If only
SERVER_API_URLis specified, client-side API requests won’t work - Warning: Missing
VIDEO_URLwill prevent videos from playing - Warning: Missing
AUDIO_URLwill prevent audios from playing - Warning: Missing
AUTH_PATHshould be fixed in production
Environment Variables Reference
| Variable | Type | Required | Description |
|---|---|---|---|
ANIMETHEMES_API_URL | string | Yes* | Server-side API URL |
NEXT_PUBLIC_API_URL | string | Yes* | Client-side API URL |
NEXT_PUBLIC_VIDEO_URL | string | Recommended | Video files base URL |
NEXT_PUBLIC_AUDIO_URL | string | Recommended | Audio files base URL |
NEXT_PUBLIC_AUTH_PATH | string | Production | OAuth authentication path |
AUTH_REFERER | string | Optional | Auth request referer |
NEXT_PUBLIC_BASE_PATH | string | Optional | Application base path |
NEXT_PUBLIC_STAGING | boolean | Optional | Staging mode flag |
NEXT_PUBLIC_VERBOSE_LOGS | boolean | Optional | Verbose logging flag |
NEXT_PUBLIC_PAGINATION_PAGE_SIZE | number | Optional | Default page size |
ANALYZE | boolean | Optional | Bundle analysis flag |
MINIMAL_BUILD | boolean | Optional | Minimal build flag |
See Also
- Configuration Guide - Environment variables guide
- GraphQL Layer - How the API client uses these values