Deploy Metabase Snippets

Reusable SQL snippets for consistent metrics

Deploy Metabase Snippets

/var/lib/postgresql/data

metabase/metabase

metabase/metabase

Just deployed

Deploy and Host self hosted Metabase Snippets (Open-Source BI) on Railway

This Railway template runs Metabase with managed Postgres for self-hosted open-source BI. Metabase Snippets are reusable SQL fragments that keep metric definitions consistent across native queries. No more re-typing joins and filters per card.

About Hosting Metabase Snippets open-source software on Railway (self hosted Metabase template)

Self-hosting Metabase Snippets on Railway means your reusable SQL snippets, query results, and warehouse credentials stay in a project you control. Your analytics databases stay separate and connect after first-boot setup.

Why Deploy Metabase Snippets, the Tableau alternative on Railway (Railway Free Trial)

Tableau charges per creator seat, and the SQL you write still lives inside someone's workbook.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Metabase Snippets on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

Railway vs Other Hosting Providers and VPS for Metabase Snippets self hosting

Railway bundles the Metabase container with a managed Postgres and pre-fills MB_DB_TYPE and MB_DB_HOST; the others ask you to wire those env vars manually.

ProviderWhat You Get with RailwayWhat You Get with the Other Provider
DigitalOceanMetabase + Postgres in one project, MB_DB_* pre-filled, public URL.App Platform plus managed DB; you wire MB_DB_* yourself.
AWSNo VPC, security groups, or IAM to manage; rolling deploys keep snippets live.EC2 or ECS plus RDS; networking and TLS are yours.
HetznerManaged Postgres backups and restarts; set only MB_SITE_URL.Cheaper vCPU, but Docker, Postgres, backups, and proxy are manual.

Common Use Cases for hosted Metabase Snippets

  • Canonical metric definitions: Save one revenue or active-user SQL expression as a snippet so every native query uses the same logic. Edit it once to update all questions, but test before you publish because a broken snippet breaks them all.
  • Standard joins: Store a products-to-orders join (with aliases like products AS p) as a snippet. The outer query must use those aliases, so document them in the description.
  • Reusable WHERE filters: Put a parameterized filter like {{created_at}} inside a snippet, then map that parameter to different columns per question. One dashboard date filter can drive multiple SQL cards.
  • Cross-question parameters: Move a shared {{start_date}} into a snippet; parameters with the same name across snippets collapse into one widget, even in nested questions.

Dependencies for Metabase Snippets Docker hosted on Railway

Only hard dependency: production Postgres for Metabase app metadata. Snippets ship in metabase/metabase image; no extra plugin. On Railway pair with Railway Postgres 18 on a volume. Add MB_ENCRYPTION_SECRET_KEY early, never change, or warehouse credentials fail. H2 wipes snippets; avoid.

Deployment Dependencies for Managed Metabase Snippets Service (SQL BI with reusable snippets)

Two services: metabase/metabase (latest, port 3000) and ghcr.io/railwayapp-templates/postgres-ssl:18 with volume. Snippet storage in Postgres app DB only; no Redis. Folder permissions paid (Pro/Enterprise); OSS flat list.

Implementation Details for Metabase Snippets (Using Metabase official docker image)

After first boot, snippets work in native SQL editor. Highlight SQL, right-click, Save as snippet, unique name, description. Insert with {{snippet: name}} (no space after braces, one after colon). Snippets cannot be deleted, only archived.

How does Metabase Snippets compare against other SQL-first BI tools platforms

Metabase Snippets vs Tableau (Tableau Alternative)

Shared SQL library: One canonical {{snippet: revenue}} propagates metric changes across every native query that references it. Where Tableau wins: Drag-and-drop visuals need no SQL at all. Parameters: A snippet's {{created_at}} can map to different columns per question; Tableau parameters are workbook-scoped and harder to reuse across sources.

Metabase Snippets vs Apache Superset (Superset Alternative)

Native editor ergonomics: Metabase collapses snippet references with an eye icon to preview full SQL; Superset SQL Lab relies on saved queries and Jinja templating instead of named snippets. Where Superset wins: A larger chart gallery and Python plugin support. Dashboard filters: A shared {{start_date}} snippet drives multiple SQL cards from one filter; Superset needs manual scope wiring.

Metabase Snippets vs Redash (Redash Alternative)

Snippet maturity: Metabase blocks circular references and collapses parameters across nested snippets; Redash snippets are pasted into the query text, so later edits don't propagate. Where Redash wins: Faster setup for lightweight SQL monitoring with alerts. Archival: Metabase archives snippets, so dependent questions keep working.

