How Codapi differs from other code playgrounds

Codapi makes all kinds of technical writing interactive by allowing the reader to edit and run the code examples. By technical writing I mean product documentation, text courses, blog posts, etc.

Codapi is specifically designed to meet the needs of documentation authors. How do I know what those needs are? Well, I blog a lot, I teach, and I've written tons of technical docs in my 15 years of software development. So I'm building exactly the product I've always wanted as a technical writer and teacher.

Now let's talk about what this means in practice, and how Codapi differs from other code playground services.

Same documentation, but interactive

As a tech author, I already have static code examples in my articles, like this one:

def greet(name):
    print(f"Hello, {name}!")

greet("World")

What I want to do is turn them into executable and editable snippets of code:

def greet(name):
    print(f"Hello, {name}!")

greet("World")

And that's exactly what Codapi does. Same code samples, only interactive.

Compare it to what other code playgrounds offer:

Other code playground

Other code playground

Other playgrounds look over-complicated and alien to the content.

I certainly don't want that in my documentation.

I don't expect my readers to write 1000 line programs in the docs. I just want them to try the examples and maybe tinker with them a bit, changing the code here and there and checking how it affects the results.

That's what Codapi offers.

Hassle-free integration

As a tech author, I want to focus on writing, not integrating.

I don't want to write code examples elsewhere, and then go through some non-trivial process of embedding them back into the docs. I'd rather write them the way I'm used to, without leaving my favorite editor.

```python
def greet(name):
    print(f"Hello, {name}!")

greet("World")
```

Like this.

I also don't want my readers to have to wait 10 seconds while the playground initializes, or makes a couple of dozen requests just to load the basic UI.

What I'm comfortable with is including a single external script and seeing the code examples load immediately.

<!-- like this -->
<script src="https://unpkg.com/@antonz/codapi/dist/snippet.js">
</script>

And that's exactly what Codapi offers.

Non-trivial sandboxes

Being able to run vanilla Python or Go is fun, but as a tech author I need more.

When writing about data processing, I need access to numpy and pandas. When teaching SQL, I need the full power of PostgreSQL and MySQL, not just SQLite. When writing product documentation, I need third-party software and SDKs installed.

I also want to rely on the ubiquitous tool of modern software delivery — Docker containers, and their domain-specific language, dockerfiles.

FROM mysql:8.1

COPY *.sh /etc/mysql/
COPY my.cnf /etc/mysql/conf.d/
COPY init.sql /docker-entrypoint-initdb.d/

ENV MYSQL_ALLOW_EMPTY_PASSWORD=1
ENV MYSQL_INITDB_SKIP_TZINFO=1

Codapi MySQL sandbox.

I want to be able to setup a custom sandbox from scratch in minutes, not hours or days.

And that's exactly what Codapi offers.

Summary

In short, Codapi is not a general-purpose code playground service. It's an open-source tool for making documentation interactive.

It's a narrow focus. But it's what allows Codapi to provide the best experience for tech authors and their readers. Give it a try!

Anton Zhiyanov, Codapi founder