# Structural architecture

The following diagram shows how data and requests flow within the Tonic Structural application:

![Tonic Structural architecture](/files/brsdJarVzqM6urhlJYTv)

## Structural application database

The Structural application database is a PostgreSQL database that stores the workspace and Structural configuration.

The configuration includes:

* The users that have administrative access to the Structural instance.
* Configuration of the workspaces in the Structural instance. Each workspace includes:
  * Data connections
  * Users and roles
  * Generation configuration (table modes, generators, subsetting)
  * Post-job actions
  * Job tracking

For a [file connector](/app/setting-up-your-database/file-connector.md) workspace that uses files uploaded from a local file system, the Structural application database stores the encrypted source files. It also stores the generated destination files.

## Workspace source database and destination location

Each workspace is connected to a source database and a destination location. Depending on the workspace, the destination location might be a database, a Tonic Ephemeral data snapshot, a container repository, or a file system.

The source database contains the original data. We recommend that you use a static copy of your production database that was restored from a backup.

The destination location contains the results of the Structural data generation.&#x20;

Source databases and destination locations are almost always external to the Structural application, including for Structural Cloud. Databases are always in the customer environment. For a file connector workspace that uses local files, the destination location is the Structural application database.

However, Structural must be able to read from the source database and write to the destination location.

## Structural components

Each of the components below can have one or more containers.

### Structural web server

Runs the Structural user interface. It also runs scans to ascertain the structure of the source data, including the [scans to detect schema changes](/app/generation/schema-changes.md).

The web server displays preview data from the source database, and pulls the configuration from the application database.

The web server also receives and processes requests and calls from the Structural API.

The web server also handles the migration of the Structural database when a new Structural version makes changes to it.

### Structural notification

Sends email notifications to notify users about comments on source database columns. The commenting feature requires an enterprise tier license.

The notification component also processes Structural [webhooks](/app/workflows/webhooks.md). Webhooks perform specific actions when a data generation job completes, fails, or is canceled.

### Structural worker

A Structural instance can have multiple workers. Additional workers allow you to process multiple jobs at the same time.

Structural workers run [sensitivity scans](/app/generation/identify-sensitive-data/running-the-structural-sensitivity-scan.md). During a sensitivity scan, Structural looks for specific types of sensitive information in the source database. For details, go to [Built-in sensitivity types that Structural detects](/app/generation/identify-sensitive-data/sensitivity-types-built-in.md).

The workers also [run data generation](/app/workflows/data-generation-run-job.md). The data generation process pulls data from the source database and applies the configured generators and subsetting. The configuration is in the application database.

The workers write the resulting data to the destination location.

## SMTP server

The SMTP server processes the notifications sent by the Structural notification component.

## Securing Structural communication

All of the following communication uses TLS encryption:

* Between Structural components.
* Between Structural components and the application database.
* Between the notification component and the SMTP server.

TLS encryption also is used by default to encrypt communication between Structural and the source and destination.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/admin/architecture-diagram.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
