#JSDB

2025-05-26

šŸ‘‹šŸ¤“ 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): codeberg.org/small-tech/auto-e

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

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

• JSDB: In-process, in-memory JavaScript database that persists to append-only JavaScript logs: 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:

sitejs.org

For its successor, please see Kitten:

kitten.small-web.org

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

small-tech.org/fund-us

:kitten:šŸ’•

¹ ar.al/2024/06/24/small-web-com
² ar.al/2019/08/26/introducing-s
³ Using our instance of Look Over There!: look-over-there.small-web.org

#SiteJS #SmallWeb #SmallTech #peerToPeerWeb #SmallTechnologyFoundation #AutoEncrypt #AutoEncryptLocalhost #JSDB #JavaScriptDatabase #https #TLS

Detail of Site.js web site:
Illustation of woman lying down with laptop. On screen is a twig with two green leaves.

Site.js
Small Web construction set.
Site.js is deprecated and no longer being actively maintained. Much of it lives on in Kitten.
2025-05-14

šŸ”’ 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.

¹ codeberg.org/small-tech/jsdb/
² codeberg.org/small-tech/jsdb/i
³ kitten.small-web.org/reference

#Kitten #SmallWeb #JSDB #JavaScriptDatabase #KittenRelease #JSDBRelease #securityUpdate #criticalUpdate

2025-04-17

New Kitten release

• Fixes #236¹: 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).

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.)

¹ codeberg.org/kitten/app/issues
² kitten.small-web.org/reference
³ codeberg.org/small-tech/jsdb#j

#Kitten #SmallWeb #update #changes #database #JavaScriptDatabase #JSDB #javascript #nodeJS #web #dev

2025-03-03

While working on porting the Small Technology Foundation web site¹ to Kitten², I took the opportunity to pull out base Model and Collection classes that I’ll likely end up including in Kitten proper:

• Model: codeberg.org/small-tech/site/s
• Collection: codeberg.org/small-tech/site/s

To see them in use, here’s the base Posts class (with RSS generation) that extends Collection:
codeberg.org/small-tech/site/s

And here’s the concrete EventPosts collection class that extends Posts:
codeberg.org/small-tech/site/s

And the EventPost (showing an implementation of a calculated property):
codeberg.org/small-tech/site/s

So all this is possible (persisting and reading back typed model collections, etc.) thanks to JSDB¹ (JavaScript database), a zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database I wrote for the Small Web that persists to a JavaScript transaction log and is included as as first-class citizen in Kitten.

codeberg.org/small-tech/jsdb

And if you want to know how the magic mapping of classes happens, see the Database App Module:

codeberg.org/small-tech/site/s

PS. For a much gentler introduction to persistence in Kitten, see the Kitten Persistence tutorial:
kitten.small-web.org/tutorials

Enjoy! :kitten:šŸ’•

¹ small-tech.org
² kitten.small-web.org

#Kitten #SmallWeb #SmallTech #JavaScript #database #JSDB #typeSafety #JSDoc #closureCompiler #TypeScript #workInProgress

Screenshot of code for index_[optional-postId].page.js open in Helix Editor. Highlighted section is part of a <select> control definition in a JavaScript template string that translates a list of event posts into option elements that begins

