Zero-commitment onboarding to NEAR using Gitpod
NEAR has discovered a fantastic tool called Gitpod that gives new developers a kick-start, improves the efficacy of community code reviews, and saves resources on a developer’s machine.
With two clicks, a new developer comes to this:
It looks like an integrated development environment (IDE), but… on a web page? Yes, it is. A Docker-based image has been spun up, language/platform versions locked in, and dependencies have been installed automatically. There’s even a Terminal, giving the developer a perfectly-working project ready to poke and prod at. Before we get into more technical details, let’s take a step back.
NEAR has a history of carefully choosing focus points for a scalable blockchain. Sharded, proof-of-stake blockchains are still in nascent stages and offer intriguing challenges. The most effective way for the community of contributors (the NEAR Collective) to thrive is twofold: first, to pick the right technological battles, and second, to use great tools when they’re identified. This is a reason why WebAssembly has been the backbone of NEAR’s virtual machine (VM). There are enough puzzles to solve without writing and maintaining a new VM. The same thing goes for writing smart contracts on NEAR. While there are customized bindings, NEAR utilizes reliable languages like Rust and AssemblyScript instead of writing another programming language. NEAR resists the urge to remake peripheral touchpoints of a blockchain system and instead focuses on making the best blockchain with the best tools.
Gitpod is one of those tools discovered recently. The Gitpod website lays it out clearly: Gitpod is a tool allowing developers to launch ready-to-code development environments for your Github projects with a single click. The code at NEAR Protocol lives on Github, where the NEAR Collective in building out the codebase. With a couple of settings, Gitpod integrates beautifully with Github in two ways:
- Repository landing page — a Gitpod button opens the repository in the selected branch (typically
master) This saves the end-user time and energy that would go into setting up a development environment.
- Pull Requests — a Gitpod button appears on pull requests, showing a live version with the given changes. (This is excellent for quality assurance and code review.)
Gitpod in action
Expanding on the first bullet point above, NEAR has launched the new examples page showing various, simple, smart contracts that illustrate different facets of decentralized app (dApp) development. For instance, an example may show basic reading/writing to the blockchain with a Rust contract, or perform a cross-contract call, or create a custom token, or transfer tokens with an escrow system, etc. Using Gitpod, a developer has a frictionless experience getting an example application started. Gitpod uses a tried-and-true online IDE called Theia, which is fully compatible with VS Code extensions.
Gitpod also saves builds of the projects you’ve added to your “Gitpod workspaces” to further speed things up. We’ll not go into all the useful features of Gitpod, but encourage you to check them out.
NEAR has hosted a number of online and in-person hackathons and workshops. (At the time of this writing, we’re very excited about the upcoming Ready Layer One online event taking place May 4-6, 2020.) During in-person workshops, there’s historically been a battle between a shared internet connection and the participants downloading dependencies, tools, virtual machines, Docker images, etc. Gitpod is terrific for this use case as well, offloading the downloads and processing power elsewhere. Again, after a couple of clicks, the end-user finds a turnkey development environment ready to build on NEAR. Gitpod allows for a zero-commitment onboarding for everyone regardless of the operating system, internet speed, administrative permissions, and one’s development environment setup.
Wait, why not just clone a project?
NEAR understands that developers have options and limited time. Every second NEAR can save a developer is precious. That said, here’s a natural progression one might follow to build on NEAR, starting at zero-commitment, to local development, to a full dApp:
- Copy/paste commands from the NEAR homepage to build a React app that integrates with the blockchain.
- Eager to learn more, visit the examples page, and select an interesting one.
- Click the “Open in Gitpod” button.
- Follow the instructions in the README.
- Sandbox time: change the source, build it again! (See README file for instructions)
- Decide this (or another) example is the starting point for a personal or business dApp.
Follow the example page’s link to the Github repository and clone it.
- Create a NEAR account using NEAR Wallet (In Gitpod, the NEAR accounts were automatically generated for convenience sake. They have rather dull names, so we typically create a more personalized account for further development.)
- Continue local development; possibly even run against a local NEAR blockchain.
Create something you’re proud of, commit it to your own Github (or elsewhere) repository.
- Give it a frontend (we have many examples of this) and deploy it! (Again, see README file for instructions)
- Keep hacking, and hang out with us on Telegram.
Conclusion / future thoughts
Gitpod is an amazing tool that significantly cuts downtime for two important personas:
- Members of the NEAR Collective making contributions to and reviewing code on Github
- New developers who can’t/won’t alter their computer’s development environment
There’s untold potential in the Gitpod approach laid out here. Teachers can be introducing blockchain development in classrooms without having to install Rust on every computer. A curious mind can hack away on their first dApp using a public library’s computer with restricted permissions. End users struggling with an error can include a link to a Gitpod snapshot where an error can be reliably reproduced. It will be fascinating to see how else the development/learning lifecycle can benefit from a tool like this, and NEAR is excited to lean into it.
Lastly, dig into a Gitpod example for yourself at https://near.dev.
Join the community: