{
  "manifest_version": "1.0.0",
  "template": {
    "id": "8829abd3-6ef1-4095-8f28-2baf0fadd53a",
    "slug": "affine-open-source",
    "name": "AFFiNE [Updated Sep '26]",
    "description": "AFFiNE [Sep '26] (Self-Hosted Notion and Miro Alternative)",
    "url": "https://railway.com/deploy/affine-open-source",
    "upstream": {
      "image": "ghcr.io/toeverything/affine:stable"
    }
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "name": "affine",
      "source": {
        "image": "ghcr.io/toeverything/affine:stable"
      },
      "needs_volume": true,
      "volume_mount_path": "/root/.affine",
      "http": true
    },
    {
      "name": "redis",
      "source": {
        "image": "redis:8.2.1"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "pgvector",
      "source": {
        "image": "pgvector/pgvector:pg18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "affine",
      "description": "HTTP port Railway routes public traffic to — must match AFFINE_SERVER_PORT.",
      "secret": false,
      "strategy": "default",
      "default": "3010"
    },
    {
      "key": "NODE_ENV",
      "service": "affine",
      "description": "Node.js runtime mode.",
      "secret": false,
      "strategy": "default",
      "default": "production"
    },
    {
      "key": "DATABASE_URL",
      "service": "affine",
      "description": "Postgres connection string, built directly from the private domain rather than through the PGHOST_PRIVATE indirection on the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDIS_SERVER_HOST",
      "service": "affine",
      "description": "Redis private hostname.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDIS_SERVER_PORT",
      "service": "affine",
      "description": "Redis port.",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDIS_SERVER_USER",
      "service": "affine",
      "description": "Redis AUTH username.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AFFINE_ADMIN_EMAIL",
      "service": "affine",
      "description": "Bootstrap admin account email, created by the preDeployCommand migration script.",
      "secret": false,
      "strategy": "ask_user"
    },
    {
      "key": "AFFINE_CONFIG_PATH",
      "service": "affine",
      "description": "Config directory inside the mounted volume.",
      "secret": false,
      "strategy": "default",
      "default": "/root/.affine/config"
    },
    {
      "key": "AFFINE_SERVER_HOST",
      "service": "affine",
      "description": "Binds to all interfaces inside the container.",
      "secret": false,
      "strategy": "default",
      "default": "0.0.0.0"
    },
    {
      "key": "AFFINE_SERVER_PORT",
      "service": "affine",
      "description": "Internal listener port.",
      "secret": false,
      "strategy": "default",
      "default": "3010"
    },
    {
      "key": "AFFINE_SERVER_HTTPS",
      "service": "affine",
      "description": "Railway's own edge terminates TLS, so the app itself serves plain HTTP internally.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "AFFINE_ADMIN_PASSWORD",
      "service": "affine",
      "description": "Bootstrap admin password. Must contain at least 1 uppercase letter, 2 digits, and 2 special characters — confirmed via AFFiNE's own docs. This expression chains guaranteed draws from each required class (1 upper + 2 digits + 2 specials) plus 11 more random characters, meeting the requirement by construction rather than by chance, the same defensive pattern used for Libredesk's system password. Verified live to resolve correctly.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "REDIS_SERVER_PASSWORD",
      "service": "affine",
      "description": "Redis AUTH password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AFFINE_INDEXER_ENABLED",
      "service": "affine",
      "description": "Disables the search indexer, which needs a separate Manticore/Elasticsearch instance this template doesn't deploy.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "AFFINE_SERVER_EXTERNAL_URL",
      "service": "affine",
      "description": "Public-facing app URL, used for generated links and CORS.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "REDISHOST",
      "service": "redis",
      "description": "Internal Redis service hostname.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDISPORT",
      "service": "redis",
      "description": "Redis server listening port.",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDISUSER",
      "service": "redis",
      "description": "Redis default authentication user (plain --requirepass, not ACLs).",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "REDIS_URL",
      "service": "redis",
      "description": "Internal Redis connection string.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISPASSWORD",
      "service": "redis",
      "description": "Same password under Railway's conventional Redis variable naming.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "redis",
      "description": "Auth password Redis is started with (--requirepass). Auto-generated.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PGDATA",
      "service": "pgvector",
      "description": "Data storage directory — a subdirectory of the mount, not the mount root.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGUSER",
      "service": "pgvector",
      "description": "Username for Postgres authentication, conventional naming.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "pgvector",
      "description": "Default database name, conventional naming.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "pgvector",
      "description": "Password for the Postgres user, conventional naming.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "pgvector",
      "description": "Name of the database created on startup.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "POSTGRES_USER",
      "service": "pgvector",
      "description": "Postgres superuser name.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "pgvector",
      "description": "Validity period for generated SSL certificates.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "PGHOST_PRIVATE",
      "service": "pgvector",
      "description": "Private internal domain for Postgres — this is what affine's DATABASE_URL is built from.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT_PRIVATE",
      "service": "pgvector",
      "description": "Private internal domain for Postgres — this is what affine's DATABASE_URL is built from.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "pgvector",
      "description": "Password for the Postgres superuser. Auto-generated.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_URL_PRIVATE",
      "service": "pgvector",
      "description": "Full private connection string, for reference/consistency with the reference config's naming — affine's own DATABASE_URL is built independently (see below) rather than referencing this.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "pgvector",
      "description": "Time to wait before shutting down the old deployment on redeploy.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "affine-open-source"
      }
    },
    "cli": "railway deploy --template affine-open-source",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "8829abd3-6ef1-4095-8f28-2baf0fadd53a",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "42b8dd99-eb56-4b24-a3ab-5722a50577fa": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/affine-light.svg",
                  "name": "affine",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "preDeployCommand": [
                      "node ./scripts/self-host-predeploy.js"
                    ],
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/toeverything/affine:stable"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP port Railway routes public traffic to — must match AFFINE_SERVER_PORT.",
                      "defaultValue": "3010"
                    },
                    "NODE_ENV": {
                      "isOptional": false,
                      "description": "Node.js runtime mode.",
                      "defaultValue": "production"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Postgres connection string, built directly from the private domain rather than through the PGHOST_PRIVATE indirection on the Postgres service.",
                      "defaultValue": "postgresql://${{pgvector.POSTGRES_USER}}:${{pgvector.POSTGRES_PASSWORD}}@${{pgvector.RAILWAY_PRIVATE_DOMAIN}}:5432/${{pgvector.POSTGRES_DB}}"
                    },
                    "REDIS_SERVER_HOST": {
                      "isOptional": false,
                      "description": "Redis private hostname.",
                      "defaultValue": "${{redis.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDIS_SERVER_PORT": {
                      "isOptional": false,
                      "description": "Redis port.",
                      "defaultValue": "6379"
                    },
                    "REDIS_SERVER_USER": {
                      "isOptional": false,
                      "description": "Redis AUTH username.",
                      "defaultValue": "${{redis.REDISUSER}}"
                    },
                    "AFFINE_ADMIN_EMAIL": {
                      "isOptional": false,
                      "description": "Bootstrap admin account email, created by the preDeployCommand migration script.",
                      "defaultValue": "{{AFFINE_ADMIN_EMAIL}}"
                    },
                    "AFFINE_CONFIG_PATH": {
                      "isOptional": false,
                      "description": "Config directory inside the mounted volume.",
                      "defaultValue": "/root/.affine/config"
                    },
                    "AFFINE_SERVER_HOST": {
                      "isOptional": false,
                      "description": "Binds to all interfaces inside the container.",
                      "defaultValue": "0.0.0.0"
                    },
                    "AFFINE_SERVER_PORT": {
                      "isOptional": false,
                      "description": "Internal listener port.",
                      "defaultValue": "3010"
                    },
                    "AFFINE_SERVER_HTTPS": {
                      "isOptional": false,
                      "description": "Railway's own edge terminates TLS, so the app itself serves plain HTTP internally.",
                      "defaultValue": "false"
                    },
                    "AFFINE_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Bootstrap admin password. Must contain at least 1 uppercase letter, 2 digits, and 2 special characters — confirmed via AFFiNE's own docs. This expression chains guaranteed draws from each required class (1 upper + 2 digits + 2 specials) plus 11 more random characters, meeting the requirement by construction rather than by chance, the same defensive pattern used for Libredesk's system password. Verified live to resolve correctly.",
                      "defaultValue": "{{AFFINE_ADMIN_PASSWORD}}"
                    },
                    "REDIS_SERVER_PASSWORD": {
                      "isOptional": false,
                      "description": "Redis AUTH password.",
                      "defaultValue": "${{redis.REDIS_PASSWORD}}"
                    },
                    "AFFINE_INDEXER_ENABLED": {
                      "isOptional": false,
                      "description": "Disables the search indexer, which needs a separate Manticore/Elasticsearch instance this template doesn't deploy.",
                      "defaultValue": "false"
                    },
                    "AFFINE_SERVER_EXTERNAL_URL": {
                      "isOptional": false,
                      "description": "Public-facing app URL, used for generated links and CORS.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:3010": {
                        "port": 3010
                      }
                    }
                  },
                  "volumeMounts": {
                    "42b8dd99-eb56-4b24-a3ab-5722a50577fa": {
                      "mountPath": "/root/.affine"
                    }
                  }
                },
                "9c02a981-52a1-45f6-b544-0a04de97992b": {
                  "icon": "https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg",
                  "name": "redis",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH\"",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "redis:8.2.1"
                  },
                  "variables": {
                    "REDISHOST": {
                      "isOptional": false,
                      "description": "Internal Redis service hostname.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDISPORT": {
                      "isOptional": false,
                      "description": "Redis server listening port.",
                      "defaultValue": "6379"
                    },
                    "REDISUSER": {
                      "isOptional": false,
                      "description": "Redis default authentication user (plain --requirepass, not ACLs).",
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Internal Redis connection string.",
                      "defaultValue": "redis://${{REDISUSER}}:${{REDIS_PASSWORD}}@${{REDISHOST}}:${{REDISPORT}}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "description": "Same password under Railway's conventional Redis variable naming.",
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Auth password Redis is started with (--requirepass). Auto-generated.",
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "9c02a981-52a1-45f6-b544-0a04de97992b": {
                      "mountPath": "/data"
                    }
                  }
                },
                "f88362b9-b0e8-4f9d-a23a-2ccc732a637c": {
                  "icon": "https://devicons.railway.app/postgres",
                  "name": "pgvector",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"unset PGPORT; docker-entrypoint.sh postgres --port=5432\"",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "pgvector/pgvector:pg18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Data storage directory — a subdirectory of the mount, not the mount root.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Username for Postgres authentication, conventional naming.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Default database name, conventional naming.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Password for the Postgres user, conventional naming.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Name of the database created on startup.",
                      "defaultValue": "railway"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Postgres superuser name.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Validity period for generated SSL certificates.",
                      "defaultValue": "820"
                    },
                    "PGHOST_PRIVATE": {
                      "isOptional": false,
                      "description": "Private internal domain for Postgres — this is what affine's DATABASE_URL is built from.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT_PRIVATE": {
                      "isOptional": false,
                      "description": "Private internal domain for Postgres — this is what affine's DATABASE_URL is built from.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the Postgres superuser. Auto-generated.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_URL_PRIVATE": {
                      "isOptional": false,
                      "description": "Full private connection string, for reference/consistency with the reference config's naming — affine's own DATABASE_URL is built independently (see below) rather than referencing this.",
                      "defaultValue": "postgres://${{PGUSER}}:${{PGPASSWORD}}@${{PGHOST_PRIVATE}}:${{PGPORT_PRIVATE}}/${{PGDATABASE}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Time to wait before shutting down the old deployment on redeploy.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "f88362b9-b0e8-4f9d-a23a-2ccc732a637c": {
                      "mountPath": "/var/lib/postgresql"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-09T22:14:39.753Z",
  "generator_version": "0.1.0"
}
