In the last few days I’m experimenting with substituting CRUD API code with Stored Procedures which directly produce the endpoints JSON as a single-row scalar value. API is then just a wrapper that authenticates, validates input and streams the DB’s JSON directly to the client.
No ORMs, no SQL generators etc.
All SQL is where it should belong: in the database
API does only single „CALL myfunc(…)“ db calls
A simple centralised error handler can accurately report errors from the database
No weird mixed row/json columns scanning into structs and re-marshalling everything to JSON
Codebase is collapsing to 20% (by LOCs)
Stored Procedures can use wonderfully declarative SQL code
Response times in the microseconds, even for multiple queries, all happens inside the DB
More side effects:
the data model can change and evolve without touching the API at all
Zero deploys mean zero downtime
the API application is so tiny, I could easily switch it to any programming language I want (yes, even Common Lisp) without worrying about available databases libraries, type mapping and rewriting tens of thousands of lines of intermixed language/SQL-code.
The general direction of the dev industry is heading in the opposite direction. More ORMs, more layers, more database abstraction. More weird proprietary cloud databases with each their own limited capabilities and query language.
So you tell me: Is it crazy? Is it wrong? Why do I have doubts despite everything working out beautifully?
Some people say they don't want to join the Fediverse or Mastodon, because they think the UI sucks. As a front end developer, a designer-kind of a person who creates user interfaces, I agree. Most of the web clients on the Fedi are horrendous, even Mastodon by default. There's lots of room for improvement.
We should really focus on how to make it more pleasing to the eye, more modern and more pleasant. This should not be a nerd network, just for geeks to geek out. This is not IRC or BBS.
As long as Mastodon for instance looks like it's designed by a back end engineer, contains font-awesome icons, looks like 2010, and stuff like that, being open and free is not good reason enough for many. I'm not bashing it, Mastodon is not the worst out there, in fact in my honest opinion Mastodon user experience is far better than Akkoma or Calckey for example. It's also more accessible than many modern UIs, for example my visual impaired wife prefers the Vanilla Mastodon UI over my #BirdUI modifications, she has some small tiny improvements of her own like distinguishing the colors in the action buttons as they have no proper contrast in any of the default themes. But that's it. She likes it as it is. So it cannot be that bad. However, it could be better overall.
#OpenSource doesn't mean the product should look like it's created in a basement by a math teacher. For some people Mastodon UX is sufficient (it even is for me, I like it enough and it doesn't prevent me from using it), but it should be WORLD CLASS. I don't say the answer is #MastodonBirdUI but it should be something much more modern and minimal than the current default UI. Pixelfed's developer is a designer oriented, Pixelfed is indeed an example of an awesome Fediverse app experience throughout the web and apps. That is how it should be.