Video coming soon…

⚡ Setup Directus — Headless CMS & Data Platform

Deploy Directus on Ubuntu with Docker — the open-source headless CMS that wraps any SQL database with a visual data studio, REST and GraphQL APIs, user management, file storage, and real-time subscriptions.

⚠️ This script is provided for demo and testing purposes only. Not intended for production use.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along with the video.

Automated install script — Directus headless CMS running in one command.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/cms/directus/directus-ubuntu.sh
chmod +x directus-ubuntu.sh
sudo bash directus-ubuntu.sh

Tutorial Steps

1 Download & Run the Script

The script installs Docker and starts Directus with a PostgreSQL database and Redis cache. Directus will be available on port 8055. First startup takes 1-2 minutes as the database schema initializes.

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/cms/directus/directus-ubuntu.sh
chmod +x directus-ubuntu.sh
sudo bash directus-ubuntu.sh

2 Access the Data Studio & Set Up Admin

Open your browser and navigate to Directus. Log in with the admin credentials configured in your .env file. The Data Studio is your visual interface for managing collections, users, files, and settings:

http://<your-server-ip>:8055

3 Define Your Data Model & Collections

Go to Settings → Data Model → Create Collection. Add fields (text, number, date, image, relation, JSON, etc.) to define your schema. For example, create a 'Blog Posts' collection with fields for title, content, author (relation to Users), cover image (file), and publish date. Changes are immediately reflected in the API and studio:

# Fetch all items via REST API
curl http://<your-server-ip>:8055/items/blog_posts \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

4 Use the REST & GraphQL API

Directus auto-generates REST and GraphQL endpoints for every collection. Use the built-in API documentation at /server/specs/oas to explore all endpoints. Query with filters, sorting, and field selection. The JavaScript SDK simplifies integration with frontend frameworks:

# GraphQL query example
curl -X POST http://<your-server-ip>:8055/graphql \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query": "{ blog_posts { id title content } }"}'

Ports Used

PortPurpose
8055Directus Web Studio & API
5432PostgreSQL database (internal)
6379Redis cache (internal)

Overview

Directus is a free, open-source headless CMS and data platform that sits on top of any SQL database and instantly provides a visual data management studio, REST API, GraphQL API, and real-time WebSocket subscriptions — without changing your database schema. Unlike WordPress or Strapi, Directus does not impose its own data structure: it introspects your existing tables and generates the interface and API dynamically. This makes it equally suitable as a headless CMS for websites, a backend API for mobile apps, a no-code data management tool for non-technical teams, or an internal admin panel generator.

Why Use It

Directus solves the 'backend API + admin panel' problem in one open-source tool. Without Directus, building a content-driven app requires: designing a database schema, building REST/GraphQL endpoints, creating an admin UI for content editors, implementing file uploads, and adding user authentication. Directus provides all of this automatically once you define your data model. The result: developers get a full-featured API immediately, and non-technical editors get a polished studio for managing content — no custom backend code required.

When You Need It

    Who Should Use It

      Real Use Cases

        Main Features

          How to Use After Installation

            Security Best Practices

              Ports and Firewall Notes

              Open port 8055 (TCP) for the Directus Studio and API. In production, put Directus behind a reverse proxy (Caddy or Nginx) on port 443 with HTTPS and close port 8055 to the public. Port 5432 (PostgreSQL) and 6379 (Redis) are internal to the Docker network and must never be exposed.

              Backup and Maintenance

                Common Mistakes

                  Troubleshooting

                    Alternatives

                    Strapi is the most popular Node.js headless CMS — more opinionated schema management but great developer experience. Payload CMS is a TypeScript-first headless CMS with tight code integration. Contentful and Sanity are hosted headless CMS platforms with excellent DX. Supabase provides a PostgreSQL backend with auto-generated APIs similar to Directus but more developer-focused. WordPress with REST API is a traditional option. Directus stands out for working with existing databases and its non-destructive approach to data management.

                    When Not to Use It

                    Avoid Directus if you need a blog with themes and SEO plugins — WordPress is better suited. Don't use it for applications that require complex server-side business logic in the API — Directus's auto-generated API is for CRUD, not custom server logic (use a custom API framework for that). If your team is already deeply invested in Strapi or Sanity, switching has a migration cost that may not be worth it for small projects.

                    PrismaTechWork Professional Help

                    PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.

                      Contact Us

                      Frequently Asked Questions

                      What is Directus and how is it different from WordPress?

                      Directus is a headless CMS and data platform — it manages your content and data but doesn't prescribe how it's displayed. Instead of WordPress themes, Directus exposes everything via REST and GraphQL APIs that your frontend (Next.js, Nuxt, React, mobile app) consumes. WordPress is a full-stack CMS tightly coupled to PHP themes. Directus wraps any existing SQL database and adds a visual editor, API, user management, and file storage without changing your database schema.

                      What databases does Directus support?

                      Directus works with PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server, Oracle Database, and CockroachDB. Directus introspects your existing database and automatically generates the API and data studio from your schema — you don't need to define models in a separate config file. You can point Directus at an existing production database and immediately get a visual editor and API without migrating data.

                      What APIs does Directus expose?

                      Directus exposes a full REST API and a GraphQL API for every collection (database table) automatically. Both APIs include filtering, sorting, pagination, relational queries, and file uploads. Directus also provides real-time subscriptions via WebSocket for live data updates, and a JavaScript/TypeScript SDK for easy frontend integration. All API endpoints are secured by Directus's role-based access control system.

                      How does Directus handle user permissions and roles?

                      Directus has a fine-grained role-based access control (RBAC) system. You define roles (e.g., Editor, Author, Viewer) and assign permissions per collection, per operation (create/read/update/delete), and even per field. You can restrict access to specific records using dynamic filter rules (e.g., users can only edit records where author equals their own user ID).

                      Can I use Directus as a backend for a mobile app?

                      Yes — this is one of Directus's strongest use cases. Your mobile app (React Native, Flutter, iOS, Android) calls Directus's REST or GraphQL API to read and write data. Directus handles authentication (email/password, OAuth, SSO), user management, file storage, and real-time updates. No custom backend code is needed for typical CRUD operations.

                      Does Directus support file and image management?

                      Yes. Directus includes a built-in file manager with image transformations (resize, crop, format conversion via query parameters), asset caching, and configurable storage backends (local disk, Amazon S3, Google Cloud Storage, Azure Blob Storage). Images are automatically optimized on request — append ?width=800&quality=80 to any image URL to get a resized JPEG without pre-processing.

                      Can Directus replace Airtable or Notion as a team database?

                      Yes for structured data use cases. Directus provides a spreadsheet-like data studio where non-technical users can manage records just like Airtable. You define collections (tables) and fields visually, then team members use the Data Studio to create, edit, and filter records. Unlike Airtable, Directus has no row limits, stores data in your own database, and adds a full API layer for developer access.

                      What are Directus Flows and how do they work?

                      Directus Flows is a built-in automation engine similar to Zapier or n8n. You create flows triggered by events (when a record is created, on a schedule, via webhook, or manually) and chain operations: send an email, make an HTTP request, run a script, create/update records, or send a notification. Flows enable automations like 'send a Slack message when a new order is placed' without external tools.