Skip to content(if available)orjump to list(if available)

Directus – real-time REST and GraphQL API of any SQL database

jckahn

Directus has its small-scale and short term benefits, but I can’t recommend building a production-grade app with it. My company uses Directus and we all hate it and are desperately trying to get away from it. Avoid.

jaros

I’m in a similar situation. At first it looked very promising and was benefiting us in bootstrapping the project fast but after a while you’re being slowed down by the “extensions” ecosystem. If you have a bunch of complex extensions then building all of them can take 2 minutes (m3 pro MacBook). Forget instant hot reloading.

tjwds

Out of curiosity, what don’t you like about it?

jckahn

Off the top of my head: It surfaces only useless GraphQL error messages to the front end, it’s very frustrating to stand up custom REST endpoints, and the Flow system is painful to develop with and debug. Others on my team have different gripes with it.

rijkvanzanten

Thanks for the feedback!

o_____________o

The eternal red flag of a DB UI that tries to support wildly different backends explains a lot of the problems. Many sane and powerful Postgres features can't be used because Directus also needs to support SQLite, for example. Views not properly supported, search features inadequate, graphql DSL with arbitrary limitations, a lot of weird or dysfunctional relational patterns when something much simpler would do... it's a parallel, inferior system on top of stock pg that is very frustrating when used at some depth.

Davidiusdadi

Since they support so many databases the integration with specific providers is very shallow - e.g. they do not allow to make use of SQL views.

I personally found the typescript support disappointing in general but specifically around strict null handling. Their graphql schema was also declaring far to many fields as nullable which was a deal breaker for me looking for at least one way to generate precise typescript typings.

codr7

Not having even the shadow of a control layer in your app is bound to come back and bite you imo.

golergka

How does it measure up to Hasura?

jckahn

No idea, I’ve never used that.

golergka

This sounds like a very similar service to Hasura, and I just loved using it. I also have some of former colleagues building it, and they've been one of the best engineers I've ever had privilege of working alongside of. If you're already using a tool that occupies very similar place in your stack, I would really suggest evaluating a migration.

xvinci

Microsoft has something very similar (i did not do a full feature comparison, just speaking about apis and auth) which is mit licensed. Works also with on-prem databases despite it's name. https://github.com/Azure/data-api-builder

claytongulick

That looks really interesting, but maybe only useful for mssql? [1]

[1] https://github.com/azure/data-api-builder/labels/known-issue

RadiozRadioz

Had a play around with it, I'm impressed. I was very worried and put-off when I saw the nice-looking UI and flashy transitions, but this actually plays quite nicely with my database.

Unfortunately it doesn't work on Firefox 115 ESR due to

    Intl.Segmenter is not a constructor
It's just a blank screen. So it is infected by the JS change treadmill somewhat.

I have a few other thoughts from my first try:

When using Directus on a pre-existing DB, your foreign keys need to have exactly the same type as the primary keys they are referencing for Directus to pick up on the relationship. For example, if you have `customer.id INT PRIMARY KEY`, you must reference it with `order.customer_id INT FOREIGN KEY REFERENCES customer (id)`. You cannot do `order.customer_id INT NOT NULL FOREIGN KEY REFERENCES customer (id)` , else Directus won't notice.

I also found it fairly slow to pick up on schema changes I made in the DB directly, and I didn't see an obvious way to force it to discover.

When using Directus to manage the DB schema, I found the tables it created to have a generally sane and simple schema, which is refreshing. I liked the choices here more than nocodb.

I can't comment on the REST/GraphQL generation. I'm mainly interested in the admin panel features.

The compose file they provide here works: https://docs.directus.io/self-hosted/docker-guide.html

Overall I think this works best if your data model is very clean. It would probably be painful to onboard a complex legacy DB. I think this is totally fine as a small-scale org data management tool. I was going to make one of these, but I don't need to now. Thanks for sharing.

thederf

At work we have two applications in production with Directus, a CMS and a CRM, both highly specialized (~35 custom extensions) for our use-cases.

We've had our teething issues, mostly with migrations and the UX in some areas, but overall it has saved us a ton of dev time and been a great force multiplier for us.

I also use it at home to manage my notes, tasks, and such as structured data.

Keyframe

seems cool, but weird non-oss license ahead warning.

lol768

It used to be actual FOSS but then they went down the route of making it nonfree.

I sort of get why, but not really a fan of how they went about doing it (and arbitrary "revenue-based" thresholds really don't work for businesses that operate on a commission/agent basis - you can have a massive turnover but huge cost-of-sales - it's a very blunt instrument). For that reason I've kept self-hosting the older, actual-FOSS versions and they're just sat behind auth. I've not looked at alternatives yet but would be interested in any suggestions

rijkvanzanten

I hope https://news.ycombinator.com/item?id=43163761 can change the "I sort of get why" into a "I get why"~

yladiz

It’s free for individuals and organizations that make less than $5 million in revenue. Seems fine and not weird to me?

speedgoose

If a fair offer, but it’s not open source compatible.

yladiz

Sure, but am I missing something and it says it’s open source?

rustc

And the price is "Contact our sales team" [1] for self hosting for those with > $5 million revenue. Seems like not a good idea if you think you're ever going to reach that number.

They also considerably increased their cloud hosted pricing from $25/month unlimited to $500/month for 10 user + 250k rows + 1 million API requests.

Old pricing: https://web.archive.org/web/20220619075129/https://directus....

[1]: https://directus.io/pricing/self-hosted

luke-stanley

It's not a normal license. It's not worth the hassle.

pan69

Just out of curiosity, what is "a normal licence"?

rijkvanzanten

Just to give a bit of context as to how/where/why that comes from (-apologies for the wall of text. Don't want to skip over anything important in the pursuit of brevity :) ):

Our current license — BSL-1.1 as created by the team at MariaDB) — is as close as we have gotten to being as open source as possible without having the project disappear into thin air.

For the first few years, we were trying to make it work as GPL-3 (eg a "normal" OSS license), but there were simply not enough contributions (time or money) to make that sustainable. We went the donation-ware route first. Make it free and open source to everybody, but entice people to give back in either time (PRs) or money (so we can find a dev to do the same work).

We noticed two things almost right away: Most folks will default to not donating at all, cause why would you pay for something you can get for free, and secondly the people who _did_ contribute where predominantly individuals or small businesses. Generally speaking the more value a group was getting out of the project, the less they were helping to maintain it. At the height of our donation-requesting campaigns (in mid-late 2022, ~15k GH stars) we received about $1k monthly from sponsorships. It took about 4 full time folks at minimum to maintain the project. That obviously wasn't sustainable.

Our next approach was to go with a paid-hosting model. Keep the software itself free, but charge for hosting services around it. This works relatively well, but comes with a catch: you have to make self-hosting as inconvenient as possible, or make a "premium SaaS only" version to differentiate with the free offering. Both of those things are antithetical to what I'd like to see in a project. To me, an open source product shouldn't just be a marketing vessel to get people into a proprietary SaaS (opinion!).

That left us with a choice. Are we going to either A) make it a closed-source SaaS exclusively, B) make it a freemium-style open core, or C) find some other approach. We went with the latter. With an delayed-open-source-license w/ a usage grant that allows all the community members that historically contributed to use it for free, we found a balance between keeping it as open source as possible, while making sure large companies that make a lot of money using it are required to contribute back.

Many bigger open source projects — effectively anything that takes more than ~10h a week to maintain — will run into the open source funding problem. Some projects make it work by being a low-level building block of a bigger paid thing that makes the investment back (think react/facebook and now react/next/vercel), some projects do the hosted route but make/keep self-hosting difficult/expensive (think Discourse), some projects make core features paid so it's more of a freemium model (think Payload), and some projects (like Directus) try a more novel approach to solving the funding problem by finding a way to charge the folks that have the resources and don't otherwise contribute.

There's a lot of movement in the post-open-source world. Companies like N8N are exploring ways to adhere to the open source ideology, but have commercial restrictions in place (https://faircode.io/), Sentry is making great strides in a similar direction with Fair Source (https://fair.io), and other large projects like CockroachDB are adopting similar licensing strategies. While these and our own approaches conflict with rules 5/6 of the open source definition, I strongly feel like this delayed-open strategy w/ a clear funding model is the closest we've gotten to sustainable open source yet. It's definitely not perfect yet, but it's getting somewhere.

No matter what, any body of work that takes a meaningful amount of time eventually needs to generate enough money to be able to keep investing the time. I remain hopeful we as an industry can find a way to keep the good of open source, while removing the burden on the random person in Nebraska.

