Giter Club home page Giter Club logo

pwalauncher's Introduction

pwalauncher

The microservice bootstrap for PWA with serverless functions

Usage

npm install -g pwalauncher
pwalauncher # Will share `wwwroot` subfolder with static assets and redirect to `index.html` if 404

Benefits

  1. Free SSL Certificate obuse

Create a ZeroSSL 90-days sertificate for single domain and multiply it to several websites shared on different ports

  1. Port forward over SSL

Forwarding https://example.com/8081 to http://localhost:8081. Both websoket and http forwarding are supported

  1. JWT Validation for each forwarded port

While forwarding to http://localhost:8081 the pwalauncher can intercept Authorization: Bearer <token> header and validate the token. The UI can sign a token every 10 seconds to avoid DDOS

  1. CRA-like API proxy

Request to https://example.com/v1 can be forwarded to https://cloud.appwrite.io/v1

  1. Cors-everywhere like file download proxy

Fetch from https://example.com/cors/http://filedownload.com/demo.mp3 will download http://filedownload.com/demo.mp3 ignoring mixed content and cord origin policy

  1. Mutal SSL auth on a server side

A self-signed SSL certificate installed localy can be used to restrict access to application authorisation with second layer of authentification

Ecosystem

This tool is extreamly powerfull with PM2. The pm2 should be used for instantiation while pwalauncher used as easy-config reverse-proxy

pm2 start ecosystem.config.js
pm2 list
pm2 save
pm2 monit
pm2 stop service
pm2 kill

The tmux also can be used to start microservices in debug mode with direct stdin/stdout pipe

tmux kill-session
tmux
tmux attach
Ctrl + B + D
Ctrl + B + C
Ctrl + B + P
Ctrl + B + N

The pwalaunch used single argument if you want to use different name of config.

pwalaunch launcher.config.json

Configutation

const fs = require('fs');

module.exports = {
    ports: [
        8081,
        8082,
        8083,
        8084,
        8085,
        8086,
        8087,
        8088,
        8089,
        8090,
    ],
    proxy: [
        {
            path: 'v1',
            link: 'http://127.0.0.1:8080/v1'
        }
    ],
    ssl: {
        key: fs.readFileSync('./ssl/private.key', 'utf8'),
        cert: fs.readFileSync('./ssl/certificate.crt', 'utf8'),
    },
    sslPort: 444,
    sslVerify: true,
    jwtSecret: "TEST",
    cookieSecret: true, // { key: "test", value: "1", }
    cookieSecretAllowed: ['/', '/index.html', '/favicon.ico'],
    ipBlacklist: ["95.173.136.72"],
    port: 80,
    redirectHttps: false,
    wwwroot: "build"
};

Self-signed SSL Setup

If you getting trouble while trying to setup self-signed ssl, check the 3rdparty folder. The SSLCertificateMaker.exe will help you create root certificate (CA) for client devices and self-signed children (CERT) for the server. The CertTrustManager.exe will help you create a one-button setup file for root certificate (CA), to create that file right click on CertTrustManager window.

screenshot

P.S. If you choose wrong certificate in modal run chrome://restart to choose It again or use Edge

pwalauncher's People

Contributors

tripolskypetr 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.