supabase 架构分析

December 28, 2023

Firebase是一家典型的BaaS公司,它可以帮助手机以及网页应用的开发者轻松构建App。通过Firebase的框架就可以简单地开发一个App,无需服务器以及基础设施,简单来说,它就是一整套的解决方案。

Supabase 是一个开源的 Firebase 替代方案。官方表示,其正在使用企业级开源工具构建 Firebase 的功能。Supabase 可以:

  • 监听数据库的变化。
  • 查询你的表,包括过滤、分页和深度嵌套关系(如GraphQL)。
  • 创建、更新和删除行。
  • 管理你的用户和他们的权限。
  • 使用一个简单的用户界面与你的数据库进行交互

本文通过从本地部署方案大致分析其整体架构。

简介

Supabase的定位为Firebase的开源替代,围绕 PostgreSQL 组合了一系列的开源工具,用以实现 BaaS 所需的用户认证、实时数据库、对象存储、RESTAPI 接口等功能。在整合这些工具的同时,为开发者封装了统一的 SDK,方便开发者以统一的方式调用这些能力。官方提供了 JavaScript 和 Flutter 的 SDK,社区贡献了 Python、C#、Swift、Kotlin 的 SDK,开发者在开发移动端和 web 应用时,可以很方便的调用 Supabase 提供的后端能力。

整体架构图:

Supabase 的几个核心服务

  • Postgrest:直接使用了开源服务,可以直接通过 HTTP 接口操作Postgres数据库,同时支持Restful和GraphpQL两种协议。
  • Storage API:提供对象存储功能,解决开发者需要上传、下载文件的需求。后端将数据存储在 S3 存储上,也支持minio(兼容S3)以及本地文件。
  • gotrue:用户登录认证模块,帮助用户简化其应用的用户管理。允许开发者使用邮箱、手机号进行注册、登录模块的开发,也可以通过 OAuth 协议接入 github、google、apple 等平台的账号。
  • realtime:realtime 利用 postgresql 的 listen/notify 机制,实现了 postgres 数据库实时数据变更通知能力。
  • studio:管理台面板,为gotrue、DB、anaylist提供管理入口。

架构分析

Supabase支持本地容器化部署,docker-compose中共有12个容器,从中可以分析出大致的架构。

Seq名称镜像仓库简介
1supabase-vectortimberio/vector第三方用于使用 Postgres 和 pgvector 开发 AI 应用程序。使用 Supabase 客户端库可大规模地存储、索引和查询向量嵌入。
2supabase-imgproxydarthsim/imgproxy第三方图片代理服务。supabase官方有仓库,但看本地镜像应该是使用imgproxy的官方镜像。
3supabase-dbsupabase/postgressupabase/postgres基于Postgres增加了部分插件
4supabase-analyticssupabase/logflareunknown为supabase本地部署时提供的日志、统计服务。基于supabase收购后的logflare实现。没有找到相关仓库。
5supabase-edge-functionssupabase/edge-runtimesupabase/edge-runtimesupabase提供的边缘函数服务
6supabase-restpostgrest/postgrest第三方使用postgrest提供基于PG的基础CRUD web服务。
7supabase-metasupabase-metasupabase/postgres-metaPostgres数据库管理相关服务,包括表结构管理、添加用户角色和执行查询等
8supabase-studiosupabase/studiosupabase/studiosupabase管理台。
9supabase-kongkong:2.8.1第三方kong的官方镜像即可。
10realtime-dev.supabase-realtimesupabase/realtime:v2.25.35supabase/realtimesupabase提供的websocket服务,支持广播推送、数据共享以及Postgres数据变更监听能力
11supabase-authsupabase/gotrue:v2.125.1supabase/gotruesupabase的身份认证和用户管理服务
12supabase-storagsupabase/storage-apisupabase/storage后台基于S3的存储服务

supabase-kong

各服务(包括管理台)的接入网关,唯一的对外入口。

  • 镜像: kong
