Interesting take on letting the database run the show instead of the framework. Nice point about how event driven behavior feels way cleaner than constant polling. Makes me wonder in what ways this approach could simplify messy microservice setups.
No Code in the Database... Right?
1 Comment
It is useful if you have many micro-services or want to use event driven data flow. For example, at InfraSonar we have a simple procedure which set's the theme for a user (this procedure accepts a user_id and the theme). If this procedure is executed, the new theme is automatically stored and all browsers instantly change theme as the change is pushed as an event to the listeners. (of course, the user listens to his/her own channel). Using ThingsDB this is implemented with just a few lines of code, no extra message hub, database or anything else is required. This is the code:
new_procedure('set_user_theme', |user_id, theme| {
user = User(user_id);
user.theme = theme;
.event_root_app.emit('set-theme', user.wrap('_User'));
});
In this code, User is the type, and _User is a type where we defined the schema which we return with an event.
@[Peter Jones] I've created a new blog entry featuring a small, practical example that illustrates how to establish a collection under complete API control. This post details the necessary steps for securing the ThingsDB collection by using a typed collection and funneling all external writes through validated procedures. See: https://coderlegion.com/8421/schema-first-approach-with-thingsdb
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- Premium Subscription
- Terms of Service
- Refund
- Early Builders
More From joente
Related Jobs
- Database Engineer/Administrator (SQL)Leidos · Full time · Springfield, MO
- Programmatore Graph DatabaseTechnode Spa · Full time · Italian Republic
- PHP Developer - Laravel, CodeigniterGlobalsoftwaresolution · Full time · California, MO
Commenters (This Week)
Contribute meaningful comments to climb the leaderboard and earn badges!