{
  "manifest_version": "1.0.0",
  "template": {
    "id": "b83f3019-d617-4cb7-93a7-04bdd83a7a48",
    "slug": "affine-notion-alternative",
    "name": "AFFiNE | Open Source Notion, Miro Alternative on Railway",
    "description": "Self Host AFFiNE. Docs, whiteboards, databases, auto migrations &  more",
    "url": "https://railway.com/deploy/affine-notion-alternative",
    "upstream": {
      "image": "pgvector/pgvector:pg18"
    }
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "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": true
    },
    {
      "name": "Affine",
      "source": {
        "image": "ghcr.io/toeverything/affine:stable"
      },
      "needs_volume": true,
      "volume_mount_path": "/root/.affine",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "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",
      "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": "Redis password environment reference",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Password for Redis authentication",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "REDIS_PUBLIC_URL",
      "service": "Redis",
      "description": "Public Redis connection URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATA",
      "service": "pgvector",
      "description": "Location where PostgreSQL stores data files",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "pgvector",
      "description": "Public host/domain used to connect to Postgres.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPORT",
      "service": "pgvector",
      "description": "Public port exposed for Postgres connections.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGUSER",
      "service": "pgvector",
      "description": "Username for PostgreSQL authentication.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "pgvector",
      "description": "Default Postgres database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "pgvector",
      "description": "Password for the Postgres user.",
      "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": "DATABASE_URL",
      "service": "pgvector",
      "description": "Full public connection string for Postgres.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "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 in Railway.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT_PRIVATE",
      "service": "pgvector",
      "description": "Private internal port for Postgres.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "pgvector",
      "description": "Password for the Postgres superuser.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_URL_PRIVATE",
      "service": "pgvector",
      "description": "Full private connection string for internal services.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "pgvector",
      "description": "Time to wait before shutting down old deployments.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "Affine",
      "description": "HTTP port Railway routes traffic to",
      "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",
      "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": "Create Bootstrap admin email",
      "secret": false,
      "strategy": "ask_user"
    },
    {
      "key": "AFFINE_CONFIG_PATH",
      "service": "Affine",
      "description": "Config directory inside volume",
      "secret": false,
      "strategy": "default",
      "default": "/root/.affine/config"
    },
    {
      "key": "AFFINE_SERVER_HOST",
      "service": "Affine",
      "description": "Bind to all interfaces inside 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 edge terminates TLS",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "AFFINE_ADMIN_PASSWORD",
      "service": "Affine",
      "description": "Create Admin password (alteast 1 uppercase + 2 digits + 2 specials)",
      "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": "Disable search indexer (needs Manticore/ES)",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "AFFINE_SERVER_EXTERNAL_URL",
      "service": "Affine",
      "description": "Public-facing app URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "affine-notion-alternative"
      }
    },
    "cli": "railway deploy --template affine-notion-alternative",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "b83f3019-d617-4cb7-93a7-04bdd83a7a48",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "04b6841c-2fe2-4984-ad82-6daa4dab0d37": {
                  "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",
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Internal Redis connection string",
                      "defaultValue": "redis://${{REDISUSER}}:${{REDIS_PASSWORD}}@${{REDISHOST}}:${{REDISPORT}}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "description": "Redis password environment reference",
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for Redis authentication",
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    },
                    "REDIS_PUBLIC_URL": {
                      "isOptional": false,
                      "description": "Public Redis connection URL",
                      "defaultValue": "redis://default:${{REDIS_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}"
                    }
                  },
                  "volumeMounts": {
                    "04b6841c-2fe2-4984-ad82-6daa4dab0d37": {
                      "mountPath": "/data"
                    }
                  },
                  "haTemplateCode": "redis-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxies",
                      "options": [
                        1,
                        2
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "HAProxy instances routing writes to the primary",
                      "defaultValue": 2
                    },
                    "replica": {
                      "label": "Redis Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "Redis",
                      "description": "Nodes running Redis + colocated Sentinel",
                      "defaultValue": 2
                    },
                    "internal": null,
                    "description": "This will convert your Redis instance to an HA cluster with Sentinel failover and HAProxy routing to the primary."
                  }
                },
                "776c2861-8af9-41f7-8680-690d8e13deda": {
                  "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": "Location where PostgreSQL stores data files",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Public host/domain used to connect to Postgres.",
                      "defaultValue": "${{RAILWAY_TCP_PROXY_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Public port exposed for Postgres connections.",
                      "defaultValue": "${{RAILWAY_TCP_PROXY_PORT}}"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Username for PostgreSQL authentication.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Default Postgres database name.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Password for the Postgres user.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Name of the database created on startup.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Full public connection string for Postgres.",
                      "defaultValue": "postgres://${{PGUSER}}:${{PGPASSWORD}}@${{PGHOST}}:${{PGPORT}}/${{PGDATABASE}}"
                    },
                    "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 in Railway.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT_PRIVATE": {
                      "isOptional": false,
                      "description": "Private internal port for Postgres.",
                      "defaultValue": "5432"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the Postgres superuser.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_URL_PRIVATE": {
                      "isOptional": false,
                      "description": "Full private connection string for internal services.",
                      "defaultValue": "postgres://${{PGUSER}}:${{PGPASSWORD}}@${{PGHOST_PRIVATE}}:${{PGPORT_PRIVATE}}/${{PGDATABASE}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Time to wait before shutting down old deployments.",
                      "defaultValue": "60"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  },
                  "volumeMounts": {
                    "776c2861-8af9-41f7-8680-690d8e13deda": {
                      "mountPath": "/var/lib/postgresql"
                    }
                  }
                },
                "d107528c-fe5d-4233-9b5d-cdc1c22364ac": {
                  "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 traffic to",
                      "defaultValue": "3010"
                    },
                    "NODE_ENV": {
                      "isOptional": false,
                      "description": "Node.js runtime mode",
                      "defaultValue": "production"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Postgres connection string",
                      "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": "Create Bootstrap admin email",
                      "defaultValue": "{{AFFINE_ADMIN_EMAIL}}"
                    },
                    "AFFINE_CONFIG_PATH": {
                      "isOptional": false,
                      "description": "Config directory inside volume",
                      "defaultValue": "/root/.affine/config"
                    },
                    "AFFINE_SERVER_HOST": {
                      "isOptional": false,
                      "description": "Bind to all interfaces inside container",
                      "defaultValue": "0.0.0.0"
                    },
                    "AFFINE_SERVER_PORT": {
                      "isOptional": false,
                      "description": "Internal listener port",
                      "defaultValue": "3010"
                    },
                    "AFFINE_SERVER_HTTPS": {
                      "isOptional": false,
                      "description": "Railway edge terminates TLS",
                      "defaultValue": "false"
                    },
                    "AFFINE_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Create Admin password (alteast 1 uppercase + 2 digits + 2 specials)",
                      "defaultValue": "{{AFFINE_ADMIN_PASSWORD}}"
                    },
                    "REDIS_SERVER_PASSWORD": {
                      "isOptional": false,
                      "description": "Redis AUTH password",
                      "defaultValue": "${{Redis.REDIS_PASSWORD}}"
                    },
                    "AFFINE_INDEXER_ENABLED": {
                      "isOptional": false,
                      "description": "Disable search indexer (needs Manticore/ES)",
                      "defaultValue": "false"
                    },
                    "AFFINE_SERVER_EXTERNAL_URL": {
                      "isOptional": false,
                      "description": "Public-facing app URL",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:3010": {
                        "port": 3010
                      }
                    }
                  },
                  "volumeMounts": {
                    "d107528c-fe5d-4233-9b5d-cdc1c22364ac": {
                      "mountPath": "/root/.affine"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-21T16:15:12.787Z",
  "generator_version": "0.1.0"
}