[yaml]
kong:
    container_name: supabase-kong
    image: kong:2.8.1
    restart: unless-stopped
    # https://unix.stackexchange.com/a/294837
    entrypoint: bash -c 'eval "echo \"$$(cat ~/temp.yml)\"" > ~/kong.yml && /docker-entrypoint.sh kong docker-start'
    ports:
        - ${KONG_HTTP_PORT}:8000/tcp
        - ${KONG_HTTPS_PORT}:8443/tcp
    depends_on:
        analytics:
        condition: service_healthy
    environment:
        KONG_DATABASE: "off"
        KONG_DECLARATIVE_CONFIG: /home/kong/kong.yml
        # https://github.com/supabase/cli/issues/14
        KONG_DNS_ORDER: LAST,A,CNAME
        KONG_PLUGINS: request-transformer,cors,key-auth,acl,basic-auth
        KONG_NGINX_PROXY_PROXY_BUFFER_SIZE: 160k
        KONG_NGINX_PROXY_PROXY_BUFFERS: 64 160k
        SUPABASE_ANON_KEY: ${ANON_KEY}
        SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}
        DASHBOARD_USERNAME: ${DASHBOARD_USERNAME}
        DASHBOARD_PASSWORD: ${DASHBOARD_PASSWORD}
    volumes:
        # https://github.com/supabase/supabase/issues/12661
        - ./volumes/api/kong.yml:/home/kong/temp.yml:ro
  • 通过kong的网关路由配置,可以看到各service的具体配置。后续可以考虑把kongka安装上,更方便kong的配置管理。

supabase-db

Postgres数据库,supabase在postgres DB上做了一些扩展,为各服务提供存储。

  • 仓库地址。只是在Postgres数据库增加了一些插件。而非修改Postgres,仅提供一键式安装的最常用扩展。
[yaml]
db:
    container_name: supabase-db
    image: supabase/postgres:15.1.0.147
    healthcheck:
        test: pg_isready -U postgres -h localhost
        interval: 5s
        timeout: 5s
        retries: 10
    depends_on:
        vector:
        condition: service_healthy
    command:
        - postgres
        - -c
        - config_file=/etc/postgresql/postgresql.conf
        - -c
        - log_min_messages=fatal # prevents Realtime polling queries from appearing in logs
    restart: unless-stopped
    ports:
        # Pass down internal port because it's set dynamically by other services
        - ${POSTGRES_PORT}:${POSTGRES_PORT}
    environment:
        POSTGRES_HOST: /var/run/postgresql
        PGPORT: ${POSTGRES_PORT}
        POSTGRES_PORT: ${POSTGRES_PORT}
        PGPASSWORD: ${POSTGRES_PASSWORD}
        POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
        PGDATABASE: ${POSTGRES_DB}
        POSTGRES_DB: ${POSTGRES_DB}
        JWT_SECRET: ${JWT_SECRET}
        JWT_EXP: ${JWT_EXPIRY}
    volumes:
        - ./volumes/db/realtime.sql:/docker-entrypoint-initdb.d/migrations/99-realtime.sql:Z
        # Must be superuser to create event trigger
        - ./volumes/db/webhooks.sql:/docker-entrypoint-initdb.d/init-scripts/98-webhooks.sql:Z
        # Must be superuser to alter reserved role
        - ./volumes/db/roles.sql:/docker-entrypoint-initdb.d/init-scripts/99-roles.sql:Z
        # Initialize the database settings with JWT_SECRET and JWT_EXP
        - ./volumes/db/jwt.sql:/docker-entrypoint-initdb.d/init-scripts/99-jwt.sql:Z
        # PGDATA directory is persisted between restarts
        - ./volumes/db/data:/var/lib/postgresql/data:Z
        # Changes required for Analytics support
        - ./volumes/db/logs.sql:/docker-entrypoint-initdb.d/migrations/99-logs.sql:Z

注意数据有通过volumn映射到本地。

supabase-storage

为supabase提供存储服务。使用s3作为后端存储provider、使用Postgres存储元数据。

  • 服务架构和实现见 https://github.com/supabase/storage。
  • 注意docker-compose中默认使用了 file 作为后端存储。如果要使用S3、Minio参考官方配置,使用environment覆盖即可。不知国内的兼容s3的产品是否可以替代(如阿里云的OSS)
[yaml]
# 镜像配置
storage:
    container_name: supabase-storage
    image: supabase/storage-api:v0.43.11
    environment:
        ANON_KEY: ${ANON_KEY}
        SERVICE_KEY: ${SERVICE_ROLE_KEY}
        POSTGREST_URL: http://rest:3000
        PGRST_JWT_SECRET: ${JWT_SECRET}
        DATABASE_URL: postgres://supabase_storage_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
        FILE_SIZE_LIMIT: 52428800
        STORAGE_BACKEND: file
        FILE_STORAGE_BACKEND_PATH: /var/lib/storage
        TENANT_ID: stub
        # TODO: https://github.com/supabase/storage-api/issues/55
        REGION: stub
        GLOBAL_S3_BUCKET: stub
        ENABLE_IMAGE_TRANSFORMATION: "true"
        IMGPROXY_URL: http://imgproxy:5001
    volumes:
        - ./volumes/storage:/var/lib/storage:z

