DEV.co
Open-Source Databases · rstudio

learnr

learnr is an R package that converts R Markdown documents into interactive tutorials with exercises, quizzes, and videos. It lets learners write and execute code directly in the browser, with automatic progress saving. Designed primarily for teaching R, statistics, and data science topics.

Source: GitHub — github.com/rstudio/learnr
736
GitHub stars
241
Forks
R
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryrstudio/learnr
Ownerrstudio
Primary languageR
LicenseApache-2.0 — OSI-approved
Stars736
Forks241
Open issues152
Latest releasev0.11.6 (2025-11-13)
Last updated2025-11-13
Sourcehttps://github.com/rstudio/learnr

What learnr is

learnr extends R Markdown to create interactive web-based tutorials using Shiny components for code execution and form validation. It supports embedded code exercises, quiz questions, video embeds (YouTube/Vimeo), and session-level progress persistence. Built on rmarkdown and Shiny ecosystems.

Quickstart

Get the learnr source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/rstudio/learnr.gitcd learnr# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

R/Statistics Education Platforms

Ideal for creating self-paced, interactive courses in R, data science, SQL, and statistics. Learners can run code directly without setup friction, and tutorials preserve work between sessions.

Internal Training & Onboarding

Distribute tutorials across teams to teach R workflows, packages, or data analysis processes. No special infrastructure needed beyond R/RStudio; tutorials run in standard web browsers.

Supplementary Course Materials

Pair with traditional courseware to provide hands-on coding practice. Quiz and exercise components give formative feedback; code validation helps catch common errors.

Implementation considerations

  • R and RStudio (or Shiny Server) are mandatory dependencies; ensure your infrastructure can host and scale them appropriately.
  • Tutorials execute arbitrary R code server-side; untrusted user input or compute-heavy exercises could exhaust resources. Implement resource limits and code sandboxing if hosting for external users.
  • learnr does not provide built-in user authentication, role management, or audit logging. Layer these yourself or use a reverse proxy (e.g., Shiny Server Pro).
  • Progress is stored in browser session/local storage by default; persistent learner tracking requires custom backend integration.
  • Interactive Shiny components add runtime overhead. Complex tutorials with many concurrent users may require load balancing and tuned Shiny configuration.

When to avoid it — and what to weigh

  • Non-R Technical Stacks — learnr is R-centric. If your primary language is Python, Java, or JavaScript, this tool adds friction. Other environments may be better integrated with non-R tech stacks.
  • Large-Scale Multi-Tenant SaaS — learnr is not a learning management system (LMS). For high-volume user tracking, compliance reporting, role-based access, or tight SaaS isolation, you need dedicated platform infrastructure.
  • Real-Time Collaborative Editing — learnr tutorials are single-user, single-session workspaces. No built-in support for live pair programming, instructor monitoring, or collaborative code execution.
  • Restricted Deployment Environments — Requires R runtime and Shiny server. If your target environment cannot run R (e.g., heavily restricted cloud, air-gapped networks), this won't fit without significant infrastructure work.

License & commercial use

Apache License 2.0 (Apache-2.0). A permissive OSI-approved license allowing commercial use, modification, and distribution with attribution and liability disclaimers.

Apache-2.0 permits commercial use of learnr itself (bundling, reselling, offering as part of a service). However, verify your use case does not conflict with other dependencies (e.g., Shiny Server Pro licensing if you use it). No warranty is provided; ensure your liability model aligns with Apache terms.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

learnr runs R code server-side on user input. Key risks: (1) Code injection if user input is unsanitized; (2) Resource exhaustion (CPU, memory) from malicious or careless R operations; (3) Unauthorized data access if the R process has file system or network permissions. Mitigation: isolate R processes, restrict permissions, validate/sandbox code where possible, and audit session logs. No cryptographic features or encryption mentioned; assume data in transit and at rest is only as secure as your hosting environment and R session isolation.

Alternatives to consider

Jupyter Notebooks / JupyterHub

Language-agnostic, supports Python/R/Julia, stronger for reproducible research. More complex to deploy at scale; less opinionated pedagogy framework.

Posit Cloud (formerly RStudio Cloud)

Hosted alternative to learnr; managed R environment with no infrastructure burden. Proprietary SaaS model; less fine-grained control over content and user isolation.

Dataquest / Coursera / Udacity

Full-featured learning platforms with built-in progress tracking, quizzing, and compliance. Higher cost; less customization for domain-specific workflows.

Software development agency

Build on learnr with DEV.co software developers

learnr simplifies creating hands-on coding courses with automatic progress saving and instant feedback. Evaluate your hosting model (local, Shiny Server, or managed cloud) and assess custom integrations for user tracking and compliance.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

learnr FAQ

Can I deploy learnr tutorials without RStudio or Shiny Server?
No. learnr tutorials require an R runtime and Shiny infrastructure to execute code interactively. You can use Posit's managed hosting (Posit Cloud) or self-host via Shiny Server, RStudio Server, or a Docker container with Shiny configured.
Does learnr track user progress and grades?
Not by default. Progress is saved in the browser session. For persistent tracking (user accounts, grades, learning analytics), you must integrate a backend database and authentication layer outside of learnr.
Can I embed learnr tutorials in an LMS like Canvas?
Not directly. learnr tutorials are standalone Shiny apps and cannot be natively embedded in LMS iframes without custom configuration. You can link to external tutorials or build custom LTI bridges if your LMS supports them.
Is learnr suitable for Python instructors?
Partially. learnr is R-first and designed for R Markdown; Python is supported through code chunks, but the ecosystem, documentation, and default examples are R-centric. Python-primary instructors may prefer Jupyter or dedicated Python tutorial platforms.

Work with a software development agency

From first prototype to production, DEV.co delivers software development services around tools like learnr. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source databases and beyond.

Ready to Build Interactive R Tutorials?

learnr simplifies creating hands-on coding courses with automatic progress saving and instant feedback. Evaluate your hosting model (local, Shiny Server, or managed cloud) and assess custom integrations for user tracking and compliance.