{
  "manifest_version": "1.0.0",
  "template": {
    "id": "80bf1834-b941-4644-a7bd-0c4f85982ad9",
    "slug": "affine-2",
    "name": "AFFiNE",
    "description": "Collaborative docs and whiteboards with PostgreSQL and persistent storage.",
    "url": "https://railway.com/deploy/affine-2",
    "upstream": {
      "repo_url": "https://github.com/orenaksakal/railway-templates"
    }
  },
  "services": [
    {
      "name": "affine",
      "source": {
        "repo": "https://github.com/orenaksakal/railway-templates"
      },
      "needs_volume": true,
      "volume_mount_path": "/root/.affine",
      "http": true
    },
    {
      "name": "redis",
      "source": {
        "image": "valkey/valkey@sha256:e0eb7c480958d32bdc4357a74bdd70653ae15f2f9b4c93c4a5a9fad1dc471c84"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "postgres",
      "source": {
        "repo": "https://github.com/orenaksakal/railway-templates"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "affine",
      "description": "HTTP port inside this service. Keep the default to match its Railway public port and health check.",
      "secret": false,
      "strategy": "default",
      "default": "3010"
    },
    {
      "key": "DATABASE_URL",
      "service": "affine",
      "description": "Private PostgreSQL connection URL assembled from generated credentials and service references. No manual value is needed.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_SERVER_HOST",
      "service": "affine",
      "description": "Private Redis/Valkey hostname supplied by the redis service reference.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDIS_SERVER_PORT",
      "service": "affine",
      "description": "Private Redis/Valkey port. Keep 6379.",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "AFFINE_SERVER_HOST",
      "service": "affine",
      "description": "AFFiNE bind address. Keep 0.0.0.0 for container networking.",
      "secret": false,
      "strategy": "default",
      "default": "0.0.0.0"
    },
    {
      "key": "AFFINE_SERVER_PORT",
      "service": "affine",
      "description": "AFFiNE HTTP port. Keep aligned with PORT and Railway networking.",
      "secret": false,
      "strategy": "default",
      "default": "3010"
    },
    {
      "key": "REDIS_SERVER_PASSWORD",
      "service": "affine",
      "description": "Generated private Redis/Valkey password, or a reference to that password. Keep secret.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AFFINE_INDEXER_ENABLED",
      "service": "affine",
      "description": "AFFiNE indexer toggle. Disabled in this deployment; enabling it requires separate upstream setup.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "RAILWAY_DOCKERFILE_PATH",
      "service": "affine",
      "description": "Repository-relative Dockerfile used to build this service. Keep the supplied path.",
      "secret": false,
      "strategy": "default",
      "default": "templates/affine/Dockerfile"
    },
    {
      "key": "AFFINE_SERVER_EXTERNAL_URL",
      "service": "affine",
      "description": "Public AFFiNE HTTPS URL. Generated from the Railway domain; update when assigning a custom domain.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "REDIS_URL",
      "service": "redis",
      "description": "Private authenticated Redis/Valkey connection URL. Automatically assembled from service references.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "redis",
      "description": "Generated private Redis/Valkey password, or a reference to that password. Keep secret.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "APP_DB",
      "service": "postgres",
      "description": "Application database created during first initialization of an empty PostgreSQL volume.",
      "secret": false,
      "strategy": "default",
      "default": "affine"
    },
    {
      "key": "PGDATA",
      "service": "postgres",
      "description": "PostgreSQL data directory within the persistent volume. Do not change on an existing database.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "APP_USER",
      "service": "postgres",
      "description": "Dedicated application database role created during first initialization.",
      "secret": false,
      "strategy": "default",
      "default": "affine"
    },
    {
      "key": "POSTGRES_DB",
      "service": "postgres",
      "description": "Initial PostgreSQL database name, or the matching database selected by the application.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "APP_PASSWORD",
      "service": "postgres",
      "description": "Generated password for the application database role. Preserve it with your backups.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_URL",
      "service": "postgres",
      "description": "Private PostgreSQL connection URL assembled from generated credentials and service references. No manual value is needed.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "ENABLE_VECTOR",
      "service": "postgres",
      "description": "Initialize the pgvector extension for applications that require vector storage. Keep the supplied value.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "POSTGRES_USER",
      "service": "postgres",
      "description": "PostgreSQL initialization user, or the matching connection user for the private database.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "postgres",
      "description": "PostgreSQL password. Generated for the database and referenced by dependent services; keep private.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DOCKERFILE_PATH",
      "service": "postgres",
      "description": "Repository-relative Dockerfile used to build this service. Keep the supplied path.",
      "secret": false,
      "strategy": "default",
      "default": "templates/affine/Postgres.Dockerfile"
    },
    {
      "key": "ALLOW_APP_DATABASE_CREATION",
      "service": "postgres",
      "description": "Grant database and role creation privileges required by ToolJet. Keep false for other applications.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "affine-2"
      }
    },
    "cli": "railway deploy --template affine-2",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "80bf1834-b941-4644-a7bd-0c4f85982ad9",
            "serializedConfig": {
              "services": {
                "20fb021d-3bab-5ab3-8e60-8ae528a8fcb0": {
                  "name": "affine",
                  "build": {
                    "builder": "RAILPACK",
                    "dockerfilePath": "templates/affine/Dockerfile"
                  },
                  "deploy": {
                    "healthcheckPath": "/info",
                    "requiredMountPath": "/root/.affine",
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": 600,
                    "restartPolicyMaxRetries": 5
                  },
                  "source": {
                    "repo": "orenaksakal/railway-templates",
                    "branch": "codex/railway-template-release"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP port inside this service. Keep the default to match its Railway public port and health check.",
                      "defaultValue": "3010"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private PostgreSQL connection URL assembled from generated credentials and service references. No manual value is needed.",
                      "defaultValue": "${{postgres.DATABASE_URL}}"
                    },
                    "REDIS_SERVER_HOST": {
                      "isOptional": false,
                      "description": "Private Redis/Valkey hostname supplied by the redis service reference.",
                      "defaultValue": "${{redis.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDIS_SERVER_PORT": {
                      "isOptional": false,
                      "description": "Private Redis/Valkey port. Keep 6379.",
                      "defaultValue": "6379"
                    },
                    "AFFINE_SERVER_HOST": {
                      "isOptional": false,
                      "description": "AFFiNE bind address. Keep 0.0.0.0 for container networking.",
                      "defaultValue": "0.0.0.0"
                    },
                    "AFFINE_SERVER_PORT": {
                      "isOptional": false,
                      "description": "AFFiNE HTTP port. Keep aligned with PORT and Railway networking.",
                      "defaultValue": "3010"
                    },
                    "REDIS_SERVER_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated private Redis/Valkey password, or a reference to that password. Keep secret.",
                      "defaultValue": "${{redis.REDIS_PASSWORD}}"
                    },
                    "AFFINE_INDEXER_ENABLED": {
                      "isOptional": false,
                      "description": "AFFiNE indexer toggle. Disabled in this deployment; enabling it requires separate upstream setup.",
                      "defaultValue": "false"
                    },
                    "RAILWAY_DOCKERFILE_PATH": {
                      "isOptional": false,
                      "description": "Repository-relative Dockerfile used to build this service. Keep the supplied path.",
                      "defaultValue": "templates/affine/Dockerfile"
                    },
                    "AFFINE_SERVER_EXTERNAL_URL": {
                      "isOptional": false,
                      "description": "Public AFFiNE HTTPS URL. Generated from the Railway domain; update when assigning a custom domain.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:3010": {
                        "port": 3010
                      }
                    }
                  },
                  "volumeMounts": {
                    "3721416a-dab5-5de1-bac2-f01bf213183c": {
                      "mountPath": "/root/.affine"
                    }
                  }
                },
                "39dd035e-3316-50d7-87da-22814ebebfcd": {
                  "name": "redis",
                  "deploy": {
                    "startCommand": "sh -c 'exec valkey-server --bind 0.0.0.0 --appendonly yes --maxmemory-policy noeviction --requirepass \"$REDIS_PASSWORD\"'",
                    "requiredMountPath": "/data",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 5
                  },
                  "source": {
                    "image": "valkey/valkey@sha256:e0eb7c480958d32bdc4357a74bdd70653ae15f2f9b4c93c4a5a9fad1dc471c84"
                  },
                  "variables": {
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Private authenticated Redis/Valkey connection URL. Automatically assembled from service references.",
                      "defaultValue": "redis://:${{redis.REDIS_PASSWORD}}@${{redis.RAILWAY_PRIVATE_DOMAIN}}:6379"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated private Redis/Valkey password, or a reference to that password. Keep secret.",
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "623ea7a2-1826-5278-87cc-fb0123bbac1d": {
                      "mountPath": "/data"
                    }
                  }
                },
                "7cc14452-cdfd-5317-9120-4c8d5ea830e7": {
                  "name": "postgres",
                  "build": {
                    "builder": "RAILPACK",
                    "dockerfilePath": "templates/affine/Postgres.Dockerfile"
                  },
                  "deploy": {
                    "requiredMountPath": "/var/lib/postgresql/data",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 5
                  },
                  "source": {
                    "repo": "orenaksakal/railway-templates",
                    "branch": "codex/railway-template-release"
                  },
                  "variables": {
                    "APP_DB": {
                      "isOptional": false,
                      "description": "Application database created during first initialization of an empty PostgreSQL volume.",
                      "defaultValue": "affine"
                    },
                    "PGDATA": {
                      "isOptional": false,
                      "description": "PostgreSQL data directory within the persistent volume. Do not change on an existing database.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "APP_USER": {
                      "isOptional": false,
                      "description": "Dedicated application database role created during first initialization.",
                      "defaultValue": "affine"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Initial PostgreSQL database name, or the matching database selected by the application.",
                      "defaultValue": "postgres"
                    },
                    "APP_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated password for the application database role. Preserve it with your backups.",
                      "defaultValue": "{{APP_PASSWORD}}"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private PostgreSQL connection URL assembled from generated credentials and service references. No manual value is needed.",
                      "defaultValue": "postgresql://affine:${{postgres.APP_PASSWORD}}@${{postgres.RAILWAY_PRIVATE_DOMAIN}}:5432/affine"
                    },
                    "ENABLE_VECTOR": {
                      "isOptional": false,
                      "description": "Initialize the pgvector extension for applications that require vector storage. Keep the supplied value.",
                      "defaultValue": "true"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "PostgreSQL initialization user, or the matching connection user for the private database.",
                      "defaultValue": "postgres"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL password. Generated for the database and referenced by dependent services; keep private.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DOCKERFILE_PATH": {
                      "isOptional": false,
                      "description": "Repository-relative Dockerfile used to build this service. Keep the supplied path.",
                      "defaultValue": "templates/affine/Postgres.Dockerfile"
                    },
                    "ALLOW_APP_DATABASE_CREATION": {
                      "isOptional": false,
                      "description": "Grant database and role creation privileges required by ToolJet. Keep false for other applications.",
                      "defaultValue": "false"
                    }
                  },
                  "networking": {
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "fce22db3-b075-5a94-ba1f-d1525bbeaff1": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "affine",
      "method": "GET",
      "path": "/info",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-08T05:54:19.399Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-08T06:06:14.276Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_c8deaa0c23a242b1ae3f",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 113,
    "typical_build_seconds": 20,
    "typical_start_seconds": 30,
    "slowest_service": "affine"
  }
}
