Reflex Labs Reflex Labs
← Blog
Reflex Labs Engineering

Open-sourcing vwr.js, our first contribution back

We released a small document viewer called vwr.js. Here's what it does, how we think about AI-written code, and why we decided to give it away.

open sourceengineeringai

Almost everything we build at Reflex Labs runs on software other people wrote and gave away for free.

The booking site, the client portal, and the API behind both are built on open-source libraries we didn’t write and didn’t pay for. Language runtimes, web frameworks, the library that draws a PDF in a browser tab. Someone wrote that code, decided to share it, and keeps maintaining it on their own time, and we get to use it.

We’ve relied on that for a while without putting much back. This is a small step toward fixing that. It’s a library called vwr.js, and it’s the first thing we’ve open-sourced.

What it is

vwr.js is a small JavaScript library that renders a document from a URL in the browser. Point it at a PDF, an image, a Word file, a Markdown file, a CSV, or plain text, and it draws it, with zoom, pagination, download, and fullscreen, plus pinch and drag on a phone. There’s no server-side conversion and no CSS to set up. You call one function:

import { render } from 'vwr.js';

const viewer = render(container, 'https://example.com/contract.pdf');

We built it because we needed it. A lot of what we do is put documents in front of clients, whether that’s agreements to sign, files to review, or summaries to read, and we wanted one viewer that behaved the same regardless of the file type. Rather than wire up a different viewer for each format, we wrapped them all behind one interface. Under the hood it uses PDF.js, mammoth.js, marked, DOMPurify, and PapaParse, which is a fair sample of how much open source you can build on before writing any code of your own.

It’s MIT-licensed, so you can take it, fork it, and ship it.

On code written with AI

We’ll say it the same way the README does: vwr.js was written with a lot of AI assistance. That’s worth being upfront about. It’s also worth thinking about carefully, because the fact that an AI wrote something tells you nothing about whether it’s any good. That part is still our responsibility.

AI is good at producing code that looks correct. It’s less reliable at producing code that is correct, and it has no stake in what happens when those two diverge. Closing that gap is the actual work, and the speed of generating a first draft doesn’t remove it. If anything, the easier code is to produce, the more careful you have to be about reading it, testing it, and understanding why it works.

So we review AI-written code the way we’d review a teammate’s pull request. Someone reads every line, and someone is accountable for it. When something isn’t ready, we say so. vwr.js is in early alpha, and the repository says exactly that, because we’d rather be clear about where it stands than oversell it.

The model can write a first draft. A person still has to test the result, fix it, and decide whether it’s good enough to give to someone else. That responsibility doesn’t move to the AI.

Why we gave it away

vwr.js isn’t a competitive advantage, and treating it like one wouldn’t make sense. It’s a small, useful tool that exists because a lot of other small, useful tools were shared first.

When you get a lot of use out of open source, the most direct way to return the favor is to add something to it. That can be a bug report, a patch, or a library someone else can pick up and use. vwr.js is our first attempt at that, and it won’t be the last. We’ll open-source more of what we build when it makes sense, and send fixes upstream to the projects we depend on.

If it saves you an afternoon, it’s done its job. If you improve it and send the change back, even better.

The repository is here: github.com/reflexlabsio/vwrjs. Issues and pull requests are welcome.