Exploring Directus 9
Tags: directus, sql, generic, admin
Published: 2021-04-03 13:00:37

## Intro
Maybe you have heard of the generic DB platform [Directus](https://directus.io/), maybe not. In summary it is an intuitive database management tool that leans a bit towards being an application framework. I.e. the feeling when working in it is more that of designing an application specific solution (with exact use of a relational DB), as opposed to specifying exact details within tables and columns. It is this combination that makes it interesting to me. 

For this article, both are fine. I will give you my description of it, point at the features I think are most innovative and describe various ways I can see myself using it.

Of course, the strengths and interesting use cases I can see depend largely on my particular background. Our backgrounds are likely a bit different. I will share a bit where I come from in this exploration. Maybe there is enough common ground, and maybe enough difference, for something interesting to be communicated. If so, stay put! 

*To clarify:* I am not part of the Directus core team. I am however using it for small scale administrative tasks in my own work, and I see  it as quite likely that I will use it product and in client work. And I do submit patches and suggestions to the project.  

### What is Directus ? 
The basic idea is that we want to expose the structure and relationship aspects of SQL databases in an intuitive and application friendly way. The direction of it is to be able to build something specific and useful with Directus and an underlying SQL database. Basically with just working inside of the Directus app, in the browser. 

In more *entity parlor*, Directus allows us to define entity types, their relations, to set up  forms where we edit/interact with these entities and to display, filter and search tables (or collections) of such entities. All without coding! (at least to begin with...)

The Directus platform has been around and evolved  for some 15+ years now. For more background [look here](https://directus.io/organization/) - with history towards the bottom of the page. It is fully open source and available on [GitHub](https://github.com/directus/directus).

I first got to know of Directus when it was implemented in PHP, and even if I liked aspects of it, that was a bit of a turn off for me (PHP as practical, as battle tested as it is, is maybe not where next generation technologies first appear). I've had my years in PHP (which were fine), but I was ready there. 

A year ago, I discover that the team behind Directus had started migrating the server part of it over to Node.js and TypeScript. I was excited, as this was also where I was headed.

So version 9 of Directus is to be all Node.js and Typescript on the server side, and Vue.js and TypeScript on frontend. To my knowledge, it is one of the first times a more structural application framework is implemented within the Node.js platform.  

At this date (early April 2021) Directus 9.0 is not released yet - but it is nearing. 

### My background and angle
I'm a generic developer who enjoy working on platforms that makes sense. The last decade or so I did backend / full stack work on some different ERP like platforms. The last being implementing e-commerce (and CMS) solutions on the Magento platform (yes... Php). 

I learnt a few things on that road. One is that data types, schemas, entity types (sort of different words for the same thing) is ideally something flexible (or at least extensible, adaptable) on such platforms. In the end, because client needs are like that. 

So it is good to be able to describe these schemas, these entity types, with a combination of more generic code together with some declarative / descriptive configuration. 

I also learnt that (in the world of ERP and their relatives) this generality can become big task to accomplish - if it is to be useful. 

And yes, there are some open source ERP solutions available that do this - like [Odoo](https://en.wikipedia.org/wiki/Odoo) and [ErpNext](https://erpnext.com/). As feature packed and full as these are, they also carry with them aspects such as large footprints, lots of legacy technology, high learning curves, little available (unpaid) support being available. Usually these systems are their own technology stacks - which are sometimes not so main stream. And the effort to implement a small system is usually significant (after all they are geared towards enterprise solutions and budgets). 

So this is where something like Directus comes in. The possibility (with limited means) to build something particular, something structural, relying on the strengths on a relational database, with mostly configuration.  


### My "litmus test"... 

I have a use case that can exercise these qualities. I want to see if it is possible to implement the accounting of my own company, largely relying on the generic capabilities of Directus. 

Accounting (or bookkeeping), as boring as it can appear, relies heavily on structural relations. A **verification** can refer to an **invoice**, it contains several *rows*, where each refer to an **account**, and the sum of *credit* and *debit* on these rows is supposed to sum to exactly **0**. 

And that is just the beginning... 

*To make you worry less about my bookkeeping...:* Yes, I do implement it in another system. But I'm partly motivated by the lack of flexibility (in that system) to pursue this avenue.