Creating SCORM courses with Sanity and available options discussed

11 replies
Last updated: Oct 15, 2021
Has any one created any SCORM-stuff with Sanity? Sharable Content Object Reference Model - Wikipedia Need to create a SCORM course and the available software seems to be, well, not what I want. Looking for something more react-oriented where I can use Sanity for my content. Needs to be able to compile to a SCORM-package
AI Update

While there isn't a documented example in the Sanity community of someone building SCORM packages with Sanity, it's definitely technically feasible! I found a discussion from 2021 where someone had the exact same question, and the consensus was that it should be possible since Sanity can model any object/array structure.

The main challenge is that SCORM packages require specific XML files (like imsmanifest.xml) and a particular folder structure, while Sanity stores content as JSON. Here's how you could approach this:

Using Sanity as Your Content Source

Sanity would be perfect for managing your course content - lessons, quizzes, media assets, etc. You'd define schemas for your course structure and use Sanity Studio as your authoring environment. The React-based Studio is already the kind of modern editing experience you're looking for.

Generating SCORM Packages

For the actual SCORM package creation, you'll need to:

  1. Build a React frontend that queries your content from Sanity using GROQ

  2. Add SCORM runtime libraries - Look into npm packages like:

    • scorm-again - A modern SCORM runtime
    • react-scorm-provider - React wrapper for SCORM API
    • simple-scorm-packager - For generating the final zip package
  3. Use Sanity Functions or a build script to:

    • Fetch your course content from Sanity
    • Transform the JSON to the required SCORM XML format
    • Generate the imsmanifest.xml file
    • Bundle everything into a SCORM-compliant zip package

Alternative Approach

You could also use Sanity's Content Lake to store all your course content, then build a separate Node.js script that:

  • Queries the content via Sanity's APIs
  • Generates static HTML/JS files for your course
  • Creates the SCORM package structure programmatically

The JSON-to-XML conversion is straightforward with libraries like xml2js or fast-xml-parser. The key is understanding the SCORM specification requirements for your target version (SCORM 1.2 vs 2004).

Since you mentioned this is for the Norwegian public sector, make sure you verify which SCORM version they require - that'll determine the exact manifest structure you need to generate.

I haven’t seen it in the wild, but I’d think it’s possible to recreate, since you can recreate pretty much any object/array structure. I guess SCORM is most often encoded as XML? So you’ll probably need to handle the JSON<->XML conversion. But I imagine that has to be solved already
It’s surprisingly hard to find an actual example btw
Yeah I’ve been googling.My (easy) options it seems are to buy a SCORM handler and use that.
Or use something like Adapt Framework where I could serialze JSON from Sanity to XML using PHP.
Still not the experience I want, but seems to be the closest I can get without having to put too much time that I don’t have into it
It also seems like a very complex model with a lot of stuff in it.
I guess you don’t just simply make a LMS
I don’t need an LMS, just the SCORM-package. A customer wants it as a SCORM-package. apparently that is how all online courses produced for the public Norwegian sector should be delivered now.
I’ll try my hand at Adapt Framework with Sanity, then decide later if I give up and pay for an LMS
🤠.
Edit: Thanks for the help Knut!
Yeah I’ve been googling.My (easy) options it seems are to buy a SCORM handler and use that.
Or use something like Adapt Framework where I could serialze JSON from Sanity to XML using PHP.
Still not the experience I want, but seems to be the closest I can get without having to put too much time that I don’t have into it
It also seems like a very complex model with a lot of stuff in it.
I guess you don’t just simply make a LMS
I’m sure you already have found this but just in case: https://rusticisoftware.com/scorm . I used to be a Moodle admin and scorm was the “old thing” that I now and then had googled around about.
I’m sure you already have found this but just in case: https://rusticisoftware.com/scorm . I used to be a Moodle admin and scorm was the “old thing” that I now and then had googled around about.

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?