riverboat

0.0.2 • Public • Published

Riverboat

Backend-agnostic, isomorphic model system
 

Riverboat is a JavaScript data system that runs anywhere in the application stack. Code operating on data is written the exact same way whether it's running on the client or server.

Unlike a traditional ORM, Riverboat doesn't hinder try to abstract away the complexity of databases. Riverboat uses a composable adapter model to interface with any data source, as well as implement pluggable features like validation and data sanitation.

Riverboat is a work in progress and is being developed alongside an internal application.

Examples

Some of these examples use type annotations as found in TypeScript or Flow.

Creating a Model type

Models are strongly-typed in Riverboat, which allows for effective validation and sanitation of data.

ESNext (ES2015, class property initializers, decorators):

import { Model, Field, MemoryStorageAdapter } from "riverboat";

class BlogPost extends Model {
	@Field()
	title: string;

	constructor(title: string) {
		this.title = title;
	}
}

ES2015:

import { Model, addField, MemoryStorageAdapter } from "riverboat";

class BlogPost extends Model {
	constructor(title) {
		this.title = title;
	}
}

addField(BlogPost, {
	key: "title"
});

Saving Data

const adapter = new MemoryStorageAdapter();
const testPost = new BlogPost("A Test Blog Post");

BlogPost.save(adapter, testPost)
	.then(() => {
		console.log(`Saved with ID ${ testPost.id }!`);
	});

License

Riverboat is licensed under the MIT license. See the LICENSE file for more details.

Dependencies (0)

    Dev Dependencies (23)

    Package Sidebar

    Install

    npm i riverboat

    Weekly Downloads

    1

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • lpghatguy