---
title: "Deploy PostgreSQL Extensions"
description: "PostgreSQL + pgvector, postgis, pg_trgm, pgmq, pg_cron, pgcrypto and more."
category: "Storage"
url: https://railway.com/deploy/postgresql-extensions
---

# Deploy PostgreSQL Extensions

PostgreSQL + pgvector, postgis, pg_trgm, pgmq, pg_cron, pgcrypto and more.

**[Deploy PostgreSQL Extensions on Railway](https://railway.com/template/postgresql-extensions)**

- **Creator:** Karan Hejmadi's Projects
- **Category:** Storage
- **Total deploys:** 6

## Template content

### postgres https://devicons.railway.com/i/postgresql.svg

- **Image:** ghcr.io/karan316/postgres-extensions

## Documentation

# Deploy and Host PostgreSQL Extensions on Railway

PostgreSQL Extensions is a production-ready PostgreSQL 18 Docker image with 11 popular extensions pre-installed including pgvector, PostGIS, pgmq, pg_cron, and more. Enable any combination at deploy time with a single environment variable. No compilation or manual setup.

## About Hosting PostgreSQL Extensions

Hosting PostgreSQL with extensions typically requires compiling C libraries from source, managing shared library paths, configuring `shared_preload_libraries`, and ensuring extensions are created in the right databases. 
This template handles all of that automatically. Extensions are pre-compiled into the image, and a lightweight entrypoint script validates your selection, configures preloaded libraries, and runs `CREATE EXTENSION IF NOT EXISTS` on boot. SSL is enabled by default with auto-generated certificates. Just set the `EXTENSIONS` environment variable and deploy.

## Environment Variables
- `POSTGRES_USER` 
- `POSTGRES_PASSWORD`
- `POSTGRES_DB`
- `EXTENSIONS`


## Common Use Cases

- AI/ML applications using pgvector for vector similarity search and embeddings storage (RAG, recommendations)
- Location-aware apps using PostGIS for geospatial queries (nearby search, geofencing)
- Background job scheduling with pg_cron (cleanup tasks, report generation, data aggregation)
- Event-driven architectures using pgmq as a lightweight message queue directly in PostgreSQL
- Full-text fuzzy search with pg_trgm for typo-tolerant autocomplete and search
- Time-series data with pg_partman for automated table partitioning and retention policies

## Dependencies for PostgreSQL Extensions Hosting

- Docker (the image is hosted on GitHub Container Registry at `ghcr.io/karan316/postgres-extensions`)
- A persistent volume mounted at `/var/lib/postgresql` 

### Deployment Dependencies

- [PostgreSQL 18 Documentation](https://www.postgresql.org/docs/18/)
- [pgvector](https://github.com/pgvector/pgvector) — Vector similarity search
- [pgmq](https://github.com/pgmq/pgmq) — Lightweight message queue
- [PostGIS](https://postgis.net/) — Geospatial extension
- [pg_cron](https://github.com/citusdata/pg_cron) — Job scheduler
- [pg_partman](https://github.com/pgpartman/pg_partman) — Partition management
- [Source Repository](https://github.com/karan316/postgres-extensions)

## Why Deploy PostgreSQL Extensions on Railway?

- Railway makes it easy to run PostgreSQL with one click deployment. 
- This template adds the extensions many teams would need including vector search, geospatial queries, job scheduling, message queues without maintaining a custom Dockerfile or compiling anything yourself.  




## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/postgresql-extensions
