- Notifications
You must be signed in to change notification settings - Fork85
nalgeon/codapi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Codapi is a lightweight sandbox server for interactive documentation and learning.
With Codapi, you can add interactive code snippets right into your product documentation, online course, or blog post. Codapi is also great for trying out new programming languages, databases, or tools in a safe sandbox environment.
┌───────────────────────────────┐│ def greet(name): ││ print(f"Hello, {name}!") ││ ││ greet("World") │└───────────────────────────────┘ Run ► Edit ✓ Done┌───────────────────────────────┐│ Hello, World! │└───────────────────────────────┘
Codapi manages sandboxes (isolated execution environments) and provides an API to execute code in these sandboxes. It also provides a JavaScript widgetcodapi-js for easier integration.
For an introduction to Codapi, see this post:Interactive code examples for fun and profit.
To run Codapi locally, follow these steps:
- Install Docker (or Podman/OrbStack) for your operating system.
- Install thelatest Codapi release (change the
linux_amd64
part according to your OS):
mkdir~/codapi&&cd~/codapicurl -L -o codapi.tar.gz"https://github.com/nalgeon/codapi/releases/download/v0.12.0/codapi_0.12.0_linux_amd64.tar.gz"tar xvzf codapi.tar.gzrm -f codapi.tar.gz
- Build the sample
ash
sandbox image:
docker build --file sandboxes/ash/Dockerfile --tag codapi/ash:latest sandboxes/ash
- Start the server:
./codapi
SeeAdding a sandbox to add a sandbox from theregistry or create a custom one.
SeeAPI to run sandboxed code using the HTTP API.
Seecodapi-js to embed the JavaScript widget into a web page.
Running in production is a bit more involved. See these guides:
Contributions are welcome. For anything other than bugfixes, please first open an issue to discuss what you want to change.
Be sure to add or update tests as appropriate.
Codapi is mostly aone-man project, not backed by a VC fund or anything.
If you find Codapi useful, please star it on GitHub and spread the word among your peers. It really helps to move the project forward.
★Subscribe to stay on top of new features.
About
Interactive code examples
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.