{shiny} app as a package
golem
is an opinionated framework for building production-ready {shiny} applications
- learn the basic now…the rest of the book relies on it
What is in a production-grade {shiny} app?
- Use one single file, or split into two?….that is the question!
- We will discover, this is an arbitrary question when managing large production level shiny apps
- Modulizing code will be your success factor
- It has metadata
- This could include: naming convention, version numbering, what the app does, who to contact when it breaks….and it WILL break
- It handles dependencies
- You need to handle them, and handle them correctly if you want to ensure a smooth deployment to production
DESCRIPTION
: contains the packages your application depends on
NAMESPACE
: contains the functions/packages you need to import
- It’s split into functions
- When apps get big…spread the wealth to smaller manageable files
- The smaller files go into the
R/
directory
- It has documentation
- Document, Document, Document!!!
README
can be simple like a markdown file
Vignettes
are a bit more complex, possibly with examples
- Function documentation could include inline notes
- You may even create a
{pkgdown}
webpage for IT and other developers
- It’s tested
- Nothing should go to production without being tested. Nothing.
- examples could include
{testhat}
- There is a native way to build and deploy it
- Finally, create a
tar.gz
file to make it easy for distribution