Thanks for asking! This piece has gotten bit long, so I considered opening a new thread for it but I feel it’s actually on topic, so unless any of the moderators feel differently about this, here’s how I use Directus for small Clojurescript websites:
API Security has been a non-issue so far
The Directus API does offer authentication via access tokens. However, being quite new to web development I’ve been pretty paranoid about security; so up until recently I have successfully avoided the need to actually use the auth mechanism: Most of my data is either public for reading or completely off limits via the API. Directus offers fine grained control over the permissions for reading/writing tables and fields – publicly, via authentication (or not at all).
Using only partially public access is completely sufficient as long as I only cater to a closed user base, i.e. I add the content creators manually to Directus and provide them with rights accordingly. So, for now, I ultimately rely on Directus’ account and permission management for security.
Simple Example Project
Directus allows non-technical users to edit a SQL Database in many different ways. As an example you can look at the very first website I’ve made, for a musician. Among other things she needed the ability to manage programs, performers and concerts (connecting them to one another). The underlying SQL looks something like this:
Performers:
| name | id |
|---------------+----|
| Solo | 1 |
| Trio Sérénade | 2 |
| Duo Adamé | 3 |
Programs:
| title | composer | id |
|----------------+----------------+----|
| Trio Piazzolla | Piazzolla | 1 |
| Hallelujah | Leonhard Cohen | 2 |
| preludes | Chopin | 3 |
Concerts:
| date | program_id | perfomer_id |
|------------+------------+-------------|
| 12.12.2020 | 2 | 3 |
| 14.01.2021 | 1 | 2 |
Directus offers several Frontend Interfaces for the various SQL relations which are created in one go with the tables and fields. The Interface for the O2Ms above looks like this (German, sorry):
To the left are the various collections (≙ SQL tables). When adding a new concert item (≙ SQL row) I get to fill relational fields via dropdowns (or other means). This Interface works very well for non-technical users but is still totally transparent as to the underlying SQL (unlike WordPress @John_Shaffer). Directus offers several interfaces per SQL relation – one of them for multilingual content, which makes internationalization quite easy.
Most of these Interfaces are content-agnostic. In case none of the built-in interfaces make sense of the SQL, one can either write a custom one (in Angular ) or make something separate that works on the Database directly (or via API) – Directus won’t mind and just reflect any changes in case it is hooked up to the tables concerned.
Clojurescript integration (without overkill)
There’s not even much to be said here. Directus automatically provides API endpoints for every public collection. So anyone can query the concerts collection with e.g. …/items/concerts?fields=id,date,performer.name,performer.id
(I use some wrapper to generate these queries from nested Clojure vectors). In Clojurescript that gives me
[{:id 79
:date "2021-01-14"
:performer {:id: 2
:name: "Trio Sérénade"}}
{:id 139
:date "2019-10-26"
:performer {:id 2
:name "Duo Adamé"}}]
I have a generic handler that asynchronously fetches multiple collections and then forwards them to a page formatter that processes them first to hiccup and then to HTML. Also I have written a couple of Directus-specific transformers, e.g. for multilingual collections etc. Maybe eventually, when I feel more confident about what I’m doing, I’ll make these into a small library or shadow-cljs-template.
TL;DR Without Directus I’d probably be deep down the WordPress rabbit hole by now. I give it to my clients to manage multilingual dynamic websites that are rather small, but highly customized – with the occasional Reagent app for advanced interactivity.
Disclaimer: If any of the above sounds like I’m promoting Directus it’s only because it really helped me get started with Web Development and allowed me to use a Lisp in the process… also the maintainers around Ben Hanyes have helped me out on several occasions… so they deserve some good rep. I have no stock in them or anything