MLaaS Entrepreneurship 2: Let’s understand basic web app architecture in Shiny R

ARUN KUMAR SHARMA
3 min readMay 11, 2021

R is a programming language widely known for its ease of use. We will develop MLaaS businesses based on R Shiny Web Apps. Shiny is the component of R that creates super easy web apps very quickly.

Let’s begin with some essential installations. We need following libraries :

library(shiny)

library(shinydashboard)

library(shinydashboardplus)

library(shiny.semantic)

library(shinyjs)

I assume that you already know about R and have done few projects so you must be knowing how to install these libraries in the workspace. Now, you can open shiny web app file as shown in the picture (File>New File>Shiny Web App):

After clicking on the “Shiny Web App” button, another dialogue box opens:

Here, we need to give a name to our shiny web app, choose application type: Single File (app.R) or Multiple File (ui.R/server.R) and create a working directory to save web app files.

In the Application Type option, if we choose “Single File” then it creates and saves the file with name — app.R in the selected working directory and in a folder named as Application Name given by you.

In the Application type option, if we choose “Multiple Files” then it creates and saves two files with names — ui.R and server.R in the selected working directory and in a folder name as application Name given by you.

We will use the application type option — Multiple Files and create two files — ui.R and server.R. When we open ui.R file, we see the following default set of chunk provided by the shiny package:

When we open server.R file, we see the following default set of chunk provided by the shiny package:

Let us understand ui.R and server.R file one by one. The ui.R file creates the interface of the web app. The ui.R file is the interface for feeding user inputs and showing outputs.

The server.R file is the file where all machine learning mechanics happens. User inputs from ui.R is passed on to the server.R file and the server.R file processes the inputs and creates outputs and sends it back to the ui.R file.

We shall discuss the basic file structure of the shiny server in the next article. I hope you have started your MLaaS entrepreneurship journey.

--

--

ARUN KUMAR SHARMA

A Machine Learning Enthusiast, Passionate About Using Machine Learning for Building Startups