# Backend

Learn what the Platforma Backend does and how you can run it.

```mermaid
flowchart TB
  subgraph user["Users"]
    clients["Clients<br/>Desktop App, pl-cli"]:::program
  end
  subgraph company["Infrastructure of the company or cloud account"]
    backend["Backend<br/>projects of all users"]:::program
    jobs["Jobs<br/>bioinformatics tools"]:::job
    storage[("Primary storage<br/>results, uploads<br/>(read and write)")]:::storage
    libs[("Data libraries<br/>input data<br/>(read only)")]:::storage
  end
  subgraph mil["MiLaboratories services (a company can use mirrors of the registries)"]
    softreg["Software registries"]:::registry
    lic(["License and monitoring services"]):::service
  end
  clients -->|requests| backend
  backend -->|starts| jobs
  backend <--> storage
  backend -.->|reads| libs
  backend -->|"gets tools (internet)"| softreg
  backend -->|"license, usage records only in Kubernetes (internet)"| lic
  classDef program fill:#e4f5d8
  classDef job fill:#fdf2c4
  classDef storage fill:#d9f2ea
  classDef registry fill:#e4dcf8
  classDef service fill:#fbe1e6
```

**Diagram:** The Backend is in the infrastructure of the company or in a cloud account. It keeps the projects of all users. Users work with the Backend through clients. A client can be the Desktop App, or pl-cli, the command-line client that manages users and projects. The clients send requests to the Backend. The Backend starts jobs that run bioinformatics tools. It reads and writes results and uploads in the primary storage. It only reads input data from the data libraries. Over the internet, the Backend gets tools from the software registries and checks its license with the license service of MiLaboratories. In a Kubernetes installation, the Backend also sends usage records to the monitoring service of MiLaboratories when the license allows them. An installation in Single Server mode does not send usage records. A company can use mirrors of the registries.

The Backend (The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs.) is the server program of Platforma. Clients connect to it: the Desktop Apps of you and your colleagues, and pl-cli (The command-line client of Platforma. Administrators use it to manage users and projects on the Backend.), the command-line client that administrators use to manage users and projects. The Backend does the work for all of them:

- It keeps the projects of all users in its database, and makes regular backups of it. The primary storage belongs to your company, and your company backs it up.
- It runs the Blocks (A small application for one step of an analysis, for example the import of reads or clustering. It can combine several tools.) and starts their jobs (One run of a tool on data. The Backend starts jobs on the server where it runs, or in a Kubernetes cluster.).
- It finds computations that already ran and reuses their results, so you do not wait for the same computation twice. Reuse does not give anyone access to the projects or results of other users.
- It keeps the results in the primary storage (The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files.).
- It reads input data from data libraries (A folder or bucket with input data of the company. Users select files from it in the Desktop App. Platforma only reads it.).
- It identifies the users and controls what each user can do.

## License

The Backend needs a license from MiLaboratories. The license is issued for your company: the Backend uses it to start and to run computations. All users who connect to the Backend share the limits of this license. The terms and the limits of a license are agreed with MiLaboratories.

The Backend checks the license over the internet, so it needs a connection to the internet. Without a valid license, it does not run analyses.

If the corporate network has restricted access to the internet, your company can use mirrors of the registries, and the Backend can work through the proxy server of your company. The connection to the license service is still necessary.

## Where it runs

```mermaid
flowchart LR
  subgraph envs["Environments where the Backend runs"]
    k8s["Kubernetes<br/>in a Kubernetes cluster"]
    single["Server<br/>in Single Server mode"]
    aws["AWS<br/>in an Amazon Web Services account"]
    gcp["Google Cloud<br/>in a Google Cloud project"]
  end
```

**Diagram:** The Backend can run in these environments: - in a Kubernetes cluster; - in Single Server mode; - in an Amazon Web Services (AWS) account; - in a Google Cloud project.

