Architecture Overview
Relevant source files
The following files were used as context for generating this wiki page:Ever® Traduora is an open-source translation management platform designed for teams. Its architecture is based on a modern web stack, structured as a monorepo to manage its distinct components: a backend API, a frontend web application, and a documentation website. This separation allows for clear boundaries between the presentation layer, business logic, and data persistence.
The system provides a REST API for managing translation workflows, including importing and exporting translations in various formats. The frontend is a single-page application (SPA) that consumes this API to provide a rich user interface for translation management. The entire project is managed using Yarn workspaces and Lerna, facilitating development and dependency management across the different packages.
Sources: README.md:16-22, package.json:80-86, lerna.json:10
Monorepo Structure
The project is organized as a monorepo, which is a single repository containing multiple distinct projects with well-defined relationships. This is managed by Lerna and Yarn Workspaces.
Sources: lerna.json:2,10, package.json:80-86
The main packages within the monorepo are:
| Package | Description | Source |
|---|---|---|
api | The NestJS-based backend server that provides the REST API. | package.json:82, api/package.json:2 |
webapp | The Angular-based frontend single-page application (SPA). | package.json:81, webapp/package.json:2 |
docs-website | The Docusaurus-based documentation website. | package.json:83, docs-website/package.json:2 |
This diagram illustrates the package structure within the monorepo.
Source: package.json:80-86
The lerna.json file configures Lerna to use Yarn as the npm client and defines the location of the packages.
{
"lerna": "4.0.0",
"npmClient": "yarn",
"version": "0.21.0",
"packages": ["api", "webapp", "docs-website"],
"useWorkspaces": true
}
Sources: lerna.json:2-11
Core Components
The application is composed of two primary runtime components: the backend API and the frontend web application.
Backend API (api)
The backend is a Node.js application built with the NestJS framework. It is responsible for all business logic, data persistence, and exposing a RESTful API for the frontend and external clients.
Key technologies used in the API include:
- Framework: NestJS
- Database/ORM: TypeORM, supporting databases like PostgreSQL, MySQL, and SQLite.
- Authentication: JWT (JSON Web Tokens) via Passport.js.
- Validation:
class-validatorandclass-transformer. - API Documentation:
@nestjs/swaggerfor generating OpenAPI specifications.
Sources: api/package.json:50-77
The API handles core features such as user management, project creation, translation term management, and the import/export of translation files in various formats (e.g., jsonflat, properties, xliff).
Frontend Web Application (webapp)
The frontend is a Single-Page Application (SPA) built with Angular. It provides the user interface for interacting with the Traduora platform.
Key technologies used in the webapp include:
- Framework: Angular
- State Management: NGXS
- UI Components: Bootstrap and ng-bootstrap
- Routing:
@angular/router
Sources: webapp/package.json:34-51
The webapp is built into a set of static files (html, css, js) which are served to the user's browser. The build process is defined in webapp/angular.json and outputs the final assets to the dist/public directory.
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "../dist/public",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json"
}
}
Sources: webapp/angular.json:11-20
High-Level System Architecture
The overall architecture follows a classic client-server model. The Angular webapp acts as the client, making HTTP requests to the NestJS api server. The server processes these requests, interacts with a database for data persistence, and returns responses to the client.
This diagram shows the interaction between the main components of the system.
API Interaction Example: Importing Translations
A common workflow is importing a translation file. The user uploads a file through the webapp, which sends a request to the api. The api then parses the file, creates or updates terms and translations in the database, and returns a summary of the operation.
The following sequence diagram illustrates the import process.
Build and Development
The root package.json contains scripts for managing the monorepo. lerna is used to run commands across the packages in parallel.
Key scripts include:
"build": "concurrently --raw \"yarn build:api\" \"yarn build:webapp\" \"yarn build:docs\"": Builds all three packages concurrently."start:api": "cross-env yarn --cwd ./api start": Starts the API server in development mode."start:web": "cross-env yarn --cwd ./webapp start": Starts the web application's development server."seed": Populates the database with initial data, useful for development and testing.
Sources: package.json:23-32