zephyreon

They’re subjective with how that’s enforced. We used it in a higher ed institution in a small department and they reached out to us demanding we fork over (a lot of) cash to continue use. They considered the entire institution’s budget as the deciding factor.

Yes, that aligns with the license, but I’ve found most companies will negotiate in good faith when the use is limited within an organization. This felt very Oracle-like.

rijkvanzanten

The cost is based on usage, not on company size. The threshold is just to check _if_ you're required to get a license. If the use is limited, so will the price.

Education is a tough industry wrt pricing / budgeting, _especially_ in the USA. Oftentimes individual teams have a $0 budget even if the school makes (massive) profit. I've seen this first-hand as well! I am a part-time professor at Parsons, and it's a similar story there. Our program / faculty team has a near-$0 budget for things like software / guest-speakers etc, meanwhile tuition is tens of thousands per semester per student, and the school makes millions in profits every year. Make it make sense!

That of course doesn't apply to every school, and certainly not elsewhere on the planet, which is why we rely on a sales team to adjust contracts accordingly rather than have a (higher) flat fee for everybody.

the_real_cher

I think like me you saw the cloud section and thought it was a paid product for a minute.

socketcluster

I made something kind of similar https://saasufy.com/ but currently only tied to a single database but particularly good at scaling real-time updates. I'm looking for a non-tech co-founder who can drive to a niche use case.

As an example of its capabilities I built this from scratch without frameworks and completely server-less (basically just a .html file, .css file and a couple of .js files hosted only on GitHub): https://www.insnare.net/app/#/dashboard/company-filter/tags%...

That entire app is less than 4K lines of code; all frontend code.

4ndrewl

This seems very similar to Hasura? What does it compete with them on?

abol3z

I have good experience in directus. Out of the box it gives you REST, Graphql, and Realtime websockets to your models.

You can pretty much customize all parts, and the extensions sdk is pretty comprehensive.

I think hasura is only for Graphql, and from what I saw, writing custom logic is done through webhooks only?

null

[deleted]

masonwr

I have had great luck with Directus building small/medium size apps. Keep up the good work!

robertclaus

I used this to bootstrap a small community page with a handful of admin users that entered content. The users were technical enough to be comfortable with the interface, but wouldn't have been able to use SQL directly. It saved building out the CRUD interfaces with the ~4 hours a week of dev time we had at the time. It took us a few months to get around to the CRUD interfaces, so it felt well worth it.

__jonas

I’m using this as an admin UI on top of an existing database, it works pretty well for that, it’s nice that it doesn’t dictate your db schema. I don’t really see the point of their “flows”, and I’m not sure how the auto-generated APIs hold up under load, but I’d recommend it for content management if you are ok with the license (it’s not FOSS).

denvrede

Does anybody know something like Directus (building REST APIs on top of Postgres) with the ability to hook in custom authorization logic? (E.g. to do FGA checks before returning data)

bryantgillespie

You can certainly add whatever logic you want / need using custom hooks in Directus.

Here's the docs for custom hooks. https://directus.io/docs/guides/extensions/api-extensions/ho...

But honestly, depending on the complexity of your logic you may not even need custom hooks. You can get really granular with the built-in access policies and permissions.

As long as you have relationships configured with the user collection you can reference those in your permissions.

Here's an example rule for accessing items within a `projects` table that hides any projects that don't belong to the current agency partner.

{"_and":[{"partner":{"id":{"_eq":"$CURRENT_USER.agency_partner_id.id"}}}]}

Each project a many to one relationship to agency_partners. Each user has a many to one relationship to agency_partners.

You can even scope this down to allow / hide specific fields if you want.

whilenot-dev

I wrote my own extension in version 9 some time ago where I used hooks to track changes and sync our Full-Text Search engine (Meilisearch). I just remembered some of the difficulties dealing with hooks, because their payload differed in structure depending on how data entries were mutated (update via Web-UI VS creation via API VS import via API /utils/import). Has that improved?

bryantgillespie

Almost forgot - full disclosure - Bryant here from the Directus core team.

bigjump

Pretty sure you can do this with hooks / flows in Directus.

pacifika

If you’re dealing with pure SQL of a third party system, instead of an API, then you’re designing the API without domain knowledge. This is a problem in my experience.