This Tool Turns Your SQL Database Into a Backend Instantly (Directus)

BBetter Stack
Computing/SoftwareSmall Business/StartupsInternet Technology

Transcript

00:00:00Okay, so how many times have you rebuilt the exact same backend?
00:00:04CRUD, auth, admin panel, file uploads.
00:00:07A lot of the time, what looks like building is usually just rebuilding.
00:00:10What if you could point one tool at your existing SQL database and get a full backend?
00:00:15That's Directus, a real-time API and app dashboard for managing SQL database content.
00:00:21A lot of devs are starting to realize they've been doing this the hard way the whole time.
00:00:25Let me show you how all this works in just a few minutes.
00:00:30[MUSIC]
00:00:33The biggest backend problem for most of us isn't complexity, it's repetition.
00:00:38We're not solving new problems, we're wiring the same code again and again,
00:00:42and that really just eats into our time.
00:00:44Directus cuts all that out.
00:00:46It connects straight to your Postgres, MySQL, or Oracle database.
00:00:50No migrations, no rebuilding your whole schema somewhere else.
00:00:53We instantly get REST and GraphQL APIs,
00:00:57field-level permissions, real-time subscriptions,
00:01:01flow and automations, file handling, and a clean admin UI.
00:01:05Now, the cool part here is your database just stays.
00:01:08It's not some duplicate layer.
00:01:10That matters way more than it sounds.
00:01:12Now let me show you.
00:01:13If you enjoy open-source tools and coding tips to speed up your workflow,
00:01:17be sure to subscribe.
00:01:18We have videos coming out all the time.
00:01:20All right, now starting from absolute zero with a clean Directus install,
00:01:24no database tables, nothing preloaded.
00:01:27Just a completely blank canvas after I already made an account here.
00:01:32And instead of connecting to something that already exists,
00:01:34I'm going to build a full order management app in just a minute or so.
00:01:39First, I create a collection and I'll just name it Orders, just like this.
00:01:45That's it.
00:01:45Now the app has a place to store data, and we can add more details into it now.
00:01:51I'm going to select and override the ones we need here,
00:01:54so things like customer, date, really all that fun stuff.
00:01:58Then I can manually add in any other fields
00:02:00that we would think we would need for something like this.
00:02:03So I could say customer name, email, product as a dropdown,
00:02:08where I can add a key and a value.
00:02:10I can do that for amount and status.
00:02:13Each field adds more detail about the data that we're going to store.
00:02:16And notice what's missing here.
00:02:18Well, it's SQL.
00:02:19There is no SQL.
00:02:20There's no migrations.
00:02:22There's no switching tabs to write a schema file.
00:02:25It just saves right here in Directus immediately.
00:02:28Now I can just jump into the content view and start adding orders.
00:02:32So I can add the first order here, just a dummy account.
00:02:35I'll add another one.
00:02:36And then we can add a third one, right?
00:02:39We have three different orders right here in the system.
00:02:42Now I have some real data here that we could start to play with.
00:02:45But right now it's wide open, which means anyone could do anything.
00:02:49So let's fix that.
00:02:50How do we fix that?
00:02:51Well, with permissions.
00:02:53So I go to the public role.
00:02:55I'm going to find that collection we made orders.
00:02:58We can turn read on.
00:03:00And I'm going to make sure everything else here is turned off.
00:03:03So create, update, delete.
00:03:05Those are all gone.
00:03:06Now it's more controlled and safer for what we want.
00:03:10Okay, here's where it starts to get really cool
00:03:12because we can do some automation and build out flows surrounding this.
00:03:16I'm going to go over here and I'm going to create a new flow.
00:03:19I'm just going to name it something really simple, what is this?
00:03:22So I'm going to notify on a new order.
00:03:24Simple name, it has my purpose.
00:03:26And I will select everything from items in the collection we made called orders.
00:03:31Now I can build out a trigger.
00:03:33And for the trigger, I hook into when a new item is created,
00:03:37specifically in that orders collection.
00:03:39So now every time a new order comes in, something is going to happen.
00:03:43I'm going to add in an operation.
00:03:44We're going to send an email.
00:03:46It's going to write a subject.
00:03:47I'm going to add my email to this.
00:03:49And then in the body, I'm going to pull in the order data.
00:03:52So anytime a new order goes in, it's going to push that data through into an email.
00:03:56Now I can save this operation and we're going to save the flow and we're done.
00:04:00Okay, now watch this.
00:04:02I'm going to go back.
00:04:03And in my starting Docker compost file, I added mail pit to test this out.
00:04:07This is just a super simple way to test out that email send function.
00:04:11When I make one more order, just like before, nothing fancy,
00:04:14but this time something is different.
00:04:16This now triggers the flow automatically and an email goes out with the details.
00:04:20There's no backend logic here.
00:04:22There's no wiring things together.
00:04:25This started as nothing, no tables, no backend, no real structure here.
00:04:30And in just a few minutes, it's a working app with data permissions and yes,
00:04:33automation, which was the cool part.
00:04:35And this is what makes Directus feel pretty cool.
00:04:38It's almost like a combination of visual database logic with something like N8N or Zapier built in,
00:04:43but that's not really who it competes with.
00:04:45So what is Directus exactly?
00:04:47It's an open source data platform that sits on top of your SQL database.
00:04:52It doesn't sit beside it.
00:04:53It sits on top of it.
00:04:55That database first model is the whole point, right?
00:04:58So what does this really mean?
00:04:59Well, it means a few things for us.
00:05:01It means there's no lock-in.
00:05:03The full SQL is still there and it works with legacy systems.
00:05:07That's why people use it for things like SaaS backends, internal tools, headless CMS setups,
00:05:13AI agents with controlled data.
00:05:15You're trying to modernize some old system without rewriting everything.
00:05:19Your database is the actual engine here.
00:05:21Directus just gives it a dashboard and controls.
00:05:24Now, at first glance, if you played with other tools like Strapi, Payload, Hasora,
00:05:28and Directus is going to look similar to this, but they actually solve different problems.
00:05:33Strapi and Payload are code first.
00:05:36You define the schemas in code, then rebuild your structure there.
00:05:40Yeah, that does work, but it's extra work.
00:05:42Directus changes a few things with some tweaks.
00:05:45Your schema already exists, so instead of recreating it, you just connect it.
00:05:50Different workflow entirely here.
00:05:52Hasora is great for fast GraphQL, but Directus goes even wider than just this.
00:05:58You're getting APIs.
00:05:59Yes, we do get that, but we're also getting admin workspace, permissions, files, and automations.
00:06:05And here's the part most devs care about after trying it out, permissions.
00:06:10I'm not talking about just rules here.
00:06:12We're talking about real control with no plugins.
00:06:15So if your problem is I need backend, you've got options.
00:06:18If your problem is I don't want to rebuild my backend again, this is different.
00:06:23Now, obviously, no tool is perfect, but this is pretty neat.
00:06:26What did I think was super cool?
00:06:28Well, the permissions just work.
00:06:29That's awesome.
00:06:30Flows remove a lot of the busy work we're doing.
00:06:32The UI was really clean and fast, and it's easy to deploy with Docker.
00:06:37On top of all that, it scales really well.
00:06:39But with all this good stuff, of course, there's always these drawbacks.
00:06:43So the trade-offs are going to be things like advanced flows can take time, right?
00:06:46If you've ever played with N8N, anything else, you get it.
00:06:49Docs are not always there.
00:06:51And if you self-host, you need to manage the infra yourself.
00:06:54Plus, complex setups can get messy locally.
00:06:57Directus just removes a very specific kind of repeated backend work.
00:07:00So is Directus worth it?
00:07:02For a lot of us, probably, yeah.
00:07:03It depends on what we're doing, especially if you already have SQL data, or if you're
00:07:07tired of rebuilding these basic backends we're doing all the time over and over, then yeah,
00:07:11this is some real value.
00:07:13It saves time, it reduces maintenance, and you keep control of the data.
00:07:17Once again, it's open source.
00:07:19We control that.
00:07:20When would you not use this?
00:07:22Well, if you're in a strict typescript, like a huge monorepo, probably not, right?
00:07:26If you don't have an existing database, probably not.
00:07:29And you want everything defined in code from the start, then something like Payload just
00:07:33makes a lot more sense here.
00:07:34But if you're thinking right now, wait, this can just sit on top of my database?
00:07:38Yeah, it can.
00:07:39So it might be worth trying.
00:07:41If you enjoy open source tools and coding tips like this one, be sure to subscribe to the
00:07:45Better Stack channel.
00:07:46We'll see you in another video.