${db.site.events.list.map(post => kitten.html`<option value='${post

The code is partially obscured by a language intelligence popover that’s showing type information for the list property:

(property) Collection<EventPost>.list: EventPost[]. Generic list. @type - {Array}

In the rest of the visible code, you can see post.title being accessed.
2025-02-10

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) :)

kitten.small-web.org/reference

(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⁶.)

¹ small-tech.org
² sitejs.org
³ gohugo.io/
⁓ 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 kitten.small-web.org/reference).
⁶ codeberg.org/small-tech/jsdb

#Kitten #REPL #shell #JavaScript #database #JavaScriptDatabase #JSDB #SmallTechnologyFoundation #SiteJS #Hugo #web #dev #NodeJS

Screenshot of Kitten’s interactive shell, showing me alterning a database entry in development:

}
  ]

🐱 šŸ’¬ kitten.db.news[0].link = kitten.db.news[0].postLink

  'https://ar.al/2024/05/23/new-kitten-features-interactive-shell-repl-multi-page-settings-and-backup-and-restore-data-portability/'

🐱 šŸ’¬ kitten.db.news[0]

  Proxy [
    News {
      link: 'https://ar.al/2024/05/23/new-kitten-features-interactive-shell-repl-multi-page-settings-and-backup-and-restore-data-portability/',
      title: 'New Kitten features: Interactive Shell (REPL), Multi-page Settings, and backup and restore (data portability)',
      date: '2024-05-23',
      image: '',
      summary: 'In this video, Aral demonstrates the new features added to Kitten in May: including the new Interactive Shell (REPL), Multi-page Settings, and backup and restore (data portability).',
      author: 'Aral Balkan',
      sourceName: 'Aral’s Blog',
      sourceLink: 'https://ar.al',
      postLink: 'https://ar.al/2024/05/23/new-kitten-features-interactive-shell-repl-multi-page-settings-and-backup-and-restore-data-portability/',
      presets: 'custom'
    },
    {
      get: [Function: bound getHandler] { boundObject: [DataProxy] },
      set: [Function: bound setHandler] { boundObject: [DataProxy] },
      defineProperty: [Function: bound definePropertyHandler] { boundObject: [DataProxy] },
      deleteProperty: [Function: bound deletePropertyHandler] { boundObject: [DataProxy] }
    }
  ]
2025-02-10

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:

kitten.small-web.org/tutorials

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

Enjoy!

:kitten:šŸ’•

¹ kitten.small-web.org/reference
² codeberg.org/small-tech/jsdb#r
³ ar.al/2024/06/24/small-web-com

#Kitten #DatabaseAppModules #AppModules #tutorial #SmallWeb #SmallTech #web #dev #JSDB #JavaScriptDatabase #JavaScript #database #web #dev #NodeJS #strongTyping

2024-06-18

JSDB 6.0.0 released šŸŽ‰

Breaking change: Removes Symbol support…

… since we can’t properly serialise/deserialise symbols. Likely, this will not affect anyone as it’s so niche but it’s a major version bump anyway.

Also, the removal of Symbol support fixes a crash that occurs if you persist objects that extend EventEmitter when calling their removeAllListeners() methods. That’s much more important ;)

Full details: codeberg.org/small-tech/jsdb/s

#JSDB #SmallTech #JavaScript #database #NodeJS #Kitten

2024-05-24

Kitten bugfix release:

Please upgrade to the latest release that fixes a regression introduced into sessions object with the latest JSDB¹/JSDF² upgrade:

codeberg.org/kitten/app/issues

Persisting arbitrary objects to sessions is a supported workflow and this regression broke that.

e.g., See the Kitten Count Sessions example: codeberg.org/kitten/app/src/br

:kitten:šŸ’•

¹ codeberg.org/small-tech/jsdb#j
² codeberg.org/small-tech/jsdb#j

#Kitten #SmallWeb #web #dev #sessions #JSDB #JavaScript #database #regression

2024-05-23

New Video – Kitten features introduced this week:

• Interactive Shell (REPL)
• Multi-page Settings
• Backup and restore (data portability)

With examples that cover components and Kitten’s built-in JavaScript database (JSDB).

ar.al/2024/05/23/new-kitten-fe

:kitten:šŸ’•

#Kitten #SmallWeb #SmallTech #web #dev #JavaScript #HTML #database #JSDB #components #settings #dataPortability #REPL

2024-05-07

… JSDB, by the way, is short for JavaScript Database, which is, umm, a JavaScript database.

It’s an in-process, in-memory database for Node.js for Small Web use that persists to an append-only JavaScript – not JSON, JavaScript – transaction log.

JSDB’s very easy to work with because you just use native JavaScript objects and they just automatically get persisted for you.

e.g., Here’s a quick 6-line Kitten app that persists a counter:

codeberg.org/kitten/app#using-

#JSDB #Kitten #SmallWeb #web #dev

2024-05-06

Just published a minor update (version 5.1.1) to JavaScript Database (JSDB) that optimises the custom data type¹ serialisation code by removing a redundant return statement:

npmjs.com/package/@small-tech/

This change is backwards compatible and shouldn’t require and updates to your projects, including the ones you have in Kitten (which uses JSDB internally).

¹ codeberg.org/small-tech/jsdb#c
² codeberg.org/kitten/app

#JavaScriptDatabase #JavaScript #database #JSDB #Kitten #SmallWeb #NodeJS #web #dev

2024-05-04

Just deployed a new Kitten¹ version šŸŽ‰

• Adds database backup and restore in your app’s Kitten settings page (/šŸ’•/settings)

• Upgrades version of JSDB from 4 to 5²

• You can emit and listen for events on the session object you get from `request.session` in your routes now.

¹ codeberg.org/kitten/app
² For migration notes, please see: codeberg.org/small-tech/jsdb#m

#Kitten #backupAndRestore #JavaScript #NodeJS #database #JSDB #sessions #SmallWeb #web #dev

Screenshot of Kitten’s settings page running on a Kitten app at https://dev.ar.al/šŸ’•/settings/

Section Heading: šŸ—„ļø Databases

List with two options: Internal (_db) and  App (db)

Subheading: Backup

Link: Download backup

Subheading: Restore

File upload control with label: 
Database backup file (.kitten.databases.tar.gz)

Choose file button
No file chosen
Restore buttonScreenshot of output of the kitten --version command in terminal:

Illustration of minimalist grey kitten sitting on a green hill in front of a blue sky.

Kitten
   by Aral Balkan, Small Technology Foundation

 Version 1-b8d459-20.12.2-20240504203731
 Born 2024/05/04 at 20:37:31 UTC (Taurus)
 Fav. colour #b8d459 [colour swatch]
 API version 1
 Runtime Node.js 20.12.2
 
 Like this? Fund us! 
 
We’re a tiny, independent not-for-profit.
https://small-tech.org/fund-us

Need help?   https://codeberg.org/kitten/app/issues
2024-05-04

Watching The Doors live at The Hollywood Bowl (1968)¹ and hacking on Kitten² and Domain³.

All in all, not a bad way to spend a Saturday afternoon in my book.

(I’ve almost got database backup/restore working in Kitten and I’ve just finished porting Domain to the latest Kitten with JSDB 5⁓.)

¹ yewtu.be/watch?v=Q76QBhKHQGc
² codeberg.org/kitten/app
³ codeberg.org/domain/app
⁓ codeberg.org/small-tech/jsdb

#TheDoors #Kitten #Domain #JSDB #SmallWeb #web #dev #music

Jim Morrison on stage, bent over with his back to the audience, showing them his ass.
2024-05-03

Assign properties in a constructor’s parameter object (with defaults) to object being instantiated in JavaScript

codeberg.org/aral/gists/src/br

This is a little something I ended up playing around with this morning before figuring out how to do it (after spending far too much time down a rabbit hole with object destructuring when what I really needed was creative use of the spread operator).

(Useful for custom objects in JSDB 5 – codeberg.org/small-tech/jsdb#c)

#JavaScript #parameterObject #defaults #JSDB

2024-05-01

To really drive home the above šŸ‘† point that 100% test coverage does not mean ā€˜bug free’, just found a bug in JSDB¹ 5.0.0 where running JSON.stringify() on a complex custom object (actually: the automatic Proxy of the custom object created by JSDB) results in an error.

Already have a failing test and about to implement fix.

(It’s at this point where the test harness is invaluable.)

¹ codeberg.org/small-tech/jsdb

#JavaScriptDatabase #JavaScript #database #JSDB #JSDB5 #NodeJS #SmallWeb #SmallTech

2024-05-01

Heads up anyone playing with Kitten at the moment (yes, both of you):

I’m in the process of upgrading Kitten’s version of JSDB from 4 to 5.

*This is a breaking change.*

This will affect you if you’re persisting custom objects (instances of your custom model classes) in your databases.

Please see the details in this JSDB announcement post and the linked-to details page to prepare:

mastodon.ar.al/@aral/112361559

(I should have the update out this afternoon.)

#Kitten #JSDB #BreakingChange #SmallWeb

2024-04-30

Philosophically, JSDB – which writes out to native JavaScript logs – is very much the JavaScript version of SWX, the native data format for Flash that I released around 2007 (where data was written out in native SWF format). I have to say that I’m glad I didn’t have to reverse engineer SWF bytecode this time around :)

Here’s a video of a younger me doing an impromptu demo of SWX at some conference or other from 16 years ago.

m.youtube.com/watch?v=OM9qOADs

#JSDB #SWX #JavaScript #Flash #flashback

2024-04-30

JSDB 5.0.0 published šŸŽ‰

• Custom classes must have a `constructor` that accepts a parameter object as its only argument. Constructors are run during deserialisation.

• Custom classes can now safely extend other classes (e.g., `EventEmitter`).

• Properties that begin with an underscore (`_`) are treated as private and ignored.

• Objects with null prototypes are supported. i.e., objects created with `Object.create(null, …)`.

Full details: codeberg.org/small-tech/jsdb#m

#JSDB #NodeJS #database

2024-04-30

100% test coverage doesn’t mean your code’s bug free but it did just lead me to find and fix an issue in JavaScript Database (JSDB)¹ with a code path that wasn’t being hit that I would have otherwise missed because it was causing the relevant test to pass.

¹ JSDB is a zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log (an append-only log).

codeberg.org/small-tech/jsdb

#JavaScript #database #JSDB

2024-04-29

Realised last night that JavaScript Database (JSDB) doesn’t run the constructor on persisted custom objects (codeberg.org/small-tech/jsdb#c) when deserialising them because I didn’t know that you apparently have to define your constructor manually when using Object.create().

Will fix it today but it’s something to watch out for if you’re using Object.create() directly.

For more info, see developer.mozilla.org/en-US/do

#JSDB #customObjects #constructor #bug #JavaScript #NodeJS #SmallTech #SmallWeb

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst