Templates are pre-configured deployment blueprints that allow you to deploy popular applications and services with minimal configuration. Each template includes a docker-compose file, metadata, and sensible defaults.
How Templates Work
When you create a deployment from a template, FlatRun:
- Copies the template's docker-compose configuration
- Substitutes variables with your provided values (name, domain, ports)
- Generates any required configuration files (.env, config files)
- Creates the deployment directory with all necessary files
- Optionally starts the deployment automatically
Template Structure
Each template consists of two files:
metadata.yml
Describes the template and its configuration options:
id: wordpress
name: WordPress
description: Popular open-source content management system
category: applications
icon: pi-globe
logo: /logos/wordpress.svg
priority: 1
container_port: 80
mounts:
- id: app
name: Application Data
container_path: /var/www/html
description: Mount the entire WordPress installation
- id: uploads
name: Media Uploads
container_path: /var/www/html/wp-content/uploads
description: Mount only media uploads docker-compose.yml
The compose file uses variable placeholders like ${NAME} that are replaced at deployment time.
Template Categories
| Category | Description | Examples |
|---|---|---|
applications | Full-featured web applications | WordPress, Ghost |
frameworks | Development frameworks | Laravel, Next.js, Astro |
runtimes | Language runtimes | Node.js, PHP |
databases | Database servers | MySQL, PostgreSQL, MariaDB |
infrastructure | System infrastructure | Nginx, Redis |
basic | Simple setups | Static Site |
Variable Substitution
Templates support the following variables that are replaced at deployment time:
| Variable | Description |
|---|---|
NAME | Deployment name |
PORT | External port number |
DOMAIN | Domain name (if configured) |
DB_HOST | Database host |
DB_NAME | Database name |
DB_USER | Database username |
DB_PASSWORD | Database password |
Mount Points
Mount points define how the deployment's data is persisted. Each mount point specifies a path inside the container that can be bound to a directory on the host.
- Full mount — Mounts the entire application directory
- Partial mount — Mounts only specific subdirectories (uploads, plugins, etc.)
- No mount — Uses container storage (data lost on container removal)
Built-in Templates
FlatRun includes the following built-in templates:
Applications
- WordPress — Popular CMS with database support
- Ghost — Modern publishing platform
Frameworks
- Laravel — PHP web framework
- Next.js — React framework for production
- Astro — Content-driven static site builder
Runtimes
- Node.js — JavaScript runtime
- PHP — PHP with Apache
Databases
- MySQL — Popular relational database
- MariaDB — MySQL-compatible database
- PostgreSQL — Advanced relational database
Infrastructure
- Nginx — Web server and reverse proxy
- Redis — In-memory data store
Basic
- Static Site — Simple HTML/CSS/JS hosting
Using Templates via API
List available templates and deploy from them:
# List templates
curl -X GET http://localhost:8090/api/templates \
-H "Authorization: Bearer TOKEN"
# Create deployment from template
curl -X POST http://localhost:8090/api/deployments \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d 'see API docs for request body'