@aral@mastodon.ar.al avatar aral , (edited ) to random

Made a little logo for JSDB (JavaScript Database)

Better (six years) late than never? :)

https://github.com/small-tech/jsdb/issues/6

ALT
@aral@mastodon.ar.al avatar aral , to random

🥳 JavaScript Database (JSDB)¹ version 7.0.0 released

  • Breaking change JSTable.PERSIST event now uses a parameter object with properties for type, keypath, value, change, and table. This should make listening for events on your databases much nicer to author. e.g., a snippet from Catalyst² I’m working on:
const settingsTable = db.settings['__table__']  
const JSTable = settingsTable.constructor

settingsTable.addListener(JSTable.PERSIST, ({ keypath, value }) => {  
 switch (keypath) {  
 case 'servers.serverPoolSize':  
 console.info('New server pool size requested', value)  
 this.updateServerPool()  
 break  
 // etc.  
 }  
})  

This new version of JSDB is not in the latest Kitten³ yet as it is a breaking change and I want to make sure I update my sites/apps first if needed. I should have it integrated tomorrow.

To see the simple use case for JSDB in Kitten (the default untyped database that’s easy to get started with and perfect for quick experiments, little sites, etc.), see: https://kitten.small-web.org/tutorials/persistence/

For a more advanced tutorial for creating your own typed databases in Kitten, see the Database App Modules tutorial: https://kitten.small-web.org/tutorials/database-app-modules/

For another example, see: https://codeberg.org/small-tech/jsdb/#table-events

Full change log: https://codeberg.org/small-tech/jsdb/src/branch/main/CHANGELOG.md#7-0-0-2026-02-10

Enjoy!

💕

¹ https://codeberg.org/small-tech/jsdb#readme
² https://catalyst.small-web.org
³ https://kitten.small-web.org

aral OP ,
@aral@mastodon.ar.al avatar

🥳 New Kitten release

Just released a new version of Kitten that now includes JSDB 7.0.0 with its improved JSTable.PERSIST event.

https://kitten.small-web.org

Note that this is a breaking change. If you’re listening for the old 'persist' event, please update your code.

For more information, please see the changelog: https://codeberg.org/kitten/app/src/branch/main/CHANGELOG.md#breaking-changes

Enjoy!

:kitten: 💕

@aral@mastodon.ar.al avatar aral , to random

🥳 JavaScript Database (JSDB) version 6.1.4 released:

• Adds TypeScript type definitions

Been meaning to do this for a while and finally got round to it :)

https://codeberg.org/small-tech/jsdb#javascript-database-jsdb

@aral@mastodon.ar.al avatar aral , to random

I haven’t added an example of how you implement migrations with Kitten’s¹ built-in JSDB database² yet but here’s one that I just used when renaming a field (property) in a table (JavaScript object) from “account” to “data” that illustrates the general granular approach you should take within persisted instances of JavaScript classes.

This is, of course, an advanced use case of the built-in JavaScript database that all Kitten apps have.

Kitten is simple for simple use cases. So check out the Persistence tutorial, for example, to see how easy it is to get started with JSDB in Kitten:

https://kitten.small-web.org/tutorials/persistence/

And see the Database App Modules tutorial for a more advanced usage where you persist instances of JavaScript classes and have full type safety:

https://kitten.small-web.org/tutorials/database-app-modules/

¹ https://kitten.small-web.org
² https://codeberg.org/small-tech/jsdb

Screenshot of code for app_modules/database/Model.js. The following code is highlighted with a pink border: /** Optional hook: override this to perform initialisation at constructor time. (Do not override the constructor or the automatic property assignment will fail.) / initialise () {} Full code listing: /* Base model class. (To use, extend this with your own model classes.) When adding properties in subclasses, make sure you only set values after checking if the value already exists: e.g., class MyModelObject extends Model { mySpecialProperty = this.mySpecialProperty || '' } (This way, you will get type safety while authoring without accidentally overwriting any values populated by the superclass when model objects are recreated when a JSDB table is read into memory.) / export default class Model { id = crypto.randomUUID() constructor (parameters = {}) { Object.assign(this, parameters) this.initialise() } /* Optional hook: override this to perform initialisation at constructor time. (Do not override the constructor or the automatic property assignment will fail.) */ initialise () {} }

ALT
@aral@mastodon.ar.al avatar aral , (edited ) to random

👋🤓 Goodbye Site.js, Hello Kitten!

I started working on creating a Small Web¹ server (a peer-to-peer Web server) six years ago² with Site.js.

Building Site.js was my first attempt. And it resulted in:

• Auto Encrypt (automatic Let’s Encrypt certificates): https://codeberg.org/small-tech/auto-encrypt

