The easiest way to get started with hyper63 is to use our online sandbox at play.hyper63.com. This is a service sandbox that anyone can use to get familiar with hyper63 and its features.

There are several ways you can interact with the sandbox, you can use a REST API Tool, like insomnia or postman. Or you can use runkit a document based repl that allows you to write nodejs code in a browser and run it. In this article we will be using the runkit repl.

If you want to dive straight into the documentation, go to https://docs.hyper63.com or if you have specific questions checkout out discussions at https://github.com/hyper63/hyper63/discussions

Getting Started Tutorial (Javascript)

Open a new browser tab to https://runkit.com

You may need to create a runkit account, it is free.

Setup

The first thing you need to start to work with hyper63 is a JWT token, for the play sandbox we created one for you to work with. In the runkit editor you can type the following code to setup the packages we will need to complete this tutorial.

NOTE: you can get a token to the hyper playground by going to https://play.hyper63.com
const fetch = require('node-fetch')
const token = 'copy your token from https://play.hyper63.com'
const url = 'https://play.hyper63.com'

Now that you have fetch and a token and a hyper63 service, we can make our first call to hyper63. In a new runkit block type the following code:

await (await fetch(`${url}/data`),{ headers: { authorization: `Bearer ${token}`}}).json()

Click the run button and you should see the following response:

{
  "name": "hyper63 Data",
  "version": "1.0.1",
  "status": "unstable"
}

Next, we want to create a data store, to keep things unique, lets name your datastore by your username or the initial of your first name and your last name. For this post I will use twilson. Cool, lets create a data store!

await (await fetch(`${url}/data/twilson`, {
  method: 'PUT',
  headers: {
    authorization: `Bearer ${token}`
  }
})).json()

Click the run button and you should get the following response:

{"ok": true}
Great! you just created a data store in hyper63, now you can start to store some documents. Lets store some movie documents:

Lets create a function so we don't have to type a lot of the same code:

const toId = (title, year) => `${title.replace(/\s/g,'-').toLowerCase()}-${year.toLowerCase()}`
const createMovie = async (title, year) => (await fetch(`${url}/data/twilson`, {
    method: 'POST',
    headers: { 
      'content-type': 'application/json',
      authorization: `Bearer ${token}`
    },
    body: JSON.stringify({
      id: toId(title, year),
      type: 'movie',
      title,
      year
    })
})).json()

Now, we can add some movies:

await Promise.all([
  createMovie('Ghostbusters', '1984'), 
  createMovie('Caddyshack', '1980'), 
  createMovie('Groundhog Day', '1993')
])

Click the run button and you should see the following:

[
  {ok: true, id: 'ghostbusters-1984'},
  {ok: true, id: 'caddyshack-1980'},
  {ok: true, id: 'groundhog-day-1993'}
]
Awesome Sauce! You just created 3 documents in the data store.

We can retrieve a single document:

await (await fetch(`${url}/data/twilson/ghostbusters-1984`, {
  headers: {
    authorization: `Bearer ${token}`
  }
})).json()

Or we can query all documents of type movie:

await (await fetch(`${url}/data/twilson/_query`, {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    authorization: `Bearer ${token}`
  },
  body: JSON.stringify({
    selector: {
      type: 'movie'
    }
  })
})).json()
For more information on how to query documents see our documentation

Ok, this is a quick-start for the data service, if you would like to know more about the data service take a look at the documentation and see if you can figure out how to update and delete documents: https://docs.hyper63.com/ and navigate to the Data API section.

If you would like to see the completed runkit of this tutorial you can check it out here:

https://runkit.com/hyper63/getting-started-tutorial

Need specific help? you can always reach out to our support team for any additional assistance at https://github.com/hyper63/hyper63/discussions