Metabase Snippets vs Power BI (Power BI Alternative)

SQL-first consistency: Metabase snippets are plain SQL shared across questions; Power BI DAX measures live inside individual models. Where Power BI wins: Azure/Office 365 integration and enterprise governance. Cross-question reuse: Editing a snippet updates all cards at once; Power BI shared datasets need publish and refresh cycles.

How to use Metabase Snippets (the OSS SQL BI with reusable snippets)?

After deploy, start with one canonical metric. Open the SQL editor, highlight the logic, right-click and Save as snippet with a unique name and a description. Insert it anywhere with {{snippet: active_users_filter}}; autocomplete will suggest it as you type, and the eye icon previews the full SQL sent to the database. Renaming is safe for questions but breaks other snippets that reference the old name. Archive instead of delete; existing questions keep working. On OSS, snippets live in one flat list; folders need a paid plan.

How to self host Metabase Snippets on other VPS Services (Metabase Snippets self hosting guide)

Clone the Repository

You don't need the source; Metabase ships as the official metabase/metabase Docker image.

Install Dependencies

Install Docker and have a Postgres database ready for the app DB, then pull the image:

docker pull metabase/metabase:latest

Configure Environment Variables

Point Metabase at your Postgres app database and set a stable encryption key before adding any warehouse credentials.

export MB_DB_TYPE=postgres MB_DB_HOST=your-postgres-host MB_DB_PORT=5432 MB_DB_USER=metabase MB_DB_PASS=secret MB_DB_DBNAME=metabase MB_SITE_URL=https://your-domain

Start the Metabase Snippets Application

Run the container on port 3000, then open the setup wizard. Snippets appear in the native editor after you connect a database.

docker run -d -p 3000:3000 -e MB_DB_TYPE=postgres -e MB_DB_HOST=your-postgres-host -e MB_DB_PORT=5432 -e MB_DB_USER=metabase -e MB_DB_PASS=secret -e MB_DB_DBNAME=metabase -e MB_SITE_URL=https://your-domain metabase/metabase:latest

Official Pricing of Metabase Snippets (Metabase Snippets pricing)

Metabase Snippets is open-source (AGPL) and free to self-host; you pay only for infrastructure, like your Railway services. The snippet feature itself is included in all tiers; only folder-level permissions are gated.

Metabase Snippets cloud vs self hosted comparison (Pricing, features, costs, and more)

Self-hosting pays for the box, not the feature. OSS snippets are flat and free; cloud adds folder permissions on Pro and up, but you manage the stack only when self-hosting.

Monthly cost of self hosting Metabase Snippets on Railway

Railway Hobby plus Postgres 18 runs about $5-15/mo total, with no per-user fees. For flat snippets and a small team of dashboard editors, self-hosting is far cheaper month after month.

System Requirements for Hosting Metabase Snippets on a VPS

Run the standard Docker image with a Postgres 18 database and the usual MB_DB_* variables plus MB_SITE_URL pointing to your public HTTPS domain. A 2 vCPU / 4 GB node with SSD storage is comfortable for a small team. Snippet folders need a Pro or Enterprise plan, so on OSS keep your flat list tidy.

Frequently Asked Questions (FAQs)

Can I delete a snippet I no longer need?

No. Snippets can only be archived, never deleted. Archived snippets stay available to questions that already reference them, but you can't insert them into new queries.

How do I insert a snippet into a native query?

Highlight the SQL you want to reuse, right-click, and choose Save as snippet. Then type {{snippet: name}} (no space after the opening braces, one space after the colon) and autocomplete will suggest the name.

Can snippets use SQL parameters?

Yes. A snippet can include {{created_at}} or any other parameter. Parameter settings live on each question, so the same snippet can map to different columns in different cards.

What happens if I edit a snippet that many questions use?

Every question using that snippet changes immediately. If your edit breaks the SQL, it breaks all of them, so test the snippet in a scratch question first.

Are snippets shared with my whole team?

Yes. Anyone with native editor permission on at least one database can create, edit, or archive any snippet. All native query authors see the same flat list on OSS; folders are a paid-plan feature.

Will archiving a snippet break my existing questions?

No. Archiving only removes the snippet from the insert list. Existing questions that reference it keep working exactly as before.


Template Content

More templates in this category

View Template
NEW
Typesense Multilingual
Locale-aware multilingual search with Typesense

onepush
0
View Template
NEW
Formbricks | Open-Source Typeform & Qualtrics Alternative
Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

Two Workspaces
2
View Template
Typesense PHP
official PHP client against Railway

onepush
0