Key Takeaway

Directus eliminates repetitive backend development by sitting directly on top of existing SQL databases to instantly provide APIs, granular permissions, and automation flows without altering the underlying data structure.

Highlights

Directus connects directly to Postgres, MySQL, or Oracle databases to generate REST and GraphQL APIs without requiring migrations or schema rebuilding.

The platform provides field-level permissions, real-time subscriptions, file handling, and a full admin UI while remaining a non-intrusive layer over existing SQL data.

A working order management application with data storage, permissions, and automated email notifications can be built from a blank canvas in approximately one minute.

Built-in automation flows allow users to trigger operations like sending emails via Mailpit by hooking into events such as new item creation in a collection.

Directus differentiates itself from code-first tools like Strapi and Payload by using a database-first model that eliminates the need to recreate existing schemas in code.

Open-source deployment is supported via Docker, making the tool suitable for SaaS backends, internal tools, and modernizing legacy systems without data lock-in.

Timeline

The repetitive nature of backend development

  • Development time is often consumed by rebuilding standard features like CRUD, authentication, and admin panels.
  • Directus functions as a real-time API and dashboard layer for managing SQL database content.
  • Direct connection to Postgres, MySQL, or Oracle avoids the overhead of manual migrations or schema duplication.

Standard backend tasks often involve wiring the same code repeatedly rather than solving unique problems. By pointing a single tool at an existing database, developers gain instant access to REST and GraphQL APIs, field-level permissions, and real-time subscriptions. This approach ensures the database remains the primary engine rather than a duplicate layer, preventing the common issue of data fragmentation.

