> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openinary.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy on Railway

> One-click deploy on Railway, with a managed S3 bucket already connected.

Railway is the shortest Openinary deploy: one click, one required variable, and a managed S3 bucket already connected.

> [card] [Deploy on Railway](https://railway.com/new/template/openinary-1?referralCode=imHr5N\&utm_medium=integration\&utm_source=template\&utm_campaign=generic)
>
> One-click deploy, opens the pre-configured Openinary template

![Light Railway Template](https://mintcdn.com/openinary/LHqRowA4mn7ICE9u/images/Light---Railway-Template.png?fit=max\&auto=format\&n=LHqRowA4mn7ICE9u\&q=85\&s=d5c9382511aac389fa7b6074dd5dd8ce)

| Resource | Details |
| - | - |
| **Openinary App** | `openinary/openinary` Docker image |
| **Assets Storage** | Railway-managed S3 bucket, pre-connected |
| **Persistent volume** | Mounted at `/app/data` (database and API keys) |

## Deployment steps

**1. Open the template**

Click the **Deploy on Railway** card above. Sign in or create a Railway account if prompted.

**2. Set BETTER\_AUTH\_SECRET**

The template requires one variable. Generate a secure value:

```bash theme={null}
openssl rand -base64 32
```

Paste the output into the `BETTER_AUTH_SECRET` field in the template form. Keep it private, it signs all authentication sessions and tokens.

**3. Deploy**

Click **Deploy Now**. Railway provisions the app and the S3 bucket, then starts the container.

Wait for both the **Openinary App** and **Assets Storage** services to show **Deployed**.

**4. Set BETTER\_AUTH\_URL**

Railway generates a public URL for your app, such as `openinary-production.up.railway.app`.

Go to **Openinary App → Settings → Variables** and set:

```bash theme={null}
BETTER_AUTH_URL=https://your-app.up.railway.app
```

Then redeploy the service. Auth callbacks do not work without it. If you add a custom domain later, update this to match.

**5. Complete initial setup**

Visit your Railway URL. You land on the setup page, create your administrator account there.

> [!WARNING]
>
> Complete setup immediately. The `/setup` route is publicly accessible until an admin account is created.

## Optional configuration

The Railway bucket is pre-connected, so no storage variables are needed. Optional variables go under **Openinary App → Settings → Variables**:

```bash theme={null}
# Use a custom domain for asset URLs
STORAGE_PUBLIC_URL=https://assets.example.com

# Stricter CORS (set to your frontend origin)
CORS_ORIGIN=https://yourapp.com

# Sign transformation URLs
API_SECRET=your-hex-secret
```

See [Server configuration](https://docs.openinary.dev/configuration/server.md) and [Storage configuration](https://docs.openinary.dev/configuration/storage.md) for the full variable reference.

## Troubleshooting

Check the build logs under **Openinary App → Deployments**. Confirm `BETTER_AUTH_SECRET` is at least 32 characters, and that `BETTER_AUTH_URL` matches your Railway public URL exactly, with no trailing slash. If problems persist, [open an issue on GitHub](https://github.com/openinary/openinary/issues) with your deployment logs.

## Next steps

> [card] [Image Transformations](https://docs.openinary.dev/media-transformations/image-transformations.md)
>
> Resize, crop, and convert images with URL parameters.

> [card] [Video Transformations](https://docs.openinary.dev/media-transformations/video-transformations.md)
>
> Resize, trim, and extract thumbnails from videos.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.