Shinylive - shiny apps with no server

Minimal example showing an interactive webpage in shiny without a server!

Published

October 28, 2023

A Shiny for R App involves constant communication between two things: 1) the website (shiny) or basically what you see and interact with, and 2) the server that crunches data from your interactions in R. With any communication, it’s a labor of love - it takes time, effort, and things break if there isn’t communication. A Shinylive App, as opposed to a Shiny for R App, does not involve this communication between the website and server. The data crunching from your interactions occur on the website. No server is needed - no communication - no extra time, effort, and chance of breaking from no communication.

Below is an example of a Shinylive App. The interaction (i.e. slider) data is crunched directly on this website. No extra communication needed.

#| standalone: true

from shiny import *

app_ui = ui.page_fluid(
    ui.input_slider("n", "N", 0, 100, 40),
    ui.output_text_verbatim("txt"),
)

def server(input, output, session):
    @output
    @render.text
    def txt():
        return f"The value of n*2 is {input.n() * 2}"

app = App(app_ui, server)