You can install the Backend in a Kubernetes (A system that runs programs on a group of machines (a cluster). Platforma can run in a Kubernetes cluster.) cluster, in Single Server mode (The mode in which the Backend and all its jobs run on one Linux machine, the server, with no Kubernetes cluster.), in AWS or in Google Cloud. Under these, there are two execution environments: a Kubernetes cluster and Single Server mode. In AWS and Google Cloud, the Backend runs in a Kubernetes cluster of that cloud. There are four installation paths: an installer, the Terraform modules (The Terraform code that MiLaboratories provides to install Platforma. The cloud-specific Terraform modules make the cluster and its cloud parts in AWS or Google Cloud; the cloud-agnostic Terraform modules install Platforma into the cluster.), the Helm chart and the Single Server installation path (A set of tools and steps that installs Platforma. There are five installation paths: the AWS installer, the Google Cloud installer, the Terraform modules, the Helm chart and Single Server mode.). For what each way fits, see [Installation paths](/plan-choose-installation-path/#installation-paths).

The two environments differ in how many jobs can run in parallel. Single Server mode runs only as many jobs at the same time as its own CPUs (The compute units of a node or of the server, as Kubernetes and the operating system count them. A job asks for a number of CPUs. The cloud quotas call them vCPUs.) and memory allow. A Kubernetes cluster spreads the jobs over many machines, so it can run many more jobs in parallel.

The operator (The person who installs and runs Platforma in your company, for example an IT engineer or a bioinformatician.) installs new versions of the Backend. In a Kubernetes cluster, the jobs that run continue during an upgrade.

## Users

```mermaid
flowchart LR
  subgraph access["Sign-in providers of the Backend"]
    sso["SSO<br/>single sign-on with the identity provider of the company"]
    ldap["LDAP<br/>the company directory"]
    list["User list<br/>a static list of users"]
  end
```

**Diagram:** Sign-in providers of the Backend: - single sign-on (SSO) with the identity provider of the company; - the company directory (LDAP); - a static list of users.

You sign in (To show the Backend who you are, with a sign-in provider or a single-user token. The verb is "sign in"; the noun and the adjective are "sign-in".) to the Backend from the Desktop App (The program that each user installs on their own computer to work with Platforma. It is a client of the Backend.), in one of these ways:

- single sign-on (Sign-in through the identity service of the company, with the same account as for other company systems.) (SSO) with the identity provider of your company;
- the company directory (LDAP (The directory of users of a company. The Backend can check logins and passwords in it.));
- a static list of users (A sign-in provider that is a file with the logins and the password hashes of the users, in the htpasswd format. The Backend reads it again when it changes.).

pl-cli signs in with the same providers: with SSO in the browser, or with a login and a password.

You see your own projects and the projects that colleagues share with you. Administrators manage the Backend and have access to all projects.

## Data integrations

```mermaid
flowchart LR
  subgraph storage["Kinds of storage of the Backend"]
    s3[("Amazon S3<br/>and storage that is compatible with S3")]
    gcs[("Google Cloud Storage<br/>GCS")]
    fs[("File systems<br/>FS")]
  end
```

**Diagram:** Kinds of storage that the Backend works with: - Amazon S3 and storage that is compatible with S3; - Google Cloud Storage (GCS); - file systems (FS). With single sign-on, the Backend can access shared storage on behalf of each user.

The Backend keeps your projects. It keeps the results and the uploaded files in the primary storage, and reads input data from data libraries without changing them.

The Backend works with these kinds of storage:

- Amazon S3 and storage that is compatible with S3;
- Google Cloud Storage (GCS);
- file systems (FS).

When you sign in with single sign-on (SSO), your company can let the Backend access the data in shared storage on your behalf. Then the access rules of the storage itself control which data you can open, the same as in other systems of your company.

## Next

- [How Platforma works](/overview-how-platforma-works/)
- [Choose an installation path](/plan-choose-installation-path/)
- [Security overview](/security-overview/)
- [Outbound connections](/security-outbound-connections/)

Source: https://docs.platforma.bio/overview-backend/
