Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local

Directus (Docker) + PostGIS (Docker/TCP) + S3

Deploy Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local

Postgis

postgis/postgis:latest

Just deployed

/var/lib/postgresql/data

Directus

Somi-AI/directus-railway

Just deployed

/directus/files

Latest updates

  • This has been updated to Directus 11.9
  • Create snapshots with a single command: cd scripts && pnpm create-snapshot
  • Extension folder updates: We've updated the extension folders to match the recommended structure. This ensures that you can load your downloaded and custom extensions correctly. Remember to commit the dist folder and package.json for custom extensions. We've included a custom extension as an example.
  • Automatic schema synchronization: (Optional) Run cd scripts && pnpm create-snapshot to create a snapshot of your working schema from your local development environment. Then, push your branch for deployment, and it will - be synced to your Railway environment.
  • Environment variable management: We've added a .env.example file(duplicate and rename to .env) to manage your environment variables and secrets. Docker Compose will use this file to load the environment variables.

Deploy and Host Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local on Railway

Directus is a powerful headless CMS and data platform that transforms any database into a dynamic API and beautiful admin app. This template provides a complete Directus instance with PostGIS for geospatial data support and S3 integration for persistent file storage, all containerized and ready for production deployment.

About Hosting Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local

Hosting Directus with PostGIS and S3 on Railway involves deploying a containerized stack that includes a Directus instance with pre-configured extensions and websocket support, paired with a PostGIS database for advanced geospatial capabilities. The setup includes automatic schema synchronization, SSL-secured database connections using self-signed certificates, and S3 integration for scalable file storage. Railway's private networking reduces egress fees by enabling secure communication between Directus and the database. The template supports custom extensions, automated deployments, and provides a complete data platform solution with minimal configuration required.

Common Use Cases

  • Content Management System: Build dynamic websites and applications with a powerful admin interface for content creators and editors
  • Geospatial Applications: Develop location-based services, mapping applications, and GIS solutions using PostGIS's advanced spatial database capabilities
  • API-First Data Platform: Create robust APIs for mobile apps, IoT devices, and microservices architectures with automatic REST and GraphQL endpoints

Dependencies for Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local Hosting

  • Docker: Containerization platform for running Directus and PostGIS instances
  • PostGIS Database: Spatial database extension for PostgreSQL to support geospatial data and queries
  • S3-Compatible Storage: Cloud storage service (AWS S3 or compatible) for persistent file and media storage
  • Node.js/TypeScript Runtime: Required for Directus extensions and custom functionality

Deployment Dependencies

Implementation Details

The template includes several key configuration files:

Docker Configuration:

# Directus runs on the latest version with extensions support
FROM directus/directus:11.9

Extension Structure:

extensions/
  - directus-extension-endpoint-pokeapi/
    - src/index.ts
    - package.json

Automated Schema Management:

# Create snapshots with a single command
cd scripts && pnpm create-snapshot

The setup includes pre-configured SSL certificates, websocket support, and automatic extension loading through the Docker build process.

Why Deploy Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local on Railway?

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 Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local 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.

✨ Features

  • Directus config is pre-configured
  • Install Directus using Docker
  • Directus extensions and websocket are pre-configured
  • Directus version can be updated through Dockerfile
  • Directus extensions can be updated and loaded through Dockerfile
  • PostGIS config is pre-configured
  • SSL certificates is pre-configured using the self-signed Snakeoil certificate for PostGIS
  • Railway Database View is pre-configured
  • Install PostGIS instead of Postgre as Directus recommended for supporting GIS features
  • S3 for persistent storage
  • The communication from Directus to the database is accomplished through the private network, saving its users from egress fees. This reduces the users' exposure to unnecessary egress fees.

💁‍♀️ How to use

  • Click the Deploy on Railway button
  • Let railway deploy your service, most of the configurations have been preset, but feel free to tweak them as you like before deployment.
  • Login in the admin panel using the defined ADMIN_EMAIL and ADMIN_PASSWORD.
  • Use of S3 is a must in this template.

There's a great video tutorial about how to set up an S3 bucket for Directus https://www.youtube.com/watch?v=U7yXFLAwleY&ab_channel=cheddar.

💁‍♀️ Example screenshots

Directus extensions

Directus extensions!

Directus S3 image upload

Directus S3 image upload!

Directus S3 storage

Directus S3 storage!

Railway Database View for Postgis

Railway Database View for Postgis!


Template Content

More templates in this category

View Template
Strapi
A popular self-hosted CMS

View Template
Nitropage
A self-hosted visual website builder and CMS.

View Template
Directus
Turn any SQL database into an API. Optional S3 and WebSockets Included!