# Publish the backend

Your NestJS, FastAPI, or Laravel backend runs as a Docker container on your server, together with the MySQL database, the uploads, and the helper services that belong to it.

> Source: https://www.application-platform.com/en/docs/publish-backend/

The pipeline builds a Docker image from your backend and deploys it to the [server]({{< relref "servers" >}}) of the project; for production you need a [domain]({{< relref "domain" >}}) for the API. The deploy flow is described in [Git workflow and deployment]({{< relref "git-workflow" >}}).

## What ships with the backend

The MySQL database runs as its own container on the same server, with its data stored under `./backend-mysql`. In the project configuration you enable phpMyAdmin and [Easy Backup]({{< relref "backups" >}}). Traefik forwards the API domain to the container, and the platform sets up HTTPS.

## Uploads

User uploads belong in `./upload` locally and in `/app/upload` inside the container. On the server, the deployment mounts `./backend-uploads` at this path. Multer, the FastAPI upload handler, or Laravel Storage must point to this path and not to directories such as `user-uploads` or `/app/uploads`. The generated Dockerfile creates the folder with `RUN mkdir -p upload`.

## Configuration and secrets per environment

The configuration per environment lives in the `gitops-configuration` repository under `configurations/`. The platform maintains `generated.yaml`, including hostnames, the registry, and encrypted secrets. You add your own environment variables to `custom.yaml` under `additional_env_variables`; a commit to `main` of this repository rolls them out. The details are in [Environment variables]({{< relref "environment-setup" >}}).

For sending email, you select a mail account from the **Connections** in the project, as described in [Email delivery]({{< relref "email-delivery" >}}).

## Your backend's addresses

| Environment | URL |
|-------------|-----|
| Dev | `backend.dev.<project>.<organization-domain>`, assigned automatically |
| Production | your own API domain from the project configuration |
| phpMyAdmin on dev | `phpmyadmin.dev.<project>.<organization-domain>` |

The platform shows the DNS records for the API domain in the domain detail; the steps are described in [Configure DNS]({{< relref "domain-how-to" >}}). A web app of the same project receives the backend URL through the generated env files ([Publish web apps]({{< relref "publish-web-apps" >}})).

Errors appear in your Sentry project once you enable Sentry for the component under **Features** ([Error tracking]({{< relref "error-tracking" >}})); how to take back a release is described in [Operations]({{< relref "operations" >}}).

