--- title: 2. Penpot Configuration desc: Learn about self-hosting, configuration via environment variables, and authentication providers. Try Penpot - It's free! See Penpot's technical guide. --- # Penpot Configuration This section explains the configuration options, both for self-hosting and developer setup.
Penpot is configured using environment variables and flags.
## How the configuration works Penpot is configured using environment variables and flags. **Environment variables** start withPENPOT_. **Flags** use the format
- .
Flags are used to enable/disable a feature or behaviour (registration, feedback),
while environment variables are used to configure the settings (auth, smtp, etc).
Flags and environment variables are also used together; for example:
```bash
# This flag enables the use of SMTP email
PENPOT_FLAGS: [...] enable-smtp
# These environment variables configure the specific SMTP service
# Backend
PENPOT_SMTP_HOST: enable-email-whitelist flag. For backward compatibility, we
autoenable it when PENPOT_REGISTRATION_DOMAIN_WHITELIST is set with
not-empty content.
Penpot also comes with an option to disable public registration. Users with a
valid and active team invitation can still register an account when password
login is enabled. The invitation must still exist in the database and its
validity period must not have ended. To disable public registration, use the
following flag:
```bash
PENPOT_FLAGS: [...] disable-registration
```
For invitation-based registration, keep the password login flag enabled:
```bash
PENPOT_FLAGS: [...] disable-registration enable-login-with-password
```
The `disable-login-with-password` flag still disables password-based login and
registration, including password-based registration through an invitation.
This option is only recommended for demo instances, not for production environments.
### Authentication Providers
To configure the authentication with third-party auth providers you will need to
configure Penpot and set the correct callback of your Penpot instance in the auth-provider
configuration.
Append `api/auth/oidc/callback` to the public URL with a single `/` between
them. Register the exact URL, including any configured subpath:
- Public URL `https://mycompany.com/`: `https://mycompany.com/api/auth/oidc/callback`
- Public URL `https://mycompany.com/penpot/`: `https://mycompany.com/penpot/api/auth/oidc/callback`
If you configure [trusted alternate origins](#trusted-alternate-origins), register
the callback for each alias as well.
#### Google
Allows integrating with Google as OAuth provider:
```bash
PENPOT_FLAGS: [...] enable-login-with-google
# Backend only:
PENPOT_GOOGLE_CLIENT_ID: For self-hosted and containerized deployments, the autodiscovered OIDC endpoints are not always enough. Some providers expose browser-facing endpoints through a public hostname while the Penpot backend must reach the same provider through an internal/container-resolvable hostname. In that case, explicitly set the OIDC endpoint overrides above so the browser can use the public authorization endpoint while the backend uses reachable token, userinfo, and JWKS endpoints.
If the backend needs to contact the OIDC provider through a hostname not already allowed by SSRF protection, add it to: ```bash # Backend # Space separated list of allowed hosts PENPOT_SSRF_ALLOWED_HOSTS: "enable-account-lockout flag:
```bash
PENPOT_FLAGS: [...] enable-account-lockout
```
When enabled, Penpot locks an existing account after 5 failed password or LDAP
login attempts within 15 minutes. It only applies to the password and LDAP
logins; OIDC and the other authentication providers are not affected. The
defaults can be changed with:
```bash
# Backend
PENPOT_LOGIN_LOCKOUT_MAX_ATTEMPTS: 5
PENPOT_LOGIN_LOCKOUT_WINDOW: 15m
```
While the account is locked, login returns HTTP 429 with a `Retry-After`
header and a JSON error with the code `account-locked` and the remaining
seconds in `ttl`.
Redis must be available. If Redis fails, login continues without lockout
checks. This feature prevents repeated password guessing, but anyone who knows
an email address can lock that account by failing the configured number of
attempts.
## Penpot URI
You will need to set the PENPOT_PUBLIC_URI environment variable in case you go to serve Penpot to the users;
it should point to public URI where users will access the application:
```bash
# Backend
PENPOT_PUBLIC_URI: https://penpot.mycompany.com
# Frontend
PENPOT_PUBLIC_URI: https://penpot.mycompany.com
# Exporter
PENPOT_PUBLIC_URI: https://penpot.mycompany.com
```
If you're using the official docker-compose.yml you only need to configure the
PENPOT_PUBLIC_URI envvar in the top of the file.
### Serve Penpot from a subpath
Penpot can be served from a subpath such as `https://mycompany.com/penpot/`.
Set `PENPOT_PUBLIC_URI` to the complete public URL, including the subpath and its
trailing slash:
```bash
PENPOT_PUBLIC_URI: https://mycompany.com/penpot/
```
Your reverse proxy or Ingress must also:
- Route requests under `/penpot/` to the Penpot frontend without rewriting the
path. The frontend expects to receive the subpath.
- Preserve WebSocket upgrade headers for notifications and other services that
use WebSockets.
#### Migrate an existing installation to a subpath
Moving an installation from `/` to a subpath does not require a database or
asset migration. Users, teams, projects, files, and uploaded assets remain in
the existing storage.
Before changing the public URL:
1. Back up the database, assets, and current deployment configuration.
2. Configure the proxy or Ingress route for the subpath.
3. Update `PENPOT_PUBLIC_URI` for every Penpot component that uses it.
4. Keep the existing `PENPOT_SECRET_KEY`, database, and asset storage
configuration.
5. Restart or redeploy Penpot and verify login, static assets, API requests,
WebSockets, file editing, and image uploads through the new URL.
Existing bookmarks and integrations that use the previous root URL must be
updated. You may also configure a redirect from the previous URL. If the scheme
or hostname changes in addition to the path, review your authentication provider
callback URLs and cookie settings. Active users may need to sign in again.
After upgrading, register the callback with the subpath at the identity provider
even when the scheme and hostname stay the same. For example, register
`https://mycompany.com/penpot/api/auth/oidc/callback` for
`https://mycompany.com/penpot/`.
If you plan to serve Penpot under different domain than `localhost` without HTTPS, you need to disable the `secure` flag on cookies, with the `disable-secure-session-cookies` flag. This is a configuration NOT recommended for production environments; as some browser APIs do not work properly under non-https environments, this unsecure configuration may limit the usage of Penpot; as an example, the clipboard does not work with HTTP.
### Trusted alternate origins Use `PENPOT_TRUSTED_ORIGINS` to serve the same Penpot installation on more than one domain with a single frontend and a common backend. Give both services the same list of aliases. With the official Docker Compose file, set the canonical URL in the `x-uri` block. The separate `x-trusted-origins` block passes the alias list only to the frontend and backend: ```yaml x-uri: &penpot-public-uri PENPOT_PUBLIC_URI: https://mycompany.com/penpot/ x-trusted-origins: &penpot-trusted-origins PENPOT_TRUSTED_ORIGINS: "${PENPOT_TRUSTED_ORIGINS:-}" ``` Set the alias once in your environment or Compose `.env` file: ```dotenv PENPOT_TRUSTED_ORIGINS=https://alt.mycompany.com ``` Set up DNS and TLS for both names. Configure your reverse proxy or Ingress to route `https://mycompany.com/penpot/` and `https://alt.mycompany.com/penpot/` to the same frontend, without rewriting the path. Follow the [subpath proxy requirements](#serve-penpot-from-a-subpath) for both names. This setting does not configure the proxy or share browser sessions between the two domains. **Only list aliases you control.** Penpot can put the alias in sensitive links, such as password reset links. Use HTTPS in production. - Separate entries with commas or whitespace. Each is a bare HTTP(S) origin (`scheme://host[:port]`): no path (not even a trailing slash), query, fragment, credentials, or wildcard. Matching ignores case and surrounding whitespace. HTTPS with or without `:443` matches the same origin, as does HTTP with or without `:80`. Other ports must match exactly. For IPv6, use the origin as the browser reports it, without a path. For example, use `https://[::1]:9443`, not `https://[0:0:0:0:0:0:0:1]:9443`. - At startup, the backend warns about and ignores invalid entries. It also logs one warning if the list contains any valid HTTP origin whose hostname is not `localhost`. Those HTTP entries still work; they do not change the secure session cookie flags. - The frontend container writes the list to the existing `config.js` as data. At startup, the frontend uses the browser's origin if it matches the list; otherwise it keeps the canonical URL. On a match, only the scheme, host, and port change. Navigation, assets, and API calls keep the path and trailing slash from the configured base. - The frontend sends `X-Penpot-Origin` only on Penpot API calls that need to select the public base, including RPC reads that may lack `Origin` and OIDC login requests. It does not add the header to general HTTP requests for fonts, assets, or external URLs. The backend uses `X-Penpot-Origin` if it matches the list, then tries `Origin`. If neither matches, it uses `PENPOT_PUBLIC_URI`. Generated links keep the configured path. - This list does not grant cross-origin browser access. With `enable-cors`, `PENPOT_ALLOWED_ORIGINS` separately controls which origins may make CORS requests. Listing an origin in either setting does not add it to the other. Register the exact OIDC callback URL for the canonical base and for each alias at the identity provider. For example, with `PENPOT_PUBLIC_URI` set to `https://mycompany.com/penpot/` and `https://alt.mycompany.com` in the list, register both `https://mycompany.com/penpot/api/auth/oidc/callback` and `https://alt.mycompany.com/penpot/api/auth/oidc/callback`. If you use SSO logout, register the post-logout redirect URL as well. The OIDC callback reuses the origin from the signed login state and combines it with the configured path. Removing an alias does not invalidate state already signed with it; that state expires within four hours. The backend can still redirect the user to the removed alias, but if the frontend no longer accepts it, the user may need to start a new login on the canonical domain. Changing the configured path during a login can also require a new login. MCP OAuth always uses the canonical base. Server-sent events (SSE) keep the full base of the request that opened the stream. An export requested through a trusted alias saves the full base in the job's parameters for the download link. Without an alias, the export worker uses its canonical base. Templated emails save the request's base in the template data and the worker uses it when it renders the email. Workers that build new links without a saved request base use the canonical `PENPOT_PUBLIC_URI`, as do server-to-server calls with no matching origin. #### Upgrade or roll back the `binfile` workers Before enabling aliases, upgrade every worker that consumes the `binfile` queue. Older workers whose export job schema does not accept `public-uri` reject jobs that store an alternate public base. To roll back to those workers, first disable aliases on the frontend and all backend instances that accept requests so no new jobs store an alternate base. Keep the upgraded workers running until all queued or running export jobs with a saved alternate base have finished. Removing an alias does not change jobs already submitted. #### Retire an alternate domain 1. Remove the alias from `PENPOT_TRUSTED_ORIGINS` on the frontend and backend, and apply the new configuration on all instances. Direct users to the canonical URL for new logins and links. 2. Review pending mail in Penpot and any downstream mail queues. Stop delivery of sensitive links to the retired domain where possible, and reissue links from the canonical URL if users still need them. Queued mail can still contain the old base after you change the setting. 3. Keep control of the old domain until any sensitive links and in-flight OIDC logins that reference it are no longer valid. Removing the alias does not revoke links or signed state. Cancel invitations you need to invalidate rather than waiting for them to expire. For flows without a supported way to invalidate an individual link, such as password recovery or email verification, wait for the token to expire. Check the lifetime for each flow; there is no single safe waiting period for all links. ## Email configuration By default,smtp flag is disabled, the email will be
printed to the console, which means that the emails will be shown in the stdout.
Note that if you plan to invite members to a team, it is recommended that you enable SMTP
as they will need to login to their account after receiving the invite link sent in an email.
There is one exception: with the `disable-email-verification` flag set, inviting an email
that already has a profile adds that user to the team directly, without sending any
invitation email and without requiring acceptance. Emails without an existing profile
still follow the normal invitation flow. See the
[`disable-email-verification` flag][11] description for more detail.
If you have an SMTP service, uncomment the appropriate settings section in
docker-compose.yml and configure those
environment variables.
Setting up the default FROM and REPLY-TO:
```bash
# Backend
PENPOT_SMTP_DEFAULT_REPLY_TO: Penpot
Because of the above, enforce with the default policy
suits deployments that do not use plugins. Anywhere else it needs a policy of your own.
PENPOT_SECRET_KEY envvar serves a master key from which other keys
for subsystems (eg http sessions, or invitations) are derived.
If you don't use it, all created sessions and invitations will become invalid on container restart
or service restart.
To use it, we recommend using a truly randomly generated 512 bits base64 encoded string here.
You can generate one with:
```bash
python3 -c "import secrets; print(secrets.token_urlsafe(64))"
```
And configure it:
```bash
# Backend
PENPOT_SECRET_KEY: my-super-secure-key
```
### Session expiration
__Since version 2.19.0__
User sessions are stored server-side and expire on two independent conditions: an
**idle timeout** and an **absolute maximum lifetime**. Both are backend only.
```bash
# Backend
# Idle timeout: the session stops working after this much inactivity.
# Default: 168h
PENPOT_AUTH_TOKEN_COOKIE_MAX_AGE: 168h
# Absolute maximum lifetime from the moment the session was created,
# regardless of activity. Default: 720h
PENPOT_AUTH_TOKEN_COOKIE_MAX_AGE_ABSOLUTE: 720h
```
Durations use the `fs and s3 (for AWS S3).
__Since version 2.11.0__
The configuration variables related to storage has been renamed, `PENPOT_STORAGE_ASSETS_*` are now `PENPOT_OBJECTS_STORAGE_*`.
`PENPOT_ASSETS_STORAGE_BACKEND` becomes `PENPOT_OBJECTS_STORAGE_BACKEND` and its values now are `fs` and `s3` instead of `assets-fs` or `assets-s3`.
#### FS Backend (default)
This is the default backend when you use the official docker images and the default
configuration looks like this:
```bash
# Backend
PENPOT_OBJECTS_STORAGE_BACKEND: fs
PENPOT_OBJECTS_STORAGE_FS_DIRECTORY: /opt/data/objects
```
The main downside of this backend is the hard dependency on nginx approach to serve files
managed by an application (not a simple directory serving static files). But you should
not worry about this unless you want to install it outside the docker container and
configure the nginx yourself.
In case you want understand how it internally works, you can take a look on the [nginx
configuration file][4] used in the docker images.
#### AWS S3 Backend
This backend uses AWS S3 bucket for store the user uploaded objects. For use it you should
have an appropriate account on AWS cloud and have the credentials, region and the bucket.
This is how configuration looks for S3 backend:
```bash
# Backend
AWS_ACCESS_KEY_ID: These settings are equally useful if you have a Minio storage system.
### File Data Storage __Since version 2.11.0__ You can change the file data storage backend with `PENPOT_FILE_DATA_BACKEND` environment variable. Possible values are: - `db`: the default. Stores the file data on an specific table. - `storage`: stores the file data using the objects storage system (S3 or FS, depending on which one is configured) The `legacy-db` value is still accepted as a **read-only** alias for the payloads written by versions before 2.11.0: the backend reads them, but it no longer writes file data there. **If you upgrade a deployment with `PENPOT_FILE_DATA_BACKEND=legacy-db`, remove the variable (or set it to `db`) before the upgrade**: the backend reads `legacy-db` as `db` and logs a warning, so saves keep working, but remove the variable anyway so the deployment does not claim a read-only backend. This also comes with an additional feature that allows offload the "inactive" files on file storage backend and leaves the database only for the active files. To enable it, you should use the `enable-tiered-file-data-storage` flag and `db` as file data storage backend. ```bash # Backend PENPOT_FLAGS: [...] enable-tiered-file-data-storage PENPOT_FILE_DATA_BACKEND: db ``` Once enabled, the offload job moves one file per run inside a single transaction: it locks the file row (skipping the run while the file is being edited) and migrates every live data row to the objects storage. You can follow it with `penpot_file_data_offload_rows_total` and `penpot_file_data_offload_bytes_total` (label `type="main|snapshot|fragment"`) and `penpot_file_data_offload_timing_ms` (label `result="ok|skip|error"`). ### Autosave By default, Penpot stores manually saved versions indefinitely; these can be found in the History tab and can be renamed, restored, deleted, etc. Additionally, the default behavior of on-premise instances is to not keep automatic version history. This automatic behavior can be modified and adapted to each on-premise installation with the corresponding configuration.You need to be very careful when configuring automatic versioning, as it can significantly impact the size of your database. If you configure automatic versioning, you'll need to monitor this impact; if you're unsure about this management, we recommend leaving the default settings and using manual versioning.
This is how configuration looks for auto-file-snapshot ```bash PENPOT_FLAGS: [...] enable-auto-file-snapshot # Enable automatic version saving # Backend PENPOT_AUTO_FILE_SNAPSHOT_EVERY: 5 # How many save operations trigger the auto-save-version? PENPOT_AUTO_FILE_SNAPSHOT_TIMEOUT: "1h" # How often is an automatic save forced even if the `every` trigger is not met? ``` Setting custom values for auto-file-snapshot does not change the behaviour for manual versions. ### ImageMagick Resource Limits Penpot uses ImageMagick for image processing (thumbnail generation, MIME detection, dimension extraction). You can configure resource limits for ImageMagick child processes to prevent a single image operation from consuming unbounded server resources. These environment variables override the default resource limits passed to ImageMagick via `MAGICK_*` environment variables. They can make limits tighter than the Docker `policy.xml` but never looser. ```bash # Backend PENPOT_IMAGEMAGICK_THREAD_LIMIT: 2 PENPOT_IMAGEMAGICK_MEMORY_LIMIT: 256MiB PENPOT_IMAGEMAGICK_MAP_LIMIT: 512MiB PENPOT_IMAGEMAGICK_AREA_LIMIT: 128MP PENPOT_IMAGEMAGICK_DISK_LIMIT: 1GiB PENPOT_IMAGEMAGICK_TIME_LIMIT: 30 PENPOT_IMAGEMAGICK_WIDTH_LIMIT: PENPOT_IMAGEMAGICK_HEIGHT_LIMIT: ``` | Variable | Default | Description | |----------|---------|-------------| | `PENPOT_IMAGEMAGICK_THREAD_LIMIT` | `2` | Max threads per ImageMagick process | | `PENPOT_IMAGEMAGICK_MEMORY_LIMIT` | `256MiB` | Max heap memory per process | | `PENPOT_IMAGEMAGICK_MAP_LIMIT` | `512MiB` | Max memory-mapped area (disk-backed pixel cache) | | `PENPOT_IMAGEMAGICK_AREA_LIMIT` | `128MP` | Max total pixels (128 megapixels ≈ 11584×11096) | | `PENPOT_IMAGEMAGICK_DISK_LIMIT` | `1GiB` | Max pixel cache on disk | | `PENPOT_IMAGEMAGICK_TIME_LIMIT` | `30` | Max seconds per ImageMagick operation | | `PENPOT_IMAGEMAGICK_WIDTH_LIMIT` | *(not set)* | Max width in pixels | | `PENPOT_IMAGEMAGICK_HEIGHT_LIMIT` | *(not set)* | Max height in pixels | The Docker image also includes a `policy.xml` that acts as a hard ceiling — these env vars cannot exceed the limits set in `policy.xml`. The policy also blocks dangerous coders (PS, EPS, PDF, XPS) that invoke Ghostscript. ## Frontend In comparison with backend, frontend only has a small number of runtime configuration options, and they are located in the\/js/config.js file.
If you are using the official docker images, the best approach to set any configuration is
using environment variables, and the image automatically generates the config.js from
them.
In case you have a custom setup, you probably need to configure the following environment
variables on the frontend container:
To connect the frontend to the exporter and backend, you need to fill out these environment variables.
```bash
# Frontend
PENPOT_BACKEND_URI: http://your-penpot-backend:6060
PENPOT_EXPORTER_URI: http://your-penpot-exporter:6061
```
These variables are used for generate correct nginx.conf file on container startup.
### Exporter
The exporter uses this variable:
```bash
# Exporter
PENPOT_INTERNAL_URI: http://penpot-frontend:8080
```
- `PENPOT_INTERNAL_URI`: The URI used by the exporter's headless browser to
communicate with the frontend (internal Docker network). Defaults to
`PENPOT_PUBLIC_URI` if not set. The default value
`http://penpot-frontend:8080` used in the docker-compose is a good default and
it is recommended to keep it unchanged.
**Beta, new render engine (WebGL):** when you run more than one exporter, give
each one its own name and keep it across restarts and upgrades. An exporter
uses it to cancel only its own unfinished exports when it restarts:
```bash
# Exporter
PENPOT_EXPORTER_REPLICA_ID: exporter-1
```
### MCP
The MCP server lets AI agents read and edit Penpot files. It runs as a separate
`penpot-mcp` container, and the frontend proxies the requests to it. Enable it with
the corresponding flag:
```bash
PENPOT_FLAGS: [...] enable-mcp
```
With the flag enabled, the frontend container uses these variables to locate the MCP
server:
```bash
# Frontend
PENPOT_MCP_URI: http://penpot-mcp:4401
PENPOT_MCP_URI_WS: http://penpot-mcp:4402
```
- `PENPOT_MCP_URI`: The URI of the MCP server, used for the Streamable HTTP
endpoint.
- `PENPOT_MCP_URI_WS`: The URI of the MCP server used for the websocket connection.
The defaults match the service name used in the official `docker-compose.yaml`. Change
them only if your MCP service has a different name or listens on other ports. Both
variables are ignored when the `enable-mcp` flag is not set.
#### MCP feedback
Agents can email feedback about Penpot MCP to an inbox you choose, through the
`submit_feedback` tool. Set the backend URI on the MCP container to offer the tool,
and the inbox on the backend to accept the emails:
```bash
# MCP
PENPOT_MCP_BACKEND_URI: http://penpot-backend:6060/
# Backend
PENPOT_MCP_FEEDBACK_EMAIL: mcp-feedback@example.com
```
- `PENPOT_MCP_BACKEND_URI`: The URI the MCP server uses to reach the backend. When
unset, the MCP server does not offer the tool.
- `PENPOT_MCP_FEEDBACK_EMAIL`: The address that receives the feedback. When unset,
the backend rejects submissions.
The backend accepts feedback when the `enable-mcp` or `enable-access-tokens` flag is
set, and sends it through the [email configuration](#email-configuration). Each
email carries the name and email address of the user who sent it, and uses that
address as reply-to.
#### MCP sign-in
MCP clients with OAuth support can connect with the URL
`https://enable-cors: Enables the default cors cofiguration that allows all domains
(this configuration is designed only for dev purposes right now)
- enable-backend-api-doc: Enables the /api/doc
endpoint that lists all rpc methods available on backend
- disable-login-with-password: allows disable password based login form
- enable-mcp: Enables the MCP server integration, so AI agents can
read and edit Penpot files. It also makes the frontend proxy the MCP endpoints to the
penpot-mcp service. Check the [MCP section][8] to get more detail.
- enable-prepl-server: enables PREPL server, used by manage.py and other additional
tools to communicate internally with Penpot backend. Check the [CLI section][5] to get more detail.
- `disable-email-verification`: skips the email verification step on registration, making
newly registered profiles active immediately without any verification email. It also
changes the team invitation flow: inviting an email that already has a profile adds that
user to the team directly, without sending an invitation email (check the
[email configuration section][10] for more detail). Note that registering with an email
that already has an inactive profile is rejected as "email already exists" while this
flag is set. Not recommended for production environments.
__Since version 1.13.0__
- enable-log-invitation-tokens: for cases where you don't have email configured, this
will log to console the invitation tokens.
__Since version 2.0.0__
- disable-onboarding: disables the onboarding modals.
- disable-dashboard-templates-section: hides the templates section from dashboard.
- enable-webhooks: enables webhooks. More detail about this configuration in [webhooks section][6].
- enable-access-tokens: enables access tokens. More detail about this configuration in [access tokens section][7].
- disable-google-fonts-provider: disables the google fonts provider.
- enable-link-preview: enables Open Graph link previews for shared links.
File names and dashboard thumbnails become readable by anyone holding the link, so only enable
it if you accept that trade-off. More detail in the [link previews page][9].
[1]: /technical-guide/getting-started#configure-penpot-with-elestio
[2]: /technical-guide/getting-started#configure-penpot-with-docker
[3]: /technical-guide/developer/common#dev-environment
[4]: https://github.com/penpot/penpot/blob/main/docker/images/files/nginx.conf
[5]: /technical-guide/getting-started/docker#using-the-cli-for-administrative-tasks
[6]: /technical-guide/integration/#webhooks
[7]: /technical-guide/integration/#access-tokens
[8]: /mcp/
[9]: /technical-guide/developer/subsystems/link-preview/
[10]: /technical-guide/configuration/#email-configuration
[11]: /technical-guide/configuration/#other-flags