Skip to content
Fullstack Javascript Web app Framework
JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Relax is a working title for a full stack javascript framework built with the goal of abstracting the way we interact with data into a consistent format and reducing boilerplate.

The project is currently being developed and while certain features are complete, they are not integrated together.

Querying the database, frontend state, or making requests from the client to the server are all expressed with the same syntax. The from function takes a resource name and returns an object with methods named after commonly used RESTful HTTP methods. get is extended with and get.all to allow fetching individual records or collections. For frontend state, these methods return objects or arrays. For database queries or fetching from the server they return promises.

To make more specific requests, get.all takes config options that are similar to SQL clauses (and when fetching from the database, sometimes map directly to the SQL counterpart). For example, the options { where: { status: "approved" }, with: "comments" } will fetch records where the attribute status is 'approved' and will include associated comment records. Associated records can also take their own options. For example { with: { comments: { where: { published: true } } } }.


Fetching Records

from('users').get.all().then(users => console.log(users))
// => [{ id: 1, name: "Arya"}, { id: 2, name: "Jon"}]
from('users').get.all({ where: { name: "Jon" }}).then(users =>
// => [{ id: 2, name: "Jon"}]
from('users') =>
// => { id: 1, name: "Arya"}

Creating Records

from('users').post({ name: "Ned" }).then(user => console.log(user))
// => { id: 3, name: "Ned"}

Updating Records

from('users').patch({ id: 13 name: "Eddard" }).then(user => console.log(user))
// => { id: 3, name: "Eddard"}

Deleting Records

from('users').delete({ name: "Jon" }).then(user => console.log(user))
from('users').delete({ name: "Jon" }).then(user => console.log(user))
// => { id: 2, name: "Jon"}
You can’t perform that action at this time.