# Kong路由配置
## Storage routes: the storage server manages its own auth
    - name: storage-v1
    _comment: 'Storage: /storage/v1/* -> http://storage:5000/*'
    url: http://storage:5000/
    routes:
        - name: storage-v1-all
        strip_path: true
        paths:
            - /storage/v1/
    plugins:
        - name: cors

supabase-auth

一个go版本的身份认证和用户管理服务,主要用来提供各类账号(Mail、phone、Google, Apple, Facebook, Discor等)的登录以及 jwt token校验能力。

定位应该类似于dexide/dex等OIDC产品。

  • 仓库地址,采用纯go实现。docker中监听端口9999.
[yaml]
# 镜像配置
auth:
    container_name: supabase-auth
    image: supabase/gotrue:v2.125.1
    depends_on:
        db:
        # Disable this if you are using an external Postgres database
        condition: service_healthy
        analytics:
        condition: service_healthy
    environment:
        GOTRUE_API_HOST: 0.0.0.0
        GOTRUE_API_PORT: 9999
        API_EXTERNAL_URL: ${API_EXTERNAL_URL}

        GOTRUE_DB_DRIVER: postgres
        GOTRUE_DB_DATABASE_URL: postgres://supabase_auth_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}

        GOTRUE_SITE_URL: ${SITE_URL}
        GOTRUE_URI_ALLOW_LIST: ${ADDITIONAL_REDIRECT_URLS}
        GOTRUE_DISABLE_SIGNUP: ${DISABLE_SIGNUP}

            # JWT生成相关配置
        GOTRUE_JWT_ADMIN_ROLES: service_role
        GOTRUE_JWT_AUD: authenticated
        GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated
        GOTRUE_JWT_EXP: ${JWT_EXPIRY}
        GOTRUE_JWT_SECRET: ${JWT_SECRET}

# Kong配置较多,因为auth提供了authorize、verify、logincallback等能力。

还有大量Auth Provider、mail、captcha、phone相关配置详见auth仓库中的说明。

supabase-realtime

一个使用Elixir语言框架构建的ws服务器,支持广播(向客户端推送消息)、数据共享(如终端协同场景)以及Postgres数据变更监听能力。

[yaml]
# 镜像
realtime:
    # This container name looks inconsistent but is correct because realtime constructs tenant id by parsing the subdomain
    container_name: realtime-dev.supabase-realtime
    image: supabase/realtime:v2.25.35
    environment:
        PORT: 4000
        DB_HOST: ${POSTGRES_HOST}
        DB_PORT: ${POSTGRES_PORT}
        DB_USER: supabase_admin
        DB_PASSWORD: ${POSTGRES_PASSWORD}
        DB_NAME: ${POSTGRES_DB}
        DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
        DB_ENC_KEY: supabaserealtime
        API_JWT_SECRET: ${JWT_SECRET}
        FLY_ALLOC_ID: fly123
        FLY_APP_NAME: realtime
        SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
        ERL_AFLAGS: -proto_dist inet_tcp
        ENABLE_TAILSCALE: "false"
        DNS_NODES: "''"
    command: >
        sh -c "/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server"

# kong配置
## Secure Realtime routes
    - name: realtime-v1
    _comment: 'Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*'
    url: http://realtime-dev.supabase-realtime:4000/socket/
    routes:
        - name: realtime-v1-all
        strip_path: true
        paths:
            - /realtime/v1/
    plugins:
        - name: cors
        - name: key-auth
        config:
            hide_credentials: false
        - name: acl
        config:
            hide_groups_header: true
            allow:
            - admin
            - anon

supabase-rest

使用PostREST提供基于PG的基础CRUD web服务。

  • 直接使用了PostREST的镜像,同时也被storage依赖。PostREST默认监听端口为3000。
  • 同时提供了Restful和GraphQL的接口给到外部。详见kong相关配置
