November 21, 2022 by Adnan Maolood

NLnet funding comes to an end

Sourcehut was selected for an NLnet grant in January of this year. NLnet Foundation is a Dutch organization which funds many projects to promote an open and secure internet.

The typical NLnet grant is structured by milestones. At the beginning of the grant, a project plan is drafted containing the milestones to be completed and an agreed upon payment for each milestone. Once a milestone is completed, NLnet verifies that the milestone had been completed and approves the payment. If you think this might be a good fit for your project, consider applying for a grant!

Our grant work focused on completing the GraphQL APIs for Sourcehut services to help with Sourcehut’s API 2.0 efforts. This work included many changes and improvements to the GraphQL APIs as well as implementing support for GraphQL-native webhooks.

Implementing GraphQL-native webhooks for git.sr.ht was the first milestone on our roadmap. This work involved:

  1. Designing and implementing the API for creating GraphQL webhooks
  2. Updating the GraphQL mutations to trigger webhooks
  3. Updating the Python frontends to route all necessary operations through the GraphQL APIs so that webhooks are triggered
  4. Updates to ancillary services/daemons (gitsrht-shell and gitsrht-update-hook)

A similar process was followed for hg.sr.ht, todo.sr.ht, builds.sr.ht, lists.sr.ht, paste.sr.ht, and pages.sr.ht.

Our focus then turned towards implementing a GraphQL API for hub.sr.ht. Near the end of June I began experimenting with GraphQL Federation in the hopes that it would make implementing the hub.sr.ht GraphQL API easier. This work led to the development of api.sr.ht, a GraphQL API gateway.

Before we can adopt GraphQL Federation, we needed to unify user IDs. Previously, user IDs were not guaranteed to be the same across SourceHut services. This did not play well with GraphQL Federation, which requires some sort of unique key to identify users across services. Patches for nearly every Sourcehut service were needed to address the issue.

In order to ensure that the ID unification roll-out went as smoothly as possible, we decided that we needed better tools for testing. This resulted in the development of srht-fakedb, a tool to populate Sourcehut service databases with fake data for testing purposes. The ID unification roll-out took place on October 26. With that now out of the way, work on the hub.sr.ht GraphQL API can resume.

October 30 officially marks the end of the NLnet grant. We achieved most of what we set out to accomplish, and some more. We’ll be wrapping up this work on SourceHut’s dime in the coming weeks.

Working with NLnet has been a great experience. Many thanks to NLnet and NGI Zero for sponsoring this work! We appreciate your generosity, and are looking forward to more projects developing under your fundraising umbrella.