Server Configuration
Relevant source files
The following files were used as context for generating this wiki page:Server configuration for the Traduora platform is primarily managed through environment variables. These variables control various aspects of the application, including database connections, user signup capabilities, default user creation, and data seeding. This allows for flexible deployment across different environments like Docker, Kubernetes, or from source.
The configuration options are crucial for both initial setup and ongoing maintenance. They dictate how the API server behaves on startup, particularly concerning initial data population and security settings. For more details on deployment, see the Deployment documentation.
Sources: README.md:80-82, docs-website/sidebars.json:3
Environment Variables
The application's behavior is configured using environment variables. These can be set in the shell, a .env file, or through the deployment environment's configuration management system.
Sources: README.md:100-108, api/package.json:23-28
General Configuration
| Variable | Description | Default Value |
|---|---|---|
TR_SIGNUPS_ENABLED | Controls whether new user signups are enabled. If false, a default admin user is required. | true (inferred) |
TR_SEED_DATA | If set to true, automatically runs seed scripts during application startup. | false (inferred) |
TR_DEFAULT_SEED_ONLY | When TR_SEED_DATA is true, this limits seeding to only the default admin user. | false (inferred) |
TR_CORS_ENABLED | Enables Cross-Origin Resource Sharing (CORS) for the API. Useful for development. | false (inferred) |
TR_MAIL_DEBUG | Enables debug mode for mail services. | false (inferred) |
TR_ACCESS_LOGS_ENABLED | Enables or disables access logging for the API. | true (inferred) |
TR_DB_DATABASE | Specifies the database name, particularly for testing environments. | tr_e2e (for e2e tests) |
TR_DEFAULT_PROJECT_PLAN | Sets the code for the default plan assigned to new projects. | default (for e2e tests) |
Sources: README.md:96-126, api/package.json:23-28
Default Admin User Configuration
When user signups are disabled (TR_SIGNUPS_ENABLED=false), a default admin user is created to ensure access to the platform. The credentials for this user can be customized using the following environment variables.
| Variable | Description | Default Value |
|---|---|---|
TR_ADMIN_EMAIL | The email address for the default admin user. | local.admin@ever.co |
TR_ADMIN_PASSWORD | The password for the default admin user. | sTr0ngP@ssw0rd!2025 |
TR_ADMIN_NAME | The name of the default admin user. | Admin |
Sources: README.md:104-108
Data Seeding
Traduora includes a data seeding mechanism to populate the database with initial data. This is primarily used to create a default admin user but can also include other demo data.
Sources: README.md:112-126, api/package.json:31-32
Seeding Process
The seeding process can be triggered automatically at startup or manually via yarn scripts. The TR_SEED_DATA environment variable controls the automatic execution at startup.
The following diagram illustrates the data seeding flow:
This diagram shows how environment variables control which, if any, seed scripts are executed when the application starts.
Sources: README.md:112-126, api/package.json:31-32
Manual Seeding
You can manually trigger the seeding process using yarn scripts from the monorepo root or the api package directory.
- Seed Default Admin Only: Creates only the default administrative user. This is useful for a clean production or staging setup.
# From monorepo root or ./api directory yarn seed:default - Seed All Data: Runs all seed scripts, which includes the default admin user and other demonstration data.
# From monorepo root or ./api directory yarn seed
Sources: README.md:115-126, package.json:28-29, api/package.json:31-32
Project Plan Configuration
Projects in Traduora are associated with a plan that can define limits, such as the maximum number of translation strings.
Default Project Plan
The TR_DEFAULT_PROJECT_PLAN environment variable is used to specify the plan assigned to new projects. In the testing environment, this is set to default, which has a limit of 100 strings. If an import or term creation would exceed this limit, the API returns a 402 Payment Required error.
The ProjectPlanDTO defines the structure of a plan object returned by the API.
// From api/src/domain/http.ts
export class ProjectPlanDTO {
@ApiProperty()
code: string;
@ApiProperty()
name: string;
@ApiProperty()
maxStrings: number;
@ApiProperty()
date: AccessDatesDTO;
}
Sources: api/package.json:28, api/test/project-plan.e2e-spec.ts:22-29, 131-139, api/src/domain/http.ts:100-109
The following sequence diagram shows the process of adding a term and the system checking it against the project's plan limits.
This diagram illustrates how the API validates that adding new terms does not exceed the maxStrings limit defined in the project's current plan.
Sources: api/test/project-plan.e2e-spec.ts:131-154, api/test/import.e2e-spec.ts:273-278