Open edX XBlock development

A practical guide to deciding when a custom XBlock is the right course component, how to build, test and package it with Tutor, and how to keep it working as Open edX moves to new named releases.

On this page

When Open edX XBlock development is the right answer

Build a custom XBlock when a course team or platform owner needs a course component that Open edX does not provide out of the box and that no combination of configuration, theming or an external tool can deliver. An XBlock is a self-contained course component: it is authored in Studio, the authoring service, and rendered for learners in the LMS, the learning service. A custom block might present a domain-specific exercise, capture structured data a grader needs, or show content from an internal system. Before you commit, check whether the need can be met by an existing block, a setting in the instructor or course configuration, a theme change, or an external LTI tool that learners launch from a course. An external tool is often the better fit when the functionality already lives in another system and the platform only needs to launch it and receive a grade. A custom block makes sense when the component must live inside the course structure, respond to the learner in the course page, and store state in the platform.

The build is harder than a single block suggests. The platform, edx-platform, is licensed under the GNU Affero General Public License version 3 and is built on Python, JavaScript and Django, so your block must work with those layers and with the license obligations that apply to your distribution. Open edX states that only the latest named release is supported, so the block has to target that release and be rebuilt when the platform moves to the next one. Confirm with your platform team which named release your deployment runs and which release is planned next, using the release notes as the reference.

Plan for testing and upgrades from the start. Develop and test the block inside a Tutor-based environment that matches your production configuration, including the plugin set, the identity provider and any analytics pipeline that receives block events. Decide who owns the block after go-live, how regression tests run against each platform upgrade, and how the block is packaged and deployed through Tutor so that it can be rebuilt on demand. Ask any development partner to show how they will verify the block in Studio and the LMS, how they will document its settings and data, and how they will keep it working across named releases, since those costs recur for as long as the block is in use.

Parts of an XBlock and the platform it plugs into

An XBlock is not a single file. It is a Python class, the views that render it for authors and learners, front-end assets, and a package that Tutor builds into the platform image. Each card below covers one of these parts and the check that matters most for it.

Python XBlock class and views

The XBlock class holds the block's fields, state and handlers, and it defines a student view for learners and an author view for course teams. Keep fields that store learner state separate from fields that store course configuration, because the two behave differently when content is exported, imported or reset. Confirm the XBlock base classes and mixins you use against the Open edX release in your environment, since the framework changes between named releases.

edx-platform repository

Studio editing interface

Course authors edit a block in Studio through an edit form built from the block's declared fields and any custom editor it provides. Validate every author input on the server side, because the editor cannot be trusted to enforce rules. Test the editing flow with a course team account, not only with a developer account, since permissions differ between roles.

LMS rendering path

When a learner opens a unit, the LMS asks the block for its student view and places the returned fragment in the page. Rendering errors surface to learners as broken units, so test the block against empty fields, missing grades and learners with no prior state. Confirm how the block reports grades and completion in the LMS in the release you run, because that path is where most functional regressions appear.

JavaScript and CSS assets

A block ships its JavaScript and CSS as fragment resources that the platform loads with the view. Keep scripts scoped to the block's own markup so they do not conflict with the LMS or other blocks on the same page. Check that asset paths and bundling still resolve after a Tutor image rebuild, since broken static files are easy to miss in local testing.

Packaged Python distribution

The block is packaged as a Python distribution with an entry point that registers it with the platform, so the LMS and Studio discover it at startup. Pin the package version and record which Open edX release it was tested against. An unpinned package can change behavior after an image rebuild without any change in your own code.

Tutor plugin and hooks

Tutor installs the block into the Open edX image through its plugin and hooks system, which is licensed under Apache 2.0. The plugin declares the package to install and any settings it needs, and the image is then rebuilt and deployed. Keep the plugin in version control next to the block so that a rebuild on a new host produces the same platform. Confirm the hook names and plugin API against the Tutor version you run.

Tutor documentation

Which extension path fits the requirement