• Auto Encrypt Localhost (automatic localhost TLS certificates): https://codeberg.org/small-tech/auto-encrypt-localhost

@small-tech/https (drop-in Node.js https module replacement with automatic TLS certs everywhere): https://codeberg.org/small-tech/https

• JSDB: In-process, in-memory JavaScript database that persists to append-only JavaScript logs: https://codeberg.org/small-tech/jsdb

As Site.js reached an evolutionary dead-end, and as I learned from my experiements with replicated data types that replicated data types are not a prerequisite for a decentralised web (actual topological decentralisation and ease of use are), I started writing a new server/platform called Kitten from scratch while still making use of the tried and tested modules listed above.

Last week, I switched over our last site using Site.js to Kitten and, with that, today I’ve sunset³ Site.js:

https://sitejs.org

For its successor, please see Kitten:

https://kitten.small-web.org

If you want to support our work at the Small Technology Foundation, please consider becoming a patron:

https://small-tech.org/fund-us

:kitten:💕

¹ https://ar.al/2024/06/24/small-web-computer-science-colloquium-at-university-of-groningen/
² https://ar.al/2019/08/26/introducing-small-technology-foundation/
³ Using our instance of Look Over There!: https://look-over-there.small-web.org

ALT
@aral@mastodon.ar.al avatar aral , to random

🔒 New Kitten & JSDB Releases

Security fix, JSDB 6.0.1.

This is a critical update.

• JSDB¹ versions 6.0.0 and below suffer from potential data corruption/arbitrary code execution as string keys were not being sanitised in the same way string values were² (so this is relevant to you if you’re storing untrusted data as keys in your data structures in JSDB and/or Kitten databases without carrying out any of your own sanitisation at the application level).

• The latest Kitten release uses JSDB version 6.0.1. Your deployment servers will automatically update in the next few hours. On your development machines, please run kitten update in your terminal or use the Update feature in Kitten Settings from your browser.

• If you are using Kitten’s Database App Modules³ feature in your apps, you will have installed JSDB manually and you should update your installation to version 6.0.1.

¹ https://codeberg.org/small-tech/jsdb/
² https://codeberg.org/small-tech/jsdb/issues/22
³ https://kitten.small-web.org/reference/#database-app-modules

@aral@mastodon.ar.al avatar aral , to random

New Kitten release

• Fixes : The data preview pages in Kitten’s settings how handle circular references in the deserialised data (which may contain your custom classes if that’s what you were persisting in the database).

https://kitten.small-web.org

:kitten:💕

PS. Those pages are very rudimentary at the moment and are good for getting quick visual overview of the data you’re persisting. For a fully interactive view, use Kitten’s interactive shell (REPL)² to explore your data until I’ve had a chance to implement a more comprehensive visual interface.

PPS. You persist data in Kitten using the built-in JavaScript Database (JSDB)³ (Or, of course, you can install and use any other database.)

¹ https://codeberg.org/kitten/app/issues/236
² https://kitten.small-web.org/reference/#kitten-s-interactive-shell-repl
³ https://codeberg.org/small-tech/jsdb#javascript-database-jsdb

@aral@mastodon.ar.al avatar aral , to random

Your web server having an interactive shell (REPL) where you can live update entries in your site/app’s database is pretty neat (if I do say so myself) :)

https://kitten.small-web.org/reference/#kitten-s-interactive-shell-repl

(I’m porting the Small Technology Foundation site¹ from Site.js² – and hence from being a static site generated via Site.js’s integrated Hugo³ – to Kitten⁴. In the process, I’m creating an admin panel⁵ for the news, events, and videos sections, which will make them easier to update, and storing the data in Kitten’s internal JavaScript Database⁶.)

¹ https://small-tech.org
² https://sitejs.org
³ https://gohugo.io/
https://kitten.small-web.org
⁵ It’s trivial to create authenticated routes in Kitten. You just add a lock emoji (🔒) to the end of your route’s name. e.g., admin🔒.page.js or /admin🔒/index.page.js (see https://kitten.small-web.org/reference/#sessions-and-authentication).
https://codeberg.org/small-tech/jsdb

ALT
@aral@mastodon.ar.al avatar aral , (edited ) to random

Just updated the Database App Modules tutorial in the Kitten documentation to fix a few bugs, update to latest Kitten syntax, and improve the instructions:

https://kitten.small-web.org/tutorials/database-app-modules/

(Database app modules are special app modules¹ that let you create strongly-typed JavaScript databases² in your Small Web³ apps.)

Enjoy!

:kitten:💕

¹ https://kitten.small-web.org/reference/#app-modules
² https://codeberg.org/small-tech/jsdb#readme
³ https://ar.al/2024/06/24/small-web-computer-science-colloquium-at-university-of-groningen/