A simple protocol for code collaboration that uses interoperable servers and clients

In Grasp every user identity is a cryptographic keypair and doesn't depend on anyone; every code state is signed; git servers that speak Grasp can be hosted anywhere, seamlessly used by many and don't have to be trusted; repositories can migrate seamlessly; issues and patches can flow freely.

No accounts, no sign up forms

No need to sign up anywhere, anyone can start publishing from the CLI with free unlimited identities (as long as there is a server that accepts you)

Full interoperability

People running personal servers can freely interact with people who rely on third-party servers. It doesn't really matter where the code is hosted.

Send patches easily

Without complicated sign ups and click-ops, sending small contributions to other people's code is often a single command.

Run your own server easily

Whether you want to host only your own code or code from your community, or even charge money to host code from others, everybody is still in the same ecosystem.

Custom moderation

Whether you're running your own server or using someone else's, the server can impose any moderation criteria it wants, and the client-side can augment it.

Issues, branch merge requests and more

Built-in issue filing and management with threaded discussions based on signed messages and pull request flow for more complex code contributions.

Short tutorial

Getting started with

nak is a command-line tool that wraps the basic remote functionalities of git remotes for Grasp, but also provides an interface to issues and patches; install.

  1. 1) Publish a repository

    git init my-project
    cd my-project
    git add .
    git commit -m "initial commit"
    
    nak git init --owner <npub-or-hex> --identifier my-project --name "my-project" --description "Example NIP-34 repo"
    nak git sync
    nak git push
  2. 2) Send a patch

    git checkout -b fix/readme-typo
    nvim README.md
    git add README.md
    git commit -m "fix: correct README wording"
    
    nak git patch send HEAD^
  3. 3) Fetch and apply patches

    nak git patch
    nak git patch 7ef59e
    nak git patch apply 7ef59e
  4. 4) Open and discuss issues

    nak git issue create
    nak git issue
    nak git issue cb44d2
    nak git issue reply cb44d2
  5. 5) Clone from a GRASP reference

    nak git clone <npub-or-nprofile-or-nip05>/my-project

Why centralized platforms fall short

GitHub made collaboration mainstream, but it has become a huge bottleneck, liability and central point of failure, not to mention the censorship. Getting everybody to migrate to GitLab or Codeberg is not the solution.

Self-hosting with Gitea or Forgejo can be a good fit for private teams or closed organizations, but for public open-source isolated forges fragment discovery, duplicate identity and account setup and make cross-project contribution harder and more annoying.

Grasp offers a protocol-centric model: many frontends, many CLIs, many server implementations, all interoperable around a standard for cryptographically signed identities and messages that are sent to and read from the same servers that host the git repositories.

How Grasp works

Once you have a local git repository and a keypair you can sign a message announcing that repository and another message announcing the state of its branches.

Once you publish those messages to your list of chosen servers, those servers will be able to accept your git repository as long as it matches the announced state.

The announcement message can also be published to other servers that can act as aggregators where users can discover your projects.

On every new commit you sign a new repository state message and everything gets updated on your chosen servers. Anyone following you or your repository for updates can be get immediately notified.

Issues and patches are just other kinds of standardized messages that can be sent by anyone directly to your servers, so you can read them whenever you want, apply the patches or respond to the issues. These same servers may choose any criteria to filter out spam or inconvenient contributions they want.

While patches work similar to the old git-send-email approach, pull requests are more like the centralized forge approach: you publish your branch to a Grasp server then send a message to the target asking them to pull the branch and merge.

Full protocol specs: NIP-34 and Grasp.

Software

Servers, web applications, CLIs, native desktop and integrations in other apps.

viewsource.win

Fast web-based repository code viewers with minimal functionality.

n34

Alternative CLI for managing repositories, issues, patches and pull requests.

gitplaza

Desktop native application for browsing repositories and code.

ngit-grasp

Grasp server reference implementation with full support for everything.

pyramid

Community (or personal) server with built-in Grasp support, includes dynamic invite-based whitelisting access.

Shakespeare

AI webapp builder that uses Grasp natively for source-code management.