Start here when the requirement can be met with the course components Studio already provides, such as problem types, HTML, discussion, and text or video components, arranged through course structure and settings. This path has the lowest operational cost because the upgrade team does not own any custom runtime code, and the release notes for each named release describe changes to these components.

  • Upgrade ownership: The platform maintainers test the components, so your team only regression-tests your own course content after each release.
  • Custom runtime exposure: None. No code runs in the learner or Studio sessions beyond what ships with the platform.
  • Limits: You cannot add new interaction models, scoring logic or data storage that the stock components do not offer.
  • Recurring cost: Course content maintenance by course teams, which is outside platform engineering.
  • Ask your vendor: Which stock components satisfy each requirement in your written list, and which gaps remain.

Check each requirement against the stock components before you accept that a gap exists, because many requests are really content design problems.

How to build, test and package an XBlock with Tutor

This sequence takes a custom XBlock from requirements to a package that installs into a Tutor build and behaves correctly in a test course. Each step ends with a check you can run before moving on, so problems surface while the block is still small. The output is a tested, installable block plus the evidence that it renders, saves and grades in the LMS.

  1. Define learner, author and data requirements

    Write down what a learner does with the block, what an author configures in Studio, and which data the block must store per learner and per course. Decide which fields are scope-level settings and which are user state, because that split drives everything else. Confirm whether the block needs grading, and if so, which score it reports. Done means a one-page spec that a developer and a course author have both read and agreed to, with each field named and typed.

  2. Scaffold the block package

    Create a Python package with an XBlock class that declares its fields, along with an entry point so the platform can discover it. Keep the package structure simple and include a README and a test folder from the start. Confirm the required Python and Node.js versions for your target release in the edx-platform repository before you choose a local toolchain, since the platform sets these per release. Done means the package installs into a clean virtual environment and the class imports without errors.

  3. Implement student and author views with assets

    Write the student view that learners see and the author view that appears in Studio, then add the stylesheets and JavaScript each one needs. Use the XBlock field declarations for all saved state so values persist between sessions. Keep the author view limited to editing the scope-level settings from step one. Done means both views render with sample data when you load them directly in a unit test or a bare XBlock runtime, with no missing static files.

  4. Set up a local Tutor development environment

    Install Tutor and start a local Open edX instance using the Docker-based setup described in the Tutor documentation, which covers the platform services the LMS and Studio need. Work against the Tutor version that matches the Open edX release your client runs in production, not the newest one by default. Done means you can log in to the local LMS and Studio as an administrator and reach both without errors.

  5. Install the block through a Tutor plugin

    Package the block as a Tutor plugin so the install step is repeatable. The plugin declares the Python package to install into the platform images and uses Tutor's plugin and hooks system for any configuration it needs. Rebuild the local images and restart the stack. Done means the block's entry point appears in the platform after a clean rebuild, and the same plugin installs on a second machine without manual steps.

  6. Add the block to a test course in Studio

    Create a test course in Studio, open the advanced component menu, and confirm the block is listed. Add an instance, open the author view, and set the scope-level fields. Publish the unit and preview it. Done means the block is visible in the Studio component menu, the author settings save and reappear after a page reload, and the published unit shows the block's student view.

  7. Check rendering, saving and grading in the LMS

    Enroll a test learner, open the unit in the LMS, and interact with the block. Reload the page and confirm the learner state persists. If the block reports a score, check that the value reaches the gradebook and the progress page, and that a second learner's state stays separate. Done means the learner state survives reloads and sessions, the grade appears where expected, and you have recorded these results with the platform and plugin versions you tested.

  8. Package and confirm a clean install

    Tag the block and its Tutor plugin with a version, write the install and configuration notes, and run one final test into a fresh Tutor build. Keep the test suite in the repository so the same checks run before each platform upgrade. Done means a fresh build installs the tagged package cleanly, the test suite passes, and the install notes let a second engineer reproduce the setup without help. Confirm the supported release and dependency versions again before handover, because the block must be retested when the platform moves to a new named release.

