Creating and maintaining node-postgres solo

Hello, who are you and what are you working on?

I wrote & have maintained node-postgres & various postgres related libraries in node.js. I've been the primary maintainer for around 9 years now. I work at Cruise automation & also work on some of their open-sourced visualization libraries, being one of the original authors of webviz, webviz worldview, and rosbag for doing robotics visualizations in JavaScript.

Why did you start working on node-postgres?

I got into open-source primarily as a way to work my way out of working in .NET. I had been doing a lot of heavy JavaScript apps in the browser, and I saw node.js very, very early - when it first came out. I liked using Postgres, but there wasn't a way to connect to Postgres from Node at the time. I thought it would be a cool thing to figure out - so I worked on it hard for a couple months, and it turned out to serve the community well!

What were the early days like?

Node was a tiny community at the time. I think there were like 100 people or so in the IRC room. There was no standardized package manager, no agreed-upon unit test framework, ESLint wasn't really a thing, Prettier didn't exist. A lot of the tools I now take for granted that make writing JavaScript so productive and fast weren't there yet, but it was still super fun to build things in JS. For me, having a lot of full-stack experience and getting to use JavaScript on the backend instead of C# was exhilarating. The Node community grew very quickly, and it's been a real joy to be a part of.

I've never really been thought-leadery and I've never been much of a participant in social media. I'm happy to sit more on the sidelines and just try to give a consistent, positive experience with node-postgres rather than spread myself thin.

How have you grown its usage?

I think a few things contributed to its growth, but primarily it was "right place, right time". Super early on it was just kinda the de-facto way to connect to Postgres. As more and more libraries built on top of it (sequelize, typeorm, etc) it just got more and more widely used and most of its growth was due to the growth of Node as a whole.

I think another thing that contributed to its success was that I didn't have a lot of different projects I was working on. I didn't really want to be prolific, just do one thing (I did a few more things, but not with much focus) and do it well.

I've also been pretty fanatical about backwards compatibility and avoiding breaking changes as much as possible. Since I use Node, node-postgres, and tons of other libraries in my day job I'm really aware of the pain that comes with breaking changes. I really respect the users' time and do anything I can to avoid introducing backwards incompatibility because upgrading is so painful.

One other thing is documentation, documentation, documentation!

How do you manage the workload and the community?

I need to improve on this - it fluctuates over the years as my emotional energy and time are diverted to other things. Since I started on it, I got married, moved to a few different states, bought a house, have had various jobs, and so on. Now thankfully my employer (Cruise Automation - we're hiring and it's awesome here!) is really supportive of me spending time on it, and we use it across several teams and large projects at the company.

How much time do you devote to node-postgres?

I'm part-time and almost always have been. I'm super grateful that I now have some Patreon supporters, which encourages me to keep the fire burning.

I tried for a bit to work on it more full-time, but finding sufficient funding was pretty difficult, so I think its best if I keep it part-time. It's a pretty stable API and library at this point.

What were the biggest obstacles you've had to overcome?

I think managing time and burn out was probably the biggest factor. Overall the community is super great but every so often you get a bad egg. One time I was out on a date with my wife and got a GitHub email about an issue being opened from http://github.com/fuckyoubrianc. That was pretty upsetting. Ultimately the issue was resolved, but I turned off email notifications for a year or so and definitely let off the gas. Also, sometimes my inbox looks like this https://cloudup.com/cg2K9ikg_Av which can be a bit overwhelming. I try to be kind and patient with everyone who comes by - it's been a really good learning experience that's helped in professional life as I spend time doing PR reviews at work and a lot of the communication skills I've developed on node-postgres have translated there and vice versa.

One other thing is in an almost fanatical effort to maintain backwards compatibility I have developed some crufty, non-idiomatic APIs in node-postgres. They're not the most wonderful thing to maintain, but thankfully there's a huge battery of test suites to cover them, and I'd rather pay the maintenance cost myself than force thousands and thousands of people to upgrade because my ideas on good API design have changed. I think in the majority of use cases node-postgres is now consumed by other, higher-level libraries so the raw APIs it presents are okay; not amazing, but okay enough to not justify a major version bump.

What's it like being the sole maintainer?

I actually get a lot of help from a few contributors which I'm super grateful for. There are a few standouts with https://github.com/charmander, in particular, being a long-time helper & occasional emotional sounding board when I'm having a hard time with a difficult user interaction. I have been the only one with direct npm access though for the past 9 years, and I manage the releasing and documentation and all of that. I was paying for hosting costs for a while for the docs, but thankfully found a great free place to host them (https://netlify.com) that does automatic deployment and all that on merge which is fab.

I'd love to have a couple more active maintainers, but the project is in a pretty stable place and the folks that do contribute do a lot of issue management and question answering which is probably the bulk of the workload recently. I try to stay available and fix any critical (particularly around security) issues as fast as I can. I'm always available via email if anyone wants to take a more active co-maintainer role with me!

What are your hopes for the future of node-postgres and your other open source work?

As I've gotten a few Patreons I've been focusing more on documentation. I'd like to do a lot more around this going forward too. I just finished up a demo app of a react app connecting to a node-postgres Express powered API on the backend to kinda serve as an example for folks to look at. I plan on integrating it into the documentation soon. I'd like to expand that app to support other interesting features of Postgres + node like LISTEN/NOTIFY and websockets to do some fun pub-sub stuff.

I also mentioned the test framework - I'd like to upgrade that piece by piece.

Also, its a small thing I suppose but since the code was mostly written in a more "wild west" period of time w/o code formatting and linting I'd like to do a big sweep on the codebase and get it all formatted and linted really nicely.

I'm also interested in combining some of the related modules like pg-pool and pg-types into a monorepo managed by Lerna so more cross-cutting issues can be triaged, managed, tracked, and fixed in one place more easily.

What advice do you have for other open source projects and maintainers?

I think for maintainers my advice would be to always be kind, assume the best in others, avoid backwards compatibility breaks, and spend more time writing tests and documentation than actual API code. Try not to be clever, and keep things simple!

For people looking to get into open source the best thing I think is to find something you're really interested in - try to join an existing project if you like what it's doing & the maintainers are friendly. Since it's a hobby thing the best thing you can do is have fun and do something slightly harder than you think you can - you'll often surprise yourself and you'll learn a ton along the way!


To find out more about Brian, you can follow him on Twitter, GitHub or Patreon. node-postgres is on GitHub here: https://github.com/brianc/node-postgres.

Editor's note: At the time of writing, there are just under 37,000 repositories using node-postgres as a dependency [1] (as well as this website). That's an enormous impact for a project created and maintained primarily by a single developer in Brian. By contrast, there are only 15 patrons supporting Brian's open source work on Patreon. That's 0.04%. If you've found value from his work, or just want to support OSS in general, please consider sponsoring him on on Patreon.

[1] - https://libraries.io/npm/pg

node-postgres