7

GitHub - pglet/pglet: Pglet server and client

 2 years ago
source link: https://github.com/pglet/pglet
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Pglet - Web UI framework for backend developers

Build web apps like a frontend pro in the language you already know. No knowledge of HTML, CSS or JavaScript required.

What is Pglet

Pglet ("piglet") is a rich user interface (UI) framework for scripts and programs written in any language. Python, Bash, PowerShell and Node.js are already supported and other languages can be easily added via Pglet protocol.

Pglet renders web UI, so you can easily build web apps with your favorite language. Knowledge of HTML/CSS/JavaScript is not required as you build UI with controls. Pglet controls are built with Fluent UI React to ensure your programs look cool and professional.

Hello world in Bash

Install Pglet helper functions:

curl -O https://pglet.io/pglet.sh

Create hello.sh with the following contents:

. pglet.sh
pglet_page
pglet_add "text value='Hello, world!'"

Run sh hello.sh and in a new browser window you'll get:

Here is a page served by a local instance of Pglet server started in the background on your computer.

Now, add PGLET_WEB=true before pglet_page:

. pglet.sh
PGLET_WEB=true pglet_page
pglet_add "text value='Hello, world!'"

and instantly make your app available on the web!

Tutorials

How it works

Pglet UI does not become embedded into your program, but is being served by an out-of-process Pglet server. Application state and control flow logic lives in your persistent-process program while UI changes and events are communicated to Pglet server via IPC-based protocol. It allows writing web app as a standalone monolith without any knowledge of request/response model, routing, templating or state management. Pglet server can be run locally, self-hosted in your local network or used as a hosted service.

In a classic client-server architecture front-end communicates to a one or more back-end services. Pglet implements an opposite approach where multiple back-end services scattered across internal network behind a firewall and communicate to a centralized Pglet web server, i.e. front-end service, installed in DMZ or hosted as a service. This design gives a number of advantages:

  • Secure by design - your internal services and critical data stay behind the firewall and not accessible from the outside world.
  • Apps running next to services and data they process - faster/cheaper access and maximum security.
  • Zero deployment - run apps on any server in your network or your development machine, no need to deploy apps to a web server.

Use cases

  • Progress visualization for CI/CD workflows, batch jobs and cron tasks
  • Admin interfaces for internal services
  • Web dashboards and monitoring
  • Status pages
  • Executive reporting
  • Registration forms and questionnaires
  • Intranet self-service kiosks
  • Prototype and throw-away apps

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK