0.0.18 • Published 5 years ago

isekai v0.0.18

Weekly downloads
34
License
AGPL-3.0-or-later
Repository
github
Last release
5 years ago

:WARNING:

Still super early. Use at your own risk.

WHAT IS THIS?

ISEKAI*ENGINE is the glue that sticks a bunch of opinionated useful software together and then exposes it as TOML configuration to the end user. Let DAEMONs handle the heavy work through SKILLs. The end goal is for anyone to be able to easily run their own servers for websites, games, social, chat, email and etc. This lets the end user own their own data and be able to do anything they want with it.

QUICK START

Requires node.js to be installed.

npm install -g isekai

cd my_project
isekai init
isekai start

Your world awaits at http://localhost:8080.

TIPS AND TRICKS

Navigate to http://localhost:8080/admin to play God with your world.

Your DATA directory can override anything in BIN/DATA. Use this to mod graphics and stuff.

BUT WHAT DOES IT DO?

Isekai turns configuration TOML files into executable javascript bundles for either node or the browser.

ex:

[NODE]
[LOG]
[HTTP]
port = 8080

[HTTP_API]
[HTTP_PUBLIC]

# [[HTTP_MD]]
# path = "/"
# file = "README.md"
# template = "default.html

into

import isekai from "isekai";
isekai.SET({"NODE":{},"LOG":{},"HTTP":{"port":8080},"HTTP_API":{},"HTTP_PUBLIC":{}});

import LOG from "../SKILLS/LOG/index.js";
import HTTP from "../SKILLS/HTTP/index.js";
import HTTP_API from "../SKILLS/HTTP_API/index.js";
import HTTP_PUBLIC from "../SKILLS/HTTP_PUBLIC/index.js";

isekai.EQUIP({
    LOG,
    HTTP,
    HTTP_API,
    HTTP_PUBLIC,
});

HTTP adds an express server APP onto the shared object as HTTP. HTTP_PUBLIC then serves a static HTTP website from the bag contents of HTTP_PUBLIC.

HTTP_PUBLIC.js

import express from "express";

export default ({
    HTTP
}) => {
    HTTP.use(express.static(`../DATA/HTTP_PUBLIC`));
};

BUT WHAT DOES IT REALLY DO?

isekai.js

// Stare into the Abyss
const Isekai = ({
    SET: (obj) => 
        Object.entries(obj).
            forEach(([ key, value ]) => {
                Isekai[key] = Isekai[key] || {};
                
                if(typeof value === `function`) {
                    Isekai[key] = Object.assign(value, {
                        ...Isekai[key], 
                        ...value
                    });
                } else {
                    Isekai[key] = Object.assign(Isekai[key], value);
                }
            }),

    EQUIP: (obj) => 
        Object.entries(obj).
            forEach(([ key, fn ]) => {
                Isekai[key] = Isekai[key] || {};
                
                fn(Isekai); 
            })
});

export default Isekai;