[yaml]
rest:
    container_name: supabase-rest
    image: postgrest/postgrest:v12.0.1
    depends_on:
        db:
        # Disable this if you are using an external Postgres database
        condition: service_healthy
        analytics:
        condition: service_healthy
    restart: unless-stopped
    environment:
        PGRST_DB_URI: postgres://authenticator:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
        PGRST_DB_SCHEMAS: ${PGRST_DB_SCHEMAS}
        PGRST_DB_ANON_ROLE: anon
        PGRST_JWT_SECRET: ${JWT_SECRET}
        PGRST_DB_USE_LEGACY_GUCS: "false"
        PGRST_APP_SETTINGS_JWT_SECRET: ${JWT_SECRET}
        PGRST_APP_SETTINGS_JWT_EXP: ${JWT_EXPIRY}
    command: "postgrest"

# Kong配置
## Secure REST routes
    - name: rest-v1
    _comment: 'PostgREST: /rest/v1/* -> http://rest:3000/*'
    url: http://rest:3000/
    routes:
        - name: rest-v1-all
        strip_path: true
        paths:
            - /rest/v1/
    plugins:
        - name: cors
        - name: key-auth
        config:
            hide_credentials: true
        - name: acl
        config:
            hide_groups_header: true
            allow:
            - admin
            - anon

    ## Secure GraphQL routes
    - name: graphql-v1
    _comment: 'PostgREST: /graphql/v1/* -> http://rest:3000/rpc/graphql'
    url: http://rest:3000/rpc/graphql
    routes:
        - name: graphql-v1-all
        strip_path: true
        paths:
            - /graphql/v1
    plugins:
        - name: cors
        - name: key-auth
        config:
            hide_credentials: true
        - name: request-transformer
        config:
            add:
            headers:
                - Content-Profile:graphql_public
        - name: acl
        config:
            hide_groups_header: true
            allow:
            - admin
            - anon

supabase-meta

采用Typescript实现的Postgres数据库管理相关服务,包括表结构管理、添加用户角色和执行查询等。

  • https://github.com/supabase/postgres-meta: 该服务器是一个轻量级的连接池器,可将Postgres系统目录规范化成更易读的格式。该服务器支持多租户,因此可以从单个服务器上支持多个Postgres数据库。服务不提供任何安全措施。请勿将其用作独立服务器。应在受信任的环境中将其用作代理服务器,或仅在本地机器上使用,或仅在无外部访问权限的情况下内部使用。
  • 默认监听端口8080。
  • 仅依赖Postgres DB,且被supabase管理台依赖(需要操作表接口,执行sql等)。
[yaml]
container_name: supabase-meta
    image: supabase/postgres-meta:v0.75.0
    environment:
        PG_META_PORT: 8080
        PG_META_DB_HOST: ${POSTGRES_HOST}
        PG_META_DB_PORT: ${POSTGRES_PORT}
        PG_META_DB_NAME: ${POSTGRES_DB}
        PG_META_DB_USER: supabase_admin
        PG_META_DB_PASSWORD: ${POSTGRES_PASSWORD}

# kong配置(注意:仅放开了admin访问权限)
## Secure Database routes
    - name: meta
    _comment: 'pg-meta: /pg/* -> http://pg-meta:8080/*'
    url: http://meta:8080/
    routes:
        - name: meta-all
        strip_path: true
        paths:
            - /pg/
    plugins:
        - name: key-auth
        config:
            hide_credentials: false
        - name: acl
        config:
            hide_groups_header: true
            allow:
            - admin

supabase-studio

管理系统,基于Next、Tailwind、supabase UI实现。

  • 依赖supabase-meta(读取表结构等)和Postgres。
  • 外网使用部署需要替换 SUPABASE_PUBLIC_URL 地址
[yaml]
studio:
    container_name: supabase-studio
    image: supabase/studio:20231123-64a766a
    restart: unless-stopped
    environment:
      STUDIO_PG_META_URL: http://meta:8080
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}

      DEFAULT_ORGANIZATION_NAME: ${STUDIO_DEFAULT_ORGANIZATION}
      DEFAULT_PROJECT_NAME: ${STUDIO_DEFAULT_PROJECT}

      SUPABASE_URL: http://kong:8000
      SUPABASE_PUBLIC_URL: ${SUPABASE_PUBLIC_URL}
      SUPABASE_ANON_KEY: ${ANON_KEY}
      SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}

      LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}
      LOGFLARE_URL: http://analytics:4000
      NEXT_PUBLIC_ENABLE_LOGS: true
      # Comment to use Big Query backend for analytics
      NEXT_ANALYTICS_BACKEND_PROVIDER: postgres
      # Uncomment to use Big Query backend for analytics
      # NEXT_ANALYTICS_BACKEND_PROVIDER: bigquery

supabase-edge-functions

supabase提供的边缘函数服务。

  • 基于Deno runtime,支持运行js、ts以及wasm。
  • 本地默认监听端口9000
[text]
functions:
    container_name: supabase-edge-functions
    image: supabase/edge-runtime:v1.29.1
    restart: unless-stopped
    depends_on:
        analytics:
        condition: service_healthy
    environment:
        JWT_SECRET: ${JWT_SECRET}
        SUPABASE_URL: http://kong:8000
        SUPABASE_ANON_KEY: ${ANON_KEY}
        SUPABASE_SERVICE_ROLE_KEY: ${SERVICE_ROLE_KEY}
        SUPABASE_DB_URL: postgresql://postgres:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
        # TODO: Allow configuring VERIFY_JWT per function. This PR might help: https://github.com/supabase/cli/pull/786
        VERIFY_JWT: "${FUNCTIONS_VERIFY_JWT}"
    volumes:
        - ./volumes/functions:/home/deno/functions:Z
    command:
        - start
        - --main-service
        - /home/deno/functions/main

# kong配置
- name: functions-v1
    _comment: 'Edge Functions: /functions/v1/* -> http://functions:9000/*'
    url: http://functions:9000/
    routes:
        - name: functions-v1-all
        strip_path: true
        paths:
            - /functions/v1/
    plugins:
        - name: cors

supabase-analytics:

为supabase本地部署时提供的日志、统计服务。基于supabase收购后的logflare实现。本地部署时使用Postgres作为后端存储。

  • Auth、PostREST、Storage等服务通过analytics将相关操作日志记录到db,供管理台查询等使用。
  • 默认监听端口4000,相关文档地址
[yaml]
analytics:
    container_name: supabase-analytics
    image: supabase/logflare:1.4.0
    # Uncomment to use Big Query backend for analytics
    # volumes:
    #   - type: bind
    #     source: ${PWD}/gcloud.json
    #     target: /opt/app/rel/logflare/bin/gcloud.json
    #     read_only: true
    environment:
        LOGFLARE_NODE_HOST:  127.0.0.1
        DB_USERNAME: supabase_admin
        DB_DATABASE: ${POSTGRES_DB}
        DB_HOSTNAME: ${POSTGRES_HOST}
        DB_PORT: ${POSTGRES_PORT}
        DB_PASSWORD: ${POSTGRES_PASSWORD}
        DB_SCHEMA: _analytics
        LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}
        LOGFLARE_SINGLE_TENANT: true
        LOGFLARE_SUPABASE_MODE: true

        # Comment variables to use Big Query backend for analytics
        POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
        POSTGRES_BACKEND_SCHEMA: _analytics
        LOGFLARE_FEATURE_FLAG_OVERRIDE: multibackend=true

        # Uncomment to use Big Query backend for analytics
        # GOOGLE_PROJECT_ID: ${GOOGLE_PROJECT_ID}
        # GOOGLE_PROJECT_NUMBER: ${GOOGLE_PROJECT_NUMBER}
    ports:
        - 4000:4000

# Kong配置
## Analytics routes
    - name: analytics-v1
    _comment: 'Analytics: /analytics/v1/* -> http://logflare:4000/*'
    url: http://analytics:4000/
    routes:
        - name: analytics-v1-all
        strip_path: true
        paths:
            - /analytics/v1/

supabase-imgproxy

图片代理服务。反代真正的图片地址,当请求图片的时候,请求的是imgproxy的图片地址,然后imgproxy再去请求原始图片,将其转换为要求的尺寸和格式以后,再发送给用户。除了这些以外,imgproxy还可以对原始图片进行模糊化、旋转、亮度调节、加水印等很多功能,具体可以去看官方的文档说明。

[yaml]
imgproxy:
    container_name: supabase-imgproxy
    image: darthsim/imgproxy:v3.8.0
    healthcheck:
        test: [ "CMD", "imgproxy", "health" ]
        timeout: 5s
        interval: 5s
        retries: 3
    environment:
        IMGPROXY_BIND: ":5001"
        IMGPROXY_LOCAL_FILESYSTEM_ROOT: /
        IMGPROXY_USE_ETAG: "true"
        IMGPROXY_ENABLE_WEBP_DETECTION: ${IMGPROXY_ENABLE_WEBP_DETECTION}
    volumes:
        - ./volumes/storage:/var/lib/storage:z

supabase-vector

用于使用 Postgres 和 pgvector 开发 AI 应用程序。使用 Supabase 客户端库可大规模地存储、索引和查询向量嵌入。

  • 本地部署时貌似还没有使用?
[yaml]
vector:
    container_name: supabase-vector
    image: timberio/vector:0.28.1-alpine
    volumes:
        - ./volumes/logs/vector.yml:/etc/vector/vector.yml:ro
        - ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro

    command: [ "--config", "etc/vector/vector.yml" ]

部署

docker部署方式,详见官方文档

[shell]
# Get the code
git clone --depth 1 https://github.com/supabase/supabase

# Go to the docker folder
cd supabase/docker

# Copy the fake env vars
cp .env.example .env

# Pull the latest images
docker compose pull

# Start the services (in detached mode)
docker compose up -d

env配置文件

各配置项的具体定义要结合docker-compose具体来看,涉及项目比较多,就不一一看了。

[text]
############
# Secrets
# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION
############

POSTGRES_PASSWORD=xxxx
JWT_SECRET=xxx
ANON_KEY=
SERVICE_ROLE_KEY=

# 管理系统用户名、密码
DASHBOARD_USERNAME=xxxx
DASHBOARD_PASSWORD=xxx

############
# Database - You can change these to any PostgreSQL database that has logical replication enabled.
############

POSTGRES_HOST=db
POSTGRES_DB=postgres
POSTGRES_PORT=5432
# default user is postgres

############
# API Proxy - Configuration for the Kong Reverse proxy.
############

KONG_HTTP_PORT=8000
KONG_HTTPS_PORT=8443

############
# API - Configuration for PostgREST.
############

PGRST_DB_SCHEMAS=public,storage,graphql_public

############
# Auth - Configuration for the GoTrue authentication server.
############

## General
SITE_URL=http://localhost:3000
ADDITIONAL_REDIRECT_URLS=
JWT_EXPIRY=3600
DISABLE_SIGNUP=false
API_EXTERNAL_URL=http://localhost:8000

## Mailer Config
MAILER_URLPATHS_CONFIRMATION="/auth/v1/verify"
MAILER_URLPATHS_INVITE="/auth/v1/verify"
MAILER_URLPATHS_RECOVERY="/auth/v1/verify"
MAILER_URLPATHS_EMAIL_CHANGE="/auth/v1/verify"

## Email auth
ENABLE_EMAIL_SIGNUP=true
ENABLE_EMAIL_AUTOCONFIRM=false
SMTP_ADMIN_EMAIL=admin@example.com
SMTP_HOST=supabase-mail
SMTP_PORT=2500
SMTP_USER=fake_mail_user
SMTP_PASS=fake_mail_password
SMTP_SENDER_NAME=fake_sender

## Phone auth
ENABLE_PHONE_SIGNUP=true
ENABLE_PHONE_AUTOCONFIRM=true

############
# Studio - Configuration for the Dashboard
############

STUDIO_DEFAULT_ORGANIZATION=Default Organization
STUDIO_DEFAULT_PROJECT=Default Project

STUDIO_PORT=3000
# replace if you intend to use Studio outside of localhost
SUPABASE_PUBLIC_URL=http://localhost:8000

# Enable webp support
IMGPROXY_ENABLE_WEBP_DETECTION=true

############
# Functions - Configuration for Functions
############
# NOTE: VERIFY_JWT applies to all functions. Per-function VERIFY_JWT is not supported yet.
FUNCTIONS_VERIFY_JWT=false

############
# Logs - Configuration for Logflare
# Please refer to https://supabase.com/docs/reference/self-hosting-analytics/introduction
############

LOGFLARE_LOGGER_BACKEND_API_KEY=your-super-secret-and-long-logflare-key

# Change vector.toml sinks to reflect this change
LOGFLARE_API_KEY=your-super-secret-and-long-logflare-key

# Docker socket location - this value will differ depending on your OS
DOCKER_SOCKET_LOCATION=/var/run/docker.sock

# Google Cloud Project details
GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID
GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER
See all postsSee all posts