DEV Community

Alex Spinov
Alex Spinov

Posted on

Directus Has a Free API — Instant REST and GraphQL for Any Database

Directus wraps any SQL database with instant REST and GraphQL APIs. No code generation, no ORM — just connect your database and get a full API.

What Is Directus?

Directus is an open-source data platform that sits on top of your SQL database. It auto-generates APIs and provides an admin dashboard for managing content.

Supports:

  • PostgreSQL, MySQL, MariaDB, SQLite, MS SQL, OracleDB, CockroachDB
  • REST API + GraphQL API
  • Authentication and permissions
  • File storage
  • Webhooks and flows

Quick Start

npx create-directus-project my-project
cd my-project
npx directus start
Enter fullscreen mode Exit fullscreen mode

Or Docker:

docker run -d -p 8055:8055 directus/directus
Enter fullscreen mode Exit fullscreen mode

REST API

# Get items
curl http://localhost:8055/items/articles \
  -H "Authorization: Bearer YOUR_TOKEN"

# Create item
curl -X POST http://localhost:8055/items/articles \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title":"Hello","body":"World"}'

# Filter and sort
curl "http://localhost:8055/items/articles?filter[status][_eq]=published&sort=-date_created&limit=10" \
  -H "Authorization: Bearer YOUR_TOKEN"
Enter fullscreen mode Exit fullscreen mode

GraphQL API

query {
  articles(filter: { status: { _eq: "published" } }, limit: 10) {
    id
    title
    body
    date_created
  }
}
Enter fullscreen mode Exit fullscreen mode

Use Cases

  1. Headless CMS — content API for any frontend
  2. Internal tools — admin panel for your database
  3. Data management — visual DB editor
  4. API layer — instant API for legacy databases
  5. Digital asset management — file storage + metadata

Directus vs Alternatives

Feature Directus Strapi Hasura
Any SQL DB Yes No PostgreSQL
REST + GraphQL Both REST GraphQL
No code generation Yes Code-first Yes
Self-hosted Yes Yes Yes
Admin UI Excellent Good Basic

Need web data at scale? Check out my scraping tools on Apify or email spinov001@gmail.com for custom solutions.

Top comments (0)