Text of supabase.com › docs › reference › self-hosting-analytics › create-endpoint as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Self-Hosting | Supabase Docs

Skip to content Self-Hosting Analytics The Supabase Analytics server is a Logflare self-hostable instance that manages the ingestion and query pipelines for searching and aggregating structured analytics events. When running the Analytics server, the logging experience matching that of the Supabase Platform is available in Studio. However, log content and metadata can differ from the Supabase Platform - see Differences from the Supabase platform below.

Locally running logs and analytics are supported in two separate setups: Local development & CLI - a local Supabase stack managed with the Supabase CLI ( supabase start ). Self-hosted Supabase - the full stack on your own infrastructure with Docker Compose. Logs & Analytics are optional and are not started by default. The sections below cover backend options and Logflare configuration. For self-hosted Supabase, see the installation and configuration guide.

Logflare Technical Docs All Logflare technical documentation is available at https://docs.logflare.app . Supported backends The Analytics server supports either Postgres or BigQuery as the backend. Both Local development & CLI and self-hosted Supabase use the Postgres backend out of the box. When using the BigQuery backend, a BigQuery dataset is created in the provided Google Cloud project, and tables are created for each source.

Log events are streamed into each table, and all queries generated by Studio or by the Logs Explorer are executed against the BigQuery API. This backend requires internet access to work, and cannot be run fully locally. When using the Postgres backend, tables are created for each source within the provided schema. Log events received by Logflare are inserted directly into the respective tables. All BigQuery-dialect SQL queries from Studio are handled by a translation layer within the Analytics server .

This translation layer translates the query to Postgres dialect, and then executes it against the Postgres database. The Postgres backend is not yet optimized for a high volume of inserts, or for heavy query usage. Today the translation layer only handles a limited subset of the BigQuery dialect. As such, the Log Explorer may produce errors for more advanced queries when using the Postgres Backend. Getting started The Postgres backend is recommended when familiarizing and experimenting.

For production self-hosting, we recommend the BigQuery backend. See the notes below for more information. Local development & CLI With the Supabase CLI, run supabase start to bring up a local stack. Logs use the Postgres backend by default and are stored in the _analytics schema. Docker socket access may need manual configuration on some platforms - see the Access your project's services (the Analytics tab). The Supabase CLI is intended for local development only.

The local analytics service uses predefined, publicly known access tokens and has no protection against external traffic. Never run the CLI stack on a publicly accessible or untrusted network. Self-hosted Supabase Self-hosted Supabase does not include Logs & Analytics in the default Docker Compose configuration. You must first install and secure the base stack - generate secrets, configure URLs, and set a Studio password - as described in Self-Hosting with Docker .

Do not start the stack with placeholder values from .env.example . After the base stack is configured, enable Logs & Analytics from your project directory (the directory containing docker-compose.yml ): 1 sh run.sh config add logs && \ 2 sh run.sh start This layers docker-compose.logs.yml on top of the base configuration and starts two additional services ( analytics and vector ). See Enabling analytics in the self-hosting guide for more context.

Required Logflare configuration The following environment variables are always required for the supabase/logflare image: docker-compose.logs.yml 1 analytics : 2 environment : 3 # Enable single-tenant mode for Logflare 4 LOGFLARE_SINGLE_TENANT : ' true ' 5 # Seed Supabase-related metadata 6 LOGFLARE_SUPABASE_MODE : ' true ' For all other configuration environment variables, refer to the Logflare self-hosting documentation .

Using the Postgres backend Local development & CLI The CLI uses the Postgres backend by default. No additional configuration is needed. Self-hosted Supabase The docker-compose.logs.yml override uses the Postgres backend by default. Configuration and requirements The following environment variables control the Postgres backend (set in docker-compose.logs.yml ): POSTGRES_BACKEND_URL : Required. Connection string to the Postgres database.

POSTGRES_BACKEND_SCHEMA : Optional. Schema used to store log data (default: _analytics ). Using the BigQuery backend The BigQuery backend is a more robust and scalable backend option that is battle-tested and production ready. Use this backend if you intend to have heavy logging usage and require advanced querying features such as the Logs Explorer. Requirements Using the BigQuery backend requires: A Google Cloud project with billing enabled The project ID The project number A service account JSON key A valid billing account is required for BigQuery streaming inserts.

Google Cloud Console setup Open Google Cloud Console and select or create the project you want to use for analytics. Confirm billing is enabled on that project ( Billing - link the project to a billing account if needed). Go to IAM & Admin > Service Accounts and click Create service account (for example, supabase-analytics ). On Permissions , grant BigQuery Admin to keep setup simple. Skip Principals with access . Alternatively, grant only the specific permissions listed below instead of the admin role.

Open the service account, then Keys (or Actions > Manage keys from the list view). Click Add key > Create new key , choose JSON , and download the key file. Go to APIs & Services > Library , search for Cloud Resource Manager API , open it, and click Enable . Confirm the correct project is selected in the project picker at the top. You can also enable it directly: https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=YOUR_PROJECT_ID (replace YOUR_PROJECT_ID ).

Go to Cloud overview > Dashboard (home dashboard for the project) and copy the Project ID and Project number . Confirm the project picker at the top shows the same project you configured above. Save the downloaded JSON key as gcloud.json in your self-hosted Supabase project directory (the directory that contains docker-compose.yml . Do not commit gcloud.json to version control. Add it to .gitignore if needed. Minimum BigQuery permissions If you prefer not to use the BigQuery Admin role, the service account needs at least the following permissions: bigquery.datasets.create , bigquery.datasets.get , bigquery.datasets.getIamPolicy , bigquery.datasets.update bigquery.jobs.create bigquery.routines.create , bigquery.routines.update bigquery.tables.create , bigquery.tables.delete , bigquery.tables.get , bigquery.tables.getData , bigquery.tables.update , bigquery.tables.updateData Self-hosted Supabase configuration Complete Self-Hosting with Docker first.

Enable the logs override, then switch the analytics service in docker-compose.logs.yml from Postgres to BigQuery. 1. Set Google Cloud variables in .env Add your project values under the Analytics section (do not leave the .env.example placeholders): 1 ############ 2 # Logs and Analytics 3 ############ 4 5 # Google Cloud Project details 6 GOOGLE_PROJECT_ID = your-project-id 7 GOOGLE_PROJECT_NUMBER = 123456789012 2. Mount the service account key and switch the analytics backend In docker-compose.logs.yml , under the analytics service: Remove or comment out POSTGRES_BACKEND_URL and POSTGRES_BACKEND_SCHEMA .

Uncomment GOOGLE_PROJECT_ID and GOOGLE_PROJECT_NUMBER . Uncomment the volumes block and bind-mount gcloud.json from your project directory. Example: docker-compose.logs.yml 1 analytics : 2 environment : 3 GOOGLE_PROJECT_ID

The rest of this page is on the live site.