NEAR zero to hero: Building a Full-stack application



  1. Rust toolchain
  2. A NEAR account
  3. NEAR command-line interface (near-cli)
  4. Working knowledge of JavaScript
  5. Working knowledge of Rust
  6. Experience using git and GitHub

Getting started

Creating a new project

  • Open a terminal and run:
  • Run:

Exploring the code

  1. The “back-end” code lives in the “contract” directory. It contains “Cargo.toml” and “src” directory.
  2. The “frontend” code lives in the “frontend” directory. It contains “App.js”, “index.js” “index.html” and “asset” directory

Breaking it down​

The Back-end

The Front-end

  • set your network configuration defined in config.js
  • connect your frontend web interface to the configured network
  • initialize your contract APIs
  • login NEAR accounts
  • logout NEAR accounts
  • login the user
  • ensures the user “authorized” the smart contract access to her wallet
  • queries your smart contract for the message using the API defined in utils.js
  • call your smart contract set_greeting using the API defined in utils.js
  • logout the user

Running the application

Setting up deployment configuration

  • Authorize near-cli, by running:
  • Provide an accountID to deploy your smart contract in the config.js file like so:
  • Follow the steps here to set up your project github repository.
  • Push your code from your local git directory to github

Deploying your application 🚀

Next steps

​Versioning for this article​

  • cargo 1.62.0 (a748cf5a3 2022–06–08)
  • rustc 1.62.0 (a8314ef7d 2022–06–27)
  • near-cli: 3.4.0



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Near Protocol Nigeria (NPK Guild)

Near Protocol Nigeria (NPK Guild)


NPK Guild is a Near Protocol Community based in Nigeria, aimed at educating and incentivising young Nigerians onBlockchain technology and the NEAR ECOSYSTEM