Giter Site home page Giter Site logo

priestd09 / core-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mesg-foundation/engine

0.0 1.0 0.0 6.77 MB

MESG is an open-source decentralized infrastructure which makes all technologies, including blockchains, interoperable. It’s a building platform for developers.

Home Page: https://mesg.com/

License: Apache License 2.0

Dockerfile 0.21% Go 99.16% JavaScript 0.03% Shell 0.60%

core-1's Introduction

MESG Core

Website - Docs - Chat - Blog

CircleCI Docker Pulls Maintainability codecov

MESG is a platform for the creation of efficient and easy-to-maintain applications that connect any and all technologies.

MESG Core is a communication and connection layer which manages the interaction of all connected services and applications so they can remain lightweight, yet feature packed.

To build an application, follow the Quick Start Guide

If you'd like to build Services and share them with the community, go to the Services section.

To help us build and maintain MESG Core, refer to the Contribute section below.

Contents

Quick Start Guide

This guide will show you steps-by-step how to create an application that sends a Discord invitation email when a webhook is called.

1. Installation

Run the following command in a console to install MESG Core:

bash <(curl -fsSL https://mesg.com/install)

You can also install it manually by following this guide.

2. Run MESG Core

MESG Core runs as a daemon. To start it, execute:

mesg-core start

3. Deploy the services

You need to deploy every service your application is using.

In this guide, the application is using 2 services.

Let's start by deploying the webhook service:

mesg-core service deploy https://github.com/mesg-foundation/service-webhook

Now let's deploy the invite discord service:

mesg-core service deploy https://github.com/mesg-foundation/service-discord-invitation

Once the service is deployed, the console displays its Service ID. The Service ID is the unique way for the application to connect to the right service through MESG Core. You'll need to use them inside the application.

4. Create the application

Now that the services are up and running, let's create the application.

The application is using NodeJS and NPM.

Let's init the app and install the MESG JS library.

npm init && npm install --save mesg-js

Now, let's create an index.js file and with the following code:

const MESG = require('mesg-js').application()

const webhook    = '__ID_SERVICE_WEBHOOK__' // To replace by the Service ID of the Webhook service
const invitation = '__ID_SERVICE_INVITATION_DISCORD__' // To replace by the Service ID of the Invite Discord service
const email      = '__YOUR_EMAIL_HERE__' // To replace by your email
const sendgridAPIKey = '__SENDGRID_API_KEY__' // To replace by your SendGrid API key. See https://app.sendgrid.com/settings/api_keys

MESG.whenEvent(
  { serviceID: webhook, filter: 'request' },
  { serviceID: invitation, taskKey: 'send', inputs: { email, sendgridAPIKey } },
)

Don't forget to replace the values __ID_SERVICE_WEBHOOK__, __ID_SERVICE_INVITATION_DISCORD__, __YOUR_EMAIL_HERE__ and __SENDGRID_API_KEY__.

5. Start the application

Start your application like any node application:

node index.js

6. Test the application

Now let's give this super small application a try.

Let's trigger the webhook with the following command:

curl -XPOST http://localhost:3000/webhook

🎉 You should have received an email in your inbox with your precious invitation to our Discord.

Services

Services are build and shared by the community. They are small and reusable pieces of code that, when grouped together, allow developers to build incredible applications with ease.

You can develop a service for absolutely anything you want, as long as it can run inside Docker. Check the documentation to create your own services.

Services implement two types of communication: executing tasks and submitting events.

Executing Tasks

Tasks have multiple input parameters and multiple outputs with varying data. A task is like a function with inputs and outputs.

Let's take an example of a task that sends a email:

The task accepts as inputs: receiver, subject and body.

The task could return 2 different outputs.

The first possible output is success with an empty object {} as data, meaning that the email has been sent with success

The second possible output is error with for eg, { "reason": "email invalid" } as data.

This way, the application can easily check the type of output and react appropriately.

Check out the documentation for more information on how to create tasks.

Submitting Events

Services can also submit events to MESG Core. They allow two-way communication with MESG Core and Applications.

Let's say the service is a HTTP webserver. An event could be submitted when the webserver receives a request with the request's payload as the event's data. The service could also submit a specific event for every route of your API.

For more info how to create your events, visit the Emit an Event page.

Architecture

MESG Architecture

Marketplace

We have a common place to post all community-developed Services and Applications. Check out the curated list of Awesome Services and Applications to participate.

Alternatively, you can also check out the https://mesg.com/marketplace.

Roadmap

June 2018 - Core V1.0 Launched

Create your services and connect them together with your application through a single connection to Core, allowing Core to handle all communications and interoperability with any technology.

Q3 2018 - Rapid Deployment

No need to code your application anymore, just send a list of events with corresponding tasks within a simple configuration file to Core which will then execute tasks on your application’s behalf.

Q4 2018 - Beta Network

The beta decentralized Network means no coding or servers are necessary to run your applications. Connect thousands of services or applications from our shared repository.

Q3 2019 - Main Network

MESG launches its own blockchain Network providing for full scalability and a cheaper and faster user experience. The main network will host the full functionality of the value-driven open market for the sharing of services.

Community

You can find us and other MESG users on Discord.

Be sure to join, and don't forget to introduce yourself and your project if you have one.

Please feel free to share useful articles in the #newsfeed channel.

Also, be sure to check out the blog to stay up-to-date with our articles.

Contribute

Contributions are more than welcome. For more details on how to contribute, please check out the contribution guide.

If you have any questions, please reach out to us directly on Discord.

core-1's People

Contributors

antho1404 avatar ilgooz avatar krhubert avatar nicolasmahe avatar williamzmorgan avatar

Watchers

 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.