{
  "manifest_version": "1.0.0",
  "template": {
    "id": "5816cf78-f0da-4b3c-9634-d3ec0409a3c6",
    "slug": "stalwart-mail-s3",
    "name": "Stalwart Mail S3",
    "description": "Stalwart mail with PostgreSQL and Railway object storage",
    "url": "https://railway.com/deploy/stalwart-mail-s3",
    "upstream": {
      "repo_url": "https://github.com/monotykamary/railway-template-stalwart"
    }
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "stalwart",
      "source": {
        "repo": "https://github.com/monotykamary/railway-template-stalwart"
      },
      "needs_volume": true,
      "volume_mount_path": "/etc/stalwart",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "PostgreSQL data directory inside the persistent volume.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Private Railway hostname for PostgreSQL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "PostgreSQL listener port.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Database user exposed to PostgreSQL clients.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Database name exposed to PostgreSQL clients.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Password exposed to PostgreSQL clients.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database initialized for Stalwart.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private PostgreSQL connection URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "PostgreSQL administrator user.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Lifetime of the image-generated private TLS certificate.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Generated PostgreSQL password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Grace period for database deployment shutdown.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "stalwart",
      "description": "Pins Railway HTTP routing and health checks to Stalwart's cleartext HTTP listener.",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "S3_BUCKET",
      "service": "stalwart",
      "description": "Globally unique Railway Bucket API name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "S3_REGION",
      "service": "stalwart",
      "description": "Railway Bucket signing region.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MAIL_DOMAIN",
      "service": "stalwart",
      "description": "Primary email domain served by Stalwart, for example example.com.",
      "secret": false,
      "strategy": "ask_user"
    },
    {
      "key": "S3_ENDPOINT",
      "service": "stalwart",
      "description": "Railway Bucket S3-compatible endpoint.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MAIL_HOSTNAME",
      "service": "stalwart",
      "description": "Public mail hostname used in SMTP greetings and discovery, for example mail.example.com.",
      "secret": false,
      "strategy": "ask_user"
    },
    {
      "key": "POSTGRES_HOST",
      "service": "stalwart",
      "description": "Private PostgreSQL hostname.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_PORT",
      "service": "stalwart",
      "description": "Private PostgreSQL port.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_USER",
      "service": "stalwart",
      "description": "PostgreSQL user referenced from the database service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "S3_ACCESS_KEY_ID",
      "service": "stalwart",
      "description": "Railway Bucket S3 access key reference.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DATABASE",
      "service": "stalwart",
      "description": "Stalwart metadata database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "stalwart",
      "description": "PostgreSQL password referenced from the database service.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "STALWART_PUBLIC_URL",
      "service": "stalwart",
      "description": "Public HTTPS origin advertised by JMAP and OAuth discovery.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "S3_SECRET_ACCESS_KEY",
      "service": "stalwart",
      "description": "Railway Bucket secret key reference; it is not written into Stalwart config.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "STALWART_BOOTSTRAP_PASSWORD",
      "service": "stalwart",
      "description": "Generated fallback administrator password used for first sign-in as admin.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "stalwart-mail-s3"
      }
    },
    "cli": "railway deploy --template stalwart-mail-s3",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "5816cf78-f0da-4b3c-9634-d3ec0409a3c6",
            "serializedConfig": {
              "buckets": {
                "2d49f1e9-9827-464f-b51e-cbabf7547ecb": {
                  "name": "mail-blobs"
                }
              },
              "services": {
                "0c36583e-d279-406c-bda7-eeffce1dc8a3": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "Postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "PostgreSQL data directory inside the persistent volume.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Private Railway hostname for PostgreSQL.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "PostgreSQL listener port.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Database user exposed to PostgreSQL clients.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Database name exposed to PostgreSQL clients.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Password exposed to PostgreSQL clients.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database initialized for Stalwart.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private PostgreSQL connection URL.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "PostgreSQL administrator user.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Lifetime of the image-generated private TLS certificate.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated PostgreSQL password.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Grace period for database deployment shutdown.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "0c36583e-d279-406c-bda7-eeffce1dc8a3": {
                      "mountPath": "/var/lib/postgresql/data",
                      "backupSchedules": [
                        "DAILY"
                      ]
                    }
                  },
                  "haTemplateCode": "postgres-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxy",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "Routes traffic to the primary",
                      "defaultValue": 3
                    },
                    "replica": {
                      "label": "Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5,
                        6,
                        7
                      ],
                      "nodeLabel": "Postgres",
                      "description": "Streaming replicas for automatic failover",
                      "defaultValue": 2
                    },
                    "internal": {
                      "label": "Coordinator Nodes",
                      "options": [
                        3,
                        5,
                        7,
                        9
                      ],
                      "nodeLabel": "etcd",
                      "defaultValue": 3
                    },
                    "description": "This will convert your Postgres database to an HA cluster with Patroni failover and etcd consensus."
                  }
                },
                "0f41d740-1f28-4dcc-b268-0f8c5de46020": {
                  "icon": "https://raw.githubusercontent.com/monotykamary/railway-template-stalwart/a214554de91a35baa028643ac30b57a6b1653ebe/assets/stalwart-icon-v1.png",
                  "name": "stalwart",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/healthz/live",
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": 300,
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/monotykamary/railway-template-stalwart",
                    "commitSha": "660836f8898aa2f8989064071ea9663b92b57478",
                    "rootDirectory": null
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Pins Railway HTTP routing and health checks to Stalwart's cleartext HTTP listener.",
                      "defaultValue": "8080"
                    },
                    "S3_BUCKET": {
                      "isOptional": false,
                      "description": "Globally unique Railway Bucket API name.",
                      "defaultValue": "${{mail-blobs.BUCKET}}"
                    },
                    "S3_REGION": {
                      "isOptional": false,
                      "description": "Railway Bucket signing region.",
                      "defaultValue": "${{mail-blobs.REGION}}"
                    },
                    "MAIL_DOMAIN": {
                      "isOptional": false,
                      "description": "Primary email domain served by Stalwart, for example example.com.",
                      "defaultValue": "{{MAIL_DOMAIN}}"
                    },
                    "S3_ENDPOINT": {
                      "isOptional": false,
                      "description": "Railway Bucket S3-compatible endpoint.",
                      "defaultValue": "${{mail-blobs.ENDPOINT}}"
                    },
                    "MAIL_HOSTNAME": {
                      "isOptional": false,
                      "description": "Public mail hostname used in SMTP greetings and discovery, for example mail.example.com.",
                      "defaultValue": "{{MAIL_HOSTNAME}}"
                    },
                    "POSTGRES_HOST": {
                      "isOptional": false,
                      "description": "Private PostgreSQL hostname.",
                      "defaultValue": "${{Postgres.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "POSTGRES_PORT": {
                      "isOptional": false,
                      "description": "Private PostgreSQL port.",
                      "defaultValue": "${{Postgres.PGPORT}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "PostgreSQL user referenced from the database service.",
                      "defaultValue": "${{Postgres.POSTGRES_USER}}"
                    },
                    "S3_ACCESS_KEY_ID": {
                      "isOptional": false,
                      "description": "Railway Bucket S3 access key reference.",
                      "defaultValue": "${{mail-blobs.ACCESS_KEY_ID}}"
                    },
                    "POSTGRES_DATABASE": {
                      "isOptional": false,
                      "description": "Stalwart metadata database name.",
                      "defaultValue": "${{Postgres.POSTGRES_DB}}"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL password referenced from the database service.",
                      "defaultValue": "${{Postgres.POSTGRES_PASSWORD}}"
                    },
                    "STALWART_PUBLIC_URL": {
                      "isOptional": false,
                      "description": "Public HTTPS origin advertised by JMAP and OAuth discovery.",
                      "defaultValue": "https://${{stalwart.RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "S3_SECRET_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "Railway Bucket secret key reference; it is not written into Stalwart config.",
                      "defaultValue": "${{mail-blobs.SECRET_ACCESS_KEY}}"
                    },
                    "STALWART_BOOTSTRAP_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated fallback administrator password used for first sign-in as admin.",
                      "defaultValue": "{{STALWART_BOOTSTRAP_PASSWORD}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  },
                  "volumeMounts": {
                    "0f41d740-1f28-4dcc-b268-0f8c5de46020": {
                      "mountPath": "/etc/stalwart",
                      "backupSchedules": [
                        "DAILY"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "stalwart",
      "method": "GET",
      "path": "/healthz/live",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-10T16:14:52.212Z",
  "generator_version": "0.1.0"
}
