Pglet - Web UI framework for backend developers

Build status

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
Owner
Web UI framework for backend developers
Build modern Web Apps quickly in the language you already know.
Web UI framework for backend developers
Comments
  • Google Auth

    Google Auth

    This is more of a question than anything, i am using pglet for my application and it took me a while to build it with such and i also want to use gauth but without using Flask to first create another webpage and then redirect etc. Additionally, storing things like the account id in cache or something would be awesome aswell but that is another thing haha. I apologies if i sound stupid or anything with my question, i most likely am being such.

    Any ideas would be appreciated!

  • Enhancement: configure pglet server options via config file

    Enhancement: configure pglet server options via config file

    At present, the current pglet limitations are listed as: Pages

    • {account_name} can be anything.
    • Anonymous client can create up to 10 pages per hour.
    • Once a page is created from a certain IP it must be updated from the same IP; otherwise page name could not be reused untill the page is expired and its name reclaimed.
    • Shared page lifetime is limited to 6 hours since the last time it was updated.
    • App page lifetime is limited to 60 minutes since the last time any app session was updated.

    Sessions

    • Anonymous client can create up to 10 app sessions per hour.
    • App page session lifetime is limited to 60 minutes since the last time it was accessed or updated.
    • When a host client serving an app page is disconnected all app sessions are immediately invalidated. That's a convenient "feature" during beta-testing because when user restarts the app and refreshes the page in the browser they'll start a new session.

    Page size

    • Maximum size of a page or app session is limited to 1 MB.

    As an administrator running a pglet server it would be very useful if some/all of these options could be configured via a config file.

    The value added would be that it would allow an administrator more flexibility and control over the performance/constraints that the pglet app can offer according to the resources of the server it is on.

    As a possible solution I would suggest something like https://github.com/spf13/viper as a mature solution for golang app config via config files and environment variables. It supports multiple file formats for your config files e.g. JSON, YAML, INI etc.

    This would also allow users to deploy different configs for e.g. dev/test/staging/prod environments

  • Run HTML code as part of pglet App - Example: embed video in pglet App

    Run HTML code as part of pglet App - Example: embed video in pglet App

    Is there a way to run arbitrary HTML code in pglet? As an example streamlit has that ability via an option "run_unsafe_html"

    In particular I am interested in embedding videos.

  • errors on bash event loop

    errors on bash event loop

    run greeter.sh at https://pglet.io/docs/tutorials/bash/ I got below duplicated multiple line errors:

    pglet.sh: line 217: .events: No such file or directory
    
  • Enhancement - Application Installation Conforms to XDG Specification

    Enhancement - Application Installation Conforms to XDG Specification

    As an administrator installing pglet, I would like to have the flexibility to determine my own location e.g. /usr/local/bin/ for the application binary and any application data to be installed (respecting my permissions).

    The value added would be that it gives me the control to organize binaries and application data on my operation system according to my own desire or to conform to constraints placed on me by a third party.

    A simple solution would be that the installation script would check an environment variable e.g. $PGLET_INSTALL_DIR is set, and install to that location, and if it is not set then it falls back to the application developers chosen location.

    The only implication with this is that in future if any user-specific files are needed by pglet then it should look for them from standardized locations and again fall back if needed. as a suggested solution pglet installations could conform to the XDG base dir standard ( see freedesktop.org or the arch wiki )

    so for example it could check: $XDG_CONFIG_HOME/pglet/ $XDG_DATA_HOME/pglet/ $XDG_CACHE_HOME/pglet/ and fall back as necessary.

  • New default is not localhost

    New default is not localhost

    I was very confused for about 20 minutes today as to why my pglet pages were going to console.pglet.io and not my local machine. It wasn't until I happened to go to the blog page and saw the default behavior had changed and I needed to set PGLET_LOCAL to true (or similar in the python code)

    There may be other places that need to be updated, but I haven't searched for them

  • Gave up connecting to Client service

    Gave up connecting to Client service

    Hi,

    I'm new to pglet. I have the latest version 0.4.6 and I'm trying the simplest code possible that I could find:

    import pglet from pglet import Text

    page = pglet.page("my-app", local=True) # this page will start a local Pglet server page.add(Text('Hello, localhost!'))

    I'm using python3 and it was installed with pip3. The error is always:

    python3 hello.py 1 err 17:36:03 FATA[2021-12-08T17:36:12+01:00] Gave up connecting to Client service after 20 attemps Traceback (most recent call last): File "/Users/eperez/Documents/workspace/python/pglet/hello.py", line 4, in <module> page = pglet.page("my-app", local=True) # this page will start a local Pglet server File "/usr/local/lib/python3.9/site-packages/pglet/pglet.py", line 42, in page exe_result = subprocess.check_output(pargs).decode("utf-8").strip() File "/usr/local/Cellar/[email protected]/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/local/Cellar/[email protected]/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/local/lib/python3.9/site-packages/pglet/bin/darwin-amd64/pglet', 'page', 'my-app', '--local', '--all-events']' returned non-zero exit status 1.

    I'm using Mac OS (latest version too) and I just want to work with local server on my machine.

    Thank you.

  • ToDo app: Page name already taken error.

    ToDo app: Page name already taken error.

    I've gotten to the Python tutorial step in which we create the reusable TodoApp class and when I run the code I get the following error:

    level=fatal msg="Connect app error: Page name is already taken"

    I tried writing my own code following the example and then copied the example code, and the result was the same in both cases.

    Do I need to create a config file to make this work, or should it work on its own?

    Cheers, todo.txt

  • Fix reopening closed event pipe

    Fix reopening closed event pipe

    When a Close command is sent, the event loop tries to reopen the closed event pipe. We remove the event pipe filename during the closing function and then check for an empty filename during the event loop.

  • Expose change event separately for text inputs

    Expose change event separately for text inputs

    Currently

    Seems that the on_change event of Textbox is triggered by the input js event (i.e. while typing), and not triggered by the change js event (e.g. while pressing enter or navigating away from the control. You can experiment with this here.

    Issue

    If I want to clean up the control value in the event handler, e.g. stripping extra white space from beginning and end. As the event is triggered on input, with this cleaning operation I can no longer enter whitespace, i.e. the space between words, without resorting to gymnastics like first typing the words together and then going back to insert the space.

    Request

    It would be nice if we have on_input and on_change separately, corresponding to the standard HTML/js logic for clarity. This same would apply to all controls using the HTML <input> tag as the underlying element (SpinButton etc.)

    This might break some of the current samples, but the fix should be relatively simple in most cases, just add the same handler to on_input that you might now have for on_change.

  • Bump terser from 4.8.0 to 4.8.1 in /client

    Bump terser from 4.8.0 to 4.8.1 in /client

    Bumps terser from 4.8.0 to 4.8.1.

    Changelog

    Sourced from terser's changelog.

    v4.8.1 (backport)

    • Security fix for RegExps that should not be evaluated (regexp DDOS)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

Easy Go GUI wrapper for interactive manipulation of visual algorithms/backend code.
Easy Go GUI wrapper for interactive manipulation of visual algorithms/backend code.

RenderView ================ Install: go get github.com/TheGrum/renderview Needs either Shiny (limited functionality), Gio, go-gtk, or gotk3. The latt

Aug 4, 2022
A package to build progressive web apps with Go programming language and WebAssembly.
A package to build progressive web apps with Go programming language and WebAssembly.

go-app is a package to build progressive web apps (PWA) with Go programming language and WebAssembly. It uses a declarative syntax that allows creatin

Dec 28, 2022
Go Web UI Toolkit - Public Releases and Development
 Go Web UI Toolkit - Public Releases and Development

Welcome! Gowut (Go Web UI Toolkit) is a full-featured, easy to use, platform independent Web UI Toolkit written in pure Go, no platform dependent nati

Dec 5, 2022
Create desktop apps using Go and Web Technologies.
Create desktop apps using Go and Web Technologies.

Build desktop applications using Go & Web Technologies. The traditional method of providing web interfaces to Go programs is via a built-in web server

Dec 29, 2022
Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase
Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase. Inspired by Flutter, React. S

Apr 18, 2022
UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase
 UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

Apr 18, 2022
Native Go (golang) Graphical Interface system (2D and 3D), built on GoKi tree framework
Native Go (golang) Graphical Interface system (2D and 3D), built on GoKi tree framework

GoGi is part of the GoKi Go language (golang) full strength tree structure system (ki = 木 = tree in Japanese) package gi is a scenegraph-based 2D and

Dec 25, 2022
gosx-notifier is a Go framework for sending desktop notifications to OSX 10.8 or higher
gosx-notifier is a Go framework for sending desktop notifications to OSX 10.8 or higher

gosx-notifier A Go lib for sending desktop notifications to OSX Mountain Lion's (10.8 or higher REQUIRED) Notification Center. Update 4/3/2014 On OSX

Dec 28, 2022
Windows GUI framework for Go.

gform is an easy to use Windows GUI toolkit for Go It provides two approaches to create UI. 1. Pure code. gform.Init() mainWindow := gform.NewForm(ni

Jan 1, 2023
Cross platform rapid GUI framework for golang based on Dear ImGui.
Cross platform rapid GUI framework for golang based on Dear ImGui.

giu Cross platform rapid GUI framework for golang based on Dear ImGui and the great golang binding imgui-go. Any contribution (features, widgets, tuto

Dec 28, 2022
domui: DOM UI framework for Go

domui: DOM UI framework for Go

Jul 23, 2022
Cross-Platform GUI Framework for Go

⚠️ I'm currently working on this project as part of my master's thesis at the Berlin University of Applied Sciences and Technology. It is under active

Oct 31, 2022
Pglet server and client
Pglet server and 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 Java

Nov 15, 2022
Multi cluster kubernetes dashboard with batteries included. Build by developers, for developers.

kubetower Multi cluster kubernetes dashboard with batteries included. Built by developers, for developers. Features Restart deployments with one click

Nov 28, 2022
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Jan 5, 2023
Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

Nov 14, 2022
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Jan 5, 2023
Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

Nov 14, 2022
The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework.

jin About The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework. If thi

Jul 14, 2022
7 days golang programs from scratch (web framework Gee, distributed cache GeeCache, object relational mapping ORM framework GeeORM, rpc framework GeeRPC etc) 7天用Go动手写/从零实现系列

7 days golang programs from scratch README 中文版本 7天用Go从零实现系列 7天能写什么呢?类似 gin 的 web 框架?类似 groupcache 的分布式缓存?或者一个简单的 Python 解释器?希望这个仓库能给你答案

Jan 5, 2023