Giter Club home page Giter Club logo

jitar's Introduction

Jitar - Distributed runtime

Welcome to Jitar, a full-stack JavaScript runtime for small to large web applications. It lets you to build monolithic applications and run them spread out over multiple servers and web browsers. Jitar takes care of the inner communication, so you don't have to build any API.

Jitar is an abbreviation of just-in-time architecture, a flexible architecture style for building future-proof applications. Its intent is to close the gap between front- and back-end and provide a more cost efficient and flexible alternative to the microservice and serverless architecture (function as a service) types. With Jitar, applications can start as a monolith and be broken into smaller distributable pieces. It reduces the need for up-front architectural design and simplifies orchestration and deployment.

Jitar runs on top of Node.js and in any modern web browser. It has strong support for TypeScript. Because it's only a runtime, you can use the frameworks you already love at the front- and back-end. It's easy to learn and use, and it has a very small footprint.

Table of contents

Features

The main feature is writing monolithic applications that scale in any form and closes the gap between front- and back-end. It doesn't matter if a component is placed on one of the servers or the web browser. Jitar will make it work using its powerful runtime features.

  • Segmentation - Applications are broken down into servable segment packages.
  • Orchestration - Procedures always run, no matter the segment they're placed in.
  • Load balancing - Segments that are served by multiple servers are balanced automatically.
  • Access protection - Private procedures are only available within its own segment.
  • Multi-version - Procedures are versioned to support backwards compatibility.
  • Transportation - Data gets (de)serialized automatically when shared between segments.
  • RPC calls - Public procedures can be called from any external system.
  • And more - There's also support for health checks, assets, hooks and more.

How it works

In short, it comes down to this:

  • Applications are broken down into components (procedures and objects).
  • Components are grouped together in one or multiple segments and stored in a repository.
  • Segments are deployed independently to one or multiple nodes (like a microservice, but dynamically composed).
  • The Repository provides the actual or remote implementation of components to nodes (depending on their segment).
  • Nodes load segments and runs their procedures when called by a client or gateway.
  • The gateway keeps track of the available nodes and its components (locator).

The repository plays the biggest role when it comes to splitting applications. It holds the actual and a remote implementation for each segmented procedure. When starting a node, it loads the configured segments from the repository. If one of the segment components depends on (imports) a component from another segment, the repository will provide the remote implementation that calls the procedure using the gateway.

After a node starts successfully it will register itself to the gateway with all loaded procedures. If a procedure gets registered by multiple nodes, the gateway will automatically load balance the calls between them (round robin). When a node goes down it will automatically be unregistered. This means that it's possible to scale up and down nodes without any downtime.

Getting started

Setting up Jitar is easy. It simply needs to be added as a NPM dependency to your application. Node.js version 18.7 or higher are required.

npm install jitar

Now you're ready to chop applications! Follow our Getting started guide to create your first application.

Example

The following example shows how a client imports and calls a procedure from a server as if its locally available (like a monolith).

Components can be used typesafe because of the full Intellisense support. Also (complex) data objects can be exchanged between the procedures.

src/client.ts

import { storePerson } from './server';
import { Person } from './Person';

async function createPerson(name: string, age: number)
{
    const person = new Person(name, age);
    await storePerson(person);
}

export { createPerson }

A client can run in the browser or on a server. When running on a server, the client could also be a server for other clients by exposing some procedures.

Because Jitar is a runtime, any library or framework can be used.

src/server.ts

import { MongoClient as MC } from 'mongodb';
import { Person } from './Person';

async function storePerson(person: Person)
{
    const client = await MC.connect(process.env.DB_STRING);
    await client.db('my_app')
        .collection('people')
        .insertOne({ name: person.name, age: person.age });
}

export { storePerson }

For splitting (segmenting) applications configuration files are used. For each procedure the access and version can be controlled.

server.segment.json

{
    "server.js": {
        "storePerson": {
            "access": "public",
            "version": "1.0.0"
        }
    }
}

Documentation

Full documentation is online available at docs.jitar.dev.

Please join our Discord community for questions and discussions.

Contributing

We welcome contributions to Jitar. Please read our contributing guidelines for more information.

Roadmap

We are working hard towards a stable 1.0 release. Details can be found in our roadmap document.

jitar's People

Contributors

petermasking avatar basmasking avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.