Building an order management system from scratch

  • Collections and fields are created visually within the interface without writing SQL or schema files.
  • Data fields such as customer name, email, and product dropdowns define the structure of the stored information.
  • New data entries are added and saved to the database immediately through a simplified content view.

Starting from a blank canvas, an order management application is constructed by defining a collection and its associated details like customer info and order status. This process eliminates the need to switch between tabs for writing migrations or SQL commands. The visual interface allows for manual field additions, such as product keys and values, which map directly to the underlying database structure.

Configuring permissions and automation flows

  • Public access is restricted by toggling specific CRUD permissions for each data collection.
  • Automation flows trigger actions, such as sending emails, based on specific events like item creation.
  • Integration with tools like Mailpit facilitates testing of automated email functions within a Docker environment.

Security is established by modifying roles, such as setting a public role to read-only for specific collections while disabling create, update, and delete functions. Automation is achieved by building flows that hook into the database lifecycle; for example, a new order entry triggers an operation to pull data and send a notification email. This logic requires no backend coding, combining database management with capabilities similar to visual automation tools like Zapier or N8N.

Comparison with other backend platforms

  • Database-first architecture prevents vendor lock-in and works effectively with legacy systems.
  • Strapi and Payload prioritize code-first schemas, whereas Directus connects to schemas that already exist.
  • Hasura focuses on GraphQL performance while Directus provides a wider feature set including file management and admin workspaces.

Directus is categorized as an open-source data platform that sits on top of, rather than beside, a SQL database. This model is useful for modernizing old systems or building headless CMS setups because the original SQL remains intact. While other tools require rebuilding structures in code, this method utilizes the existing database as the engine, providing a ready-made admin workspace and robust permission controls without additional plugins.

Selection criteria and technical trade-offs

  • Trade-offs include time-intensive advanced flow configurations and the responsibility of managing self-hosted infrastructure.
  • Directus is less suitable for large monorepos with strict TypeScript requirements where code-defined schemas are preferred.
  • The tool offers high value for projects with existing SQL data or those seeking to reduce maintenance on basic backends.

The platform excels in speed and UI clarity, though users must manage their own infrastructure when self-hosting and navigate documentation that may be incomplete for complex setups. It is specifically recommended for developers tired of rebuilding standard backends who want to keep full control of their data. Conversely, projects requiring everything to be defined in code from the start might find tools like Payload more appropriate for their specific workflow.

Community Posts

View all posts