mastodon.ar.al is one of the many independent Mastodon servers you can use to participate in the fediverse.
This is my personal fediverse server.

Administered by:

Server stats:

1
active users

#JavaScriptDatabase

0 posts0 participants0 posts today

👋🤓 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

🔒 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

Codeberg.orgjsdbA zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log.

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

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

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

Continued thread

JSDB 5.1.0 published¹ 🎉

• Forgetting to pass a custom class that’s persisted in your database in your `JSDB.open()` call now throws instead of corrupting your database by falling back to using an untyped object.

• Added JSDF ver. 2 to 3 database migration script (i.e., JSDB version 2-4 to 5)²

To install update:

npm install @small-tech/jsdb@5.1.0

¹ codeberg.org/small-tech/jsdb/r

² codeberg.org/small-tech/jsdb#v

JSDB

Codeberg.orgjsdbA zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log.
Continued thread

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

Codeberg.orgjsdbA zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log.

Kitten¹ now keeps two JSDB² databases per project: an internal one ('kitten._db`) that holds data Kitten manages (sessions, uploads, etc.) and the default one (`kitten.db`) that holds your own tables.

You’ll mostly only care about the latter.

I also took the opportunity to create a Database App Module example and document it in the readme:

codeberg.org/kitten/app#databa

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

Codeberg.orgappA web development kit that’s small, purrs, and loves you.

It’s so cool to be able to tail your database (append-only JavaScript log¹) when playing with Kitten².

(If I do say so myself.)

The output on the right is the initial state of running the following command on your project folder to tail the domains table when the project is being served on the domain dev.ar.al:

kitten db tail domains --domain=dev.ar.al --all

:kitten: 💕

¹ codeberg.org/kitten/app#using-
² codeberg.org/kitten/app#kitten

Just published Kitten’s¹ new database² commands:

- kitten db [table name] to see info the database/a specific table
- kitten db delete [table name] to delete the database/a specific table
- kitten db tail <table name> to follow a specific table

Full docs: codeberg.org/kitten/app#databa

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

Codeberg.orgappA web development kit that’s small, purrs, and loves you.

An interesting JavaScript Database (JSDB) edge case I just encountered:

If you’re persisting custom objects, please do NOT use setter methods (`set something () {…}`).

Use regular methods instead (`setSomething () {…}`) for predictable behaviour that likely matches your conceptual model of how things should work.

(This is due to how setters interact with proxies.)

Details: codeberg.org/small-tech/jsdb#c

Codeberg.orgjsdbA zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log.

JavaScript Database (JSDB) version 2.0.6 (ESM) and 1.2.3 (CJS) released.

Fixed:

- Crash when key contains single quote
- npm warnings

Install:

ESM: npm i @small-tech/jsdb
CJS: npm i @small-tech/jsdb@cjs

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

Learn more: codeberg.org/small-tech/jsdb#j

Codeberg.orgjsdbA zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log.

JSDB version 1.1.4 released

This is a bugfix release: Object keys containing non-alphanumeric characters are now properly supported.

(Thanks to @djsundog for the bug report.)

To install: npm i @small-tech/jsdb

Introductory blog post/tutorial: ar.al/2020/10/20/introducing-j

Source code: github.com/small-tech/jsdb

ar.alIntroducing JSDBJSDB is an easy-to-use, in-memory JavaScript database for Small Web that persists to a JavaScript transaction log.

JSDB version 1.1.3 released

This release improves query security by failing faster during sanitisation of disallowed characters and on syntax errors (the latter by using the function constructor instead of eval.)

To install: npm i @small-tech/jsdb

Introductory blog post/tutorial: ar.al/2020/10/20/introducing-j

Source code: github.com/small-tech/jsdb

ar.alIntroducing JSDBJSDB is an easy-to-use, in-memory JavaScript database for Small Web that persists to a JavaScript transaction log.