Deploy with WebAssembly
Deploy marimo notebooks that run entirely in the browser using WebAssembly (WASM). No Python backend required—notebooks execute directly in the user’s browser via Pyodide, a port of CPython to WebAssembly.Why WASM Deployment?
WASM notebooks offer unique advantages:Zero Infrastructure
No backend servers to maintain, configure, or pay for. Host static files anywhere.
Instant Access
Users don’t need Python installed. Works on any device with a modern browser.
Low Latency
No network requests to remote servers. All computation happens locally.
Easy Sharing
Share via link, embed in documentation, or publish to GitHub Pages.
WASM notebooks are ideal for: interactive documentation, educational materials, blog posts, lightweight data exploration, quick prototyping, and shareable tools. For heavy computation or large datasets, use a traditional backend.
Deployment Methods
marimo offers three ways to deploy WASM notebooks:1. Export to WASM HTML
Generate a standalone HTML file with embedded WebAssembly:- ✅ Runs completely offline
- ✅ Contains your entire notebook
- ✅ Includes all marimo dependencies
- ✅ Can be hosted anywhere (GitHub Pages, S3, Netlify, etc.)
1
Export notebook
2
Host the HTML file
Upload to any static hosting service:
3
Share the URL
Your notebook is now live and executable in any browser!
2. Online Playground
Use marimo.new for instant WASM notebooks:- No installation required: Create and run notebooks in your browser
- Share via link: Get a shareable URL instantly
- No login needed: Start coding immediately
- Great for demos: Embed in documentation or presentations
3. Community Cloud
Deploy to marimo.io for managed WASM hosting:- Workspace management: Organize notebooks in collections
- Public or private: Control access with email-based authorization
- Nice URLs: Get shareable links like
https://marimo.app/@username/notebook - Free tier: Host notebooks at no cost
Working with Packages
Pre-installed Packages
WASM notebooks come with many packages pre-installed:- Scientific: NumPy, SciPy, scikit-learn, pandas
- Visualization: matplotlib, altair, plotly
- Data: polars, DuckDB, pyarrow
- ML: scikit-learn, xgboost (selected packages)
Installing Additional Packages
Usemicropip to install packages at runtime:
Auto-install on Import
marimo automatically attempts to install missing packages:Using Script Metadata
Declare dependencies using PEP 723 inline metadata:Capabilities and Limitations
What Works
✅ Full marimo reactivity: UI elements, reactive execution, dataflow ✅ Most Python: Standard library, pure Python packages ✅ Data manipulation: pandas, polars, NumPy, DuckDB ✅ Visualization: matplotlib, altair, plotly, seaborn ✅ File operations: Read/write using browser’s virtual filesystem ✅ API requests: Fetch data from APIs (with CORS support) ✅ Machine learning: scikit-learn, lightweight modelsLimitations
❌ Heavy computation: Limited by browser performance ❌ Large datasets: Browser memory constraints (~2GB typically) ❌ Native extensions: C/C++ packages without WASM builds ❌ System calls: No real filesystem, subprocess, etc. ❌ Long-running jobs: Browser tabs can timeout ❌ Networking: Subject to CORS restrictionsFor these use cases, deploy with a traditional Python backend using
marimo run or programmatic deployment.File Operations
Reading Files
WASM notebooks use a virtual filesystem:Writing Files
Write to virtual filesystem and download:Embedding WASM Notebooks
Embed interactive notebooks in any webpage:iframe Embed
Self-hosted Embed
Host your exported HTML and embed:GitHub Pages Deployment
Automate deployment to GitHub Pages with GitHub Actions:Manual Deployment
Automated with Actions
Create.github/workflows/deploy-wasm.yml:
Advanced Configuration
Custom Loading Screen
Customize the loading experience in exported HTML:Performance Optimization
1
Minimize dependencies
Only import what you need. Fewer packages = faster load time.
2
Use lazy imports
Import heavy packages only in cells that use them.
3
Optimize data size
Keep datasets small. Consider loading data from URLs instead of embedding.
4
Cache computations
Use
@functools.cache for expensive operations.Loading External Data
Fetch data from APIs instead of embedding:Use Cases
Interactive Documentation
Educational Materials
Teach concepts with interactive examples:Data Exploration Tools
Build shareable data apps:Security Considerations
For applications requiring secrets or server-side logic, use traditional deployment withmarimo run.
Troubleshooting
Package Not Found
Slow Loading
- Reduce number of dependencies
- Use lighter-weight alternatives (e.g., polars instead of pandas)
- Split into multiple smaller notebooks
Memory Issues
- Reduce dataset size
- Process data in chunks
- Use more efficient data structures
CORS Errors
When loading external data:- Use CORS-enabled APIs
- Host data on CORS-friendly services (GitHub raw, jsDelivr)
- Consider embedding small datasets directly
Examples
Explore WASM notebooks:- marimo Gallery - Community-created notebooks
- marimo Playground - Try creating your own
- Documentation Examples - Embedded interactive examples
Best Practices
Next Steps
Export to WASM
Learn more about exporting options
Playground
Create WASM notebooks instantly
GitHub Pages
Automate deployment to GitHub Pages
Community Cloud
Deploy to managed WASM hosting