What drives XBlock effort and how to keep it down

This table lists the main factors that change how much work a custom XBlock takes to build, test and keep running, with a practical way to reduce each one. Read it as a checklist for the scoping conversation: the drivers that apply to your block are the ones to ask a partner to price explicitly. No effort figures are given here, so request a scoped estimate built from your own block list and environments.

DriverWhy it changes effortHow to keep it down
Interaction statesEach learner and author state (unanswered, submitted, graded, edited, previewed) adds branches to the handler code and to the tests that cover them.Define the states on paper before coding, limit each block to a small set of them, and reuse standard question or problem patterns where they fit.
Grading and gradebook integrationScores must reach the LMS gradebook correctly, including partial credit, resubmissions and reset actions, which is where most subtle defects appear.Use the standard grading and score-reporting interfaces rather than writing direct database updates, and test resubmission and reset paths early.
Data stored per learnerFields stored per learner or per block affect migration, privacy review, export and the cost of later changes to the data shape.Keep stored state small and versioned, store only what the course needs, and document each field for your privacy and data retention reviewers.
Number of environmentsEach environment (local Tutor, development, staging, production) needs its own install, configuration and test run, and drift between them causes late failures.Install blocks the same way everywhere through your Tutor configuration, pin versions, and keep one scripted smoke test that runs in every environment.
Frontend build toolingBlocks that ship their own JavaScript build pipelines add dependencies, bundle steps and browser compatibility work that must be rechecked on each platform update.Keep front-end assets small, prefer the runtime's provided libraries, and avoid custom bundlers unless a feature truly needs one.
LMS and Studio couplingA block that reads or writes LMS internals or Studio internals breaks when either side changes, so every release upgrade becomes a code review.Limit custom runtime calls, use the documented XBlock runtime APIs, and keep block logic inside the block package.
Accessibility requirementsKeyboard operation, screen reader labels, contrast and focus handling add design and test cycles, and retrofitting them is costly.Agree the accessibility standard at scoping, build semantic markup from the start, and include accessibility checks in the test plan.
Release upgrades the block must surviveOpen edX supports only the latest named release, so each upgrade may require changes to the block, its tests and its dependencies.Write automated tests early, track the block's compatibility with each named release, and ask for the upgrade approach in the quote. Confirm current release dates with the Open edX release notes.

Keeping custom blocks working across named releases

Open edX supports only the latest named release and cannot support more than one at a time, so every custom XBlock has to be retested and adjusted each time the platform moves to a new release. The current named release is Verawood, published on 30 July 2026, and the release notes list Willow for December 2026 and Xylon for June 2027. Plan around that rhythm: treat each named release as a point where your blocks, their dependencies and their tests must be re-validated before production moves. Confirm the dates against the Open edX release notes when you set your upgrade calendar, because the listed dates can change.

Start by pinning versions so an upgrade is a deliberate change rather than an accident. Pin each block's package version in the Tutor plugin or image build, pin the Tutor version itself, and record which named release each block was last validated against. Read the release notes for every target release and search the edx-platform repository for changes to the APIs your block imports, including the XBlock runtime, the Studio authoring hooks and any xmodule or Django modules it touches. Breaking changes often show up as deprecations one release earlier, so review the previous release's notes as well as the target's. Keep a short compatibility log per block that names the release, the platform version tested and the known issues.

Automated tests are the control that makes the rest practical. Maintain a suite that runs your block's unit tests and, where possible, integration tests that create a course, add the component in Studio, publish it and render it in the LMS. Run that suite against the target release in a staging environment built with the same Tutor version and plugin set as production, using a copy of representative course content. Schedule upgrade windows that allow time for failures to be fixed and retested before cutover, and confirm with your team, or with a partner under a retainer, who owns that work and how it is priced. Keep rollback to the prior release and the prior block version documented before the window opens.

How an XBlock moves from authoring to learner view

The flow starts in the block's own repository, where the developer packages it as a Python distribution. A Tutor plugin then installs that package into the Open edX image, so both Studio and the LMS load the same code. Authors place the block in a course in Studio, where the author view renders it and its fields are saved to the course structure. In the LMS, the student view renders the block, stores learner state, and reports grades back to the platform. Check the boundary: everything inside the custom box is yours to test and maintain, while the platform core is the part you upgrade with each named release.

Custom XBlock code moves from repository to Studio and LMS through a Tutor plugin.

How deployment model changes XBlock delivery

On one Docker host, Tutor runs the LMS and Studio containers from the same image, so a block installed into that image is the code every learner and author sees. Delivery is a build and a container restart. Because there is only one copy of each service, the main risks are a bad release that breaks existing units and state that the database already holds.

  • Image build: Install the block into the Tutor image with tutor images build, so the image tag is the exact artifact under test.
  • Restart and stored state: Restarting the LMS and CMS containers loads new block code, while course content stays in MySQL and MongoDB. Keep stored field names and block behavior compatible with existing content.
  • Static assets: Block JavaScript and CSS are collected during the build. Confirm collection runs after every change.
  • Plugin configuration: Enable and configure the plugin that wires the block in with tutor plugins enable and tutor config save.
  • Backups before rollout: Snapshot the databases and media volume before each block change so a failed release can be reversed.

Before promoting a build, check that staging runs the same image tag that production will receive.

Vetting and securing custom block code

A custom XBlock runs inside the LMS and Studio, so it inherits the trust of those services and handles learner data. The cards below cover the parts of a block that need review before release and the operational habits that keep it contained.

Unsafe HTML and script rendering

Any block that renders author or learner text can introduce cross-site scripting into a course page. Check every place the block writes markup, and whether it escapes values or passes them through as raw HTML. Pay particular attention to rich text fields, iframes and attributes built from user input. Confirm that the block uses the platform's templating and escaping helpers and does not inject unescaped strings into the page or the JavaScript it loads.

Learner input and stored state

Decide what the block accepts from learners, how it validates that input on the server, and what it saves. Server-side handlers should not trust values sent from the browser, including scores, attempt counts and identifiers. Review what fields are written to the block's stored state, how long they persist, and whether a learner can read or overwrite another learner's state through a handler that skips ownership checks.

Secrets kept out of block code

API keys and service credentials should come from Tutor configuration and the runtime environment, never from constants in the block repository. Check the block for hard-coded tokens, default passwords and test credentials. Confirm that secrets are injected through the plugin configuration that Tutor manages, and that the repository history contains none, since a leaked key in past commits remains exposed.

Python and JavaScript dependency review

Each package a block pulls in widens the code that runs inside the LMS. Review every Python and npm dependency for maintenance status, known vulnerabilities and license compatibility with the AGPL platform. Pin versions, record them in the block's packaging metadata, and rerun the review when a release changes the platform's shared libraries, since a version that conflicts with those libraries can break the block silently.

Least-privilege access for block services

If a block calls an external service, give it a dedicated account scoped to the one operation it needs, with no access to course authoring or other learners' records. Keep outbound calls to an allowlist of hosts and set timeouts so a slow service cannot stall page rendering. Confirm who holds the credential, how it rotates, and what the external service can see about each learner.

Block error logging without learner data

Log enough detail to diagnose a failing block, such as the block type, the course and component identifiers and the exception class, while leaving out answers, free-text responses, email addresses and tokens. Review what the block sends to application logs and any external monitoring tool. Confirm with your security and privacy team which fields count as personal data in your jurisdiction, and set retention for those logs to match your policy.

How to test that a block works and fails safely

A block is only ready for learners when its logic, its rendering, its behavior inside a live course and its failure modes have each been tested separately. Build the suite in layers, starting with unit tests for block logic: grading calculations, field validation, state transitions and any handler that accepts input from the browser. Keep these tests independent of the platform where you can, so a failure points directly at your code. Next, add rendering tests for the student view and the author view in Studio, checking that each renders the expected markup for the states a learner or course author can reach, including empty, partially completed and maximum-score cases. Rendering tests catch the common breakage where a block works in isolation but fails once the platform's template or asset pipeline changes around it.

Integration tests come next and should run in a Tutor-based test environment with a seeded course that contains your block in realistic positions: a unit with other components, a graded subsection, and a course with a second block of the same type. Confirm that Studio can create, edit, duplicate and delete the block, and that the LMS delivers it to an enrolled learner and records any submission. Then cover failure paths on purpose. Force an exception in the student view and confirm that the learner sees a clear fallback message while the rest of the page still loads. Restart the platform containers mid-attempt and confirm whether saved state survives. Finally, insert a block whose handler raises an error into a page with other content and confirm the page still renders. Record what you expect for each case before you run it, because a block that fails silently is harder to find than one that fails loudly.

Finish with a manual acceptance pass that no automated suite replaces. Check keyboard navigation, screen reader labels and focus order, color contrast and behavior at common mobile widths, and walk the full learner flow from enrollment through completion as a test learner would. Then run the complete suite against the next named Open edX release before you upgrade production, using the release notes to identify the target and confirming with your upgrade plan which version will be the next supported one. A block that passes on the current release but breaks on the next one is the most expensive failure to find after go-live, so treat a green run on the upcoming release as a condition for the upgrade window.

What to monitor, back up and document after go-live

This table lists what the team must keep current once a custom XBlock is live, who owns each item and how often it should be reviewed. Use it as a starting checklist to agree ownership in the statement of work, then confirm review cadence with your own change process. The main takeaway is that a block is only supportable across releases if its version, tests and rollback path are recorded per release, not kept in one developer's head.

ItemOwnerReview cadence to agreeWhat to keep or check
Block version and target releasePlatform lead with block developerAt each Open edX release and each block changeRecord the block package version and the named Open edX release it targets, such as Verawood, and the Tutor version it was built with.
Packaging and deployment recordPlatform operationsAt each deploymentKeep the package source reference, the Tutor plugin configuration and the image build that carried the block into each environment.
Automated test results per releaseBlock developer and QA leadBefore each release upgrade and each deploymentStore unit and integration results for the block against the target release, including any failures accepted with a stated reason.
LMS and Studio error logs tied to the blockPlatform operationsAgree a review interval during onboardingFilter logs for the block's name and course locations so block errors can be traced separately from core platform errors.
Backups of course content with block dataPlatform operations with the course teamConfirm backup schedule and restore test interval in writingConfirm that backups include the course data that stores block settings and learner state, and test a restore into a non-production environment.
Rollback runbookPlatform lead, approved by the client's change ownerReview before each upgrade and after each incidentDescribe how to revert the block package, the Tutor configuration and, where needed, the database state, with the people who can authorize each step.
Ownership and support contactsClient product owner and DeployOpenConfirm at go-live and whenever staff changeName who fixes block defects, who approves a release upgrade and who is on call for the block, in the support agreement.

Questions teams ask before building an XBlock

Do we need a custom XBlock or will a configuration do?

Use a custom XBlock only when no existing component or setting gives learners or course teams the interaction you need. Standard components, course settings, Tutor configuration and existing plugins cover many requirements, and they cost less to keep working across releases. An XBlock makes sense when the interaction is a new component type, such as a custom assessment or a simulation that must be placed inside units and graded by the LMS. Before scoping, list each requirement and check whether it can be met by configuration, a plugin, or an LTI tool. Ask your partner to document why a block is the better option, because that reasoning will shape the testing and upkeep you pay for later.

How much effort does a custom XBlock take and what drives it?

Effort depends on what the block must do and how deeply it integrates with the platform. The main drivers are the number of learner and author views, whether it stores student state and grades, how it connects to external services, how much it must match your brand and accessibility requirements, and whether it needs the Studio editing experience. Each additional integration point adds design, build and test work. Ask for a fixed-scope quote that lists each view, each data flow, each external dependency and the test cases you expect the block to pass, so the price follows from written deliverables rather than an estimate.

How long does XBlock development take?

The timeline is set by the number of views and integrations, the number of review rounds your team can commit to, and how quickly staging environments are available. Scoping, build, Tutor-based testing in a staging environment, accessibility and content review, and packaging each take time, and reviewer availability often sets the pace more than coding does. Ask for milestones tied to deliverables in the written scope. If your course calendar has fixed dates, agree on a freeze date for block changes early, because a block that is still changing during course build will slow content teams down.

What must our team provide before the build starts?

Your team needs to provide a few things that only you can supply. These usually include:

  • Sample courses or units that show where the block will appear and how authors will use it
  • A staging Tutor environment that matches the production configuration, including plugins and any identity provider settings
  • Named reviewers for learning design, accessibility, and technical sign-off, with time reserved in their calendars
  • Access to any external services the block calls, with test credentials and documented data rules

Agree on who approves changes and where feedback is recorded before work starts. Missing inputs are the most common cause of rework.

Can our in-house team build and maintain an XBlock alone?

An in-house team can build and maintain a block if it has Python and Django skills, experience with the Open edX codebase, and time to test each change against a staging Tutor environment. The harder part is ongoing ownership. The team must keep track of each named release, rerun tests when the platform changes, and handle a block that breaks after an upgrade. Ask yourself whether those responsibilities fit into existing roles. If they do not, a fixed-scope build with a documented handover, followed by a retainer for upgrades and testing, may suit you better than building the skills from scratch.

How do we keep an XBlock working across the release cycle?

Open edX supports only the latest named release at a time, so a block has to be checked against each new release you plan to adopt. Verawood is the current named release, and the next releases, Willow and Xylon, are listed for December 2026 and June 2027. Keep the block in version control, pin its dependencies, and maintain automated tests that run against a Tutor build of the target release. Before each upgrade, run those tests in staging with your real course content, then review any deprecated APIs the release notes mention. Plan this work as recurring effort, not a one-time task.

What should we check before accepting a block into production?

Check the block against its written acceptance criteria, its automated tests, and a manual pass in a staging environment that mirrors production. Confirm that it stores learner state correctly, that grades reach the gradebook, that it works with your identity provider and that it meets your accessibility standard. Review its code for security issues, including how it handles user input and external calls. Ask for documentation that covers installation with Tutor, configuration keys, known limitations and the upgrade steps for each release, so your team can operate it without the original developers.

How DeployOpen scopes, builds and supports custom XBlocks

DeployOpen plans, builds, tests, documents and supports custom XBlocks inside your own infrastructure, on engagements agreed as fixed-scope work with written deliverables. Each block is scoped against the Open edX release you run, then handed over with the documentation and tests your own team needs to keep it working.

How we scope

  • We confirm which course components need custom behavior and whether an XBlock is the right tool for each one.
  • We document the target Open edX release, the Tutor version and the hosting model before any code is written.
  • We agree the written scope, deliverables and timeline with you before work starts, and we list what is out of scope.

How we build

  • We develop each block in a Tutor-based local environment that matches your production configuration as closely as practical.
  • We write automated tests for block behavior, learner state and Studio editing, and we run them against your chosen release.
  • We package blocks so they install through your Tutor configuration and can be deployed repeatably into your own infrastructure.

How we hand over

  • You receive source code, packaging files, installation steps and a short guide to each block's settings and data.
  • We document known limits, dependencies on specific Open edX releases and the checks your team should run before each upgrade.
  • We walk your engineers through the deployment and test suite so the blocks stay maintainable after the project closes.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, scoped in writing for your block portfolio.
  • When a new named release is adopted, we retest custom blocks against it and report what needs changing before rollout.
  • Support scope, response expectations and release-tracking responsibilities are confirmed in the written agreement, not assumed.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.