How to Create a NEAR App: A Step-by-Step Guide

Aug 27, 2024 | Blockchain

With the rise of blockchain technology, developing decentralized applications has never been more accessible. In this article, we’ll walk you through the process of creating your own NEAR app, a user-friendly platform for building decentralized applications (dApps) on the NEAR blockchain.

Prerequisites

Before you dive into the fun part of programming, ensure that you have the following:

  • A current version of Node.js installed. We recommend version 16+ for JavaScript contracts and 18+ for frontend gateways.
  • Familiarity with coding in JavaScript or Rust, as you’ll need this for contract development.
  • Refer to the additional prerequisites for building smart contracts.

Getting Started

Now, let’s get our hands dirty! To create a new NEAR project, simply run:

npx create-near-app@latest

Follow the interactive prompts to set everything up smoothly. Once you’ve completed this step, take a look at the README.md in your newly created project for more instructions!

Understanding Contracts

In this framework, you have the option to develop your contracts using:

  • JavaScript
  • Rust

If you’re new to NEAR contracts, it’s highly advisable to follow our smart contract quickstart, which will guide you through the entire process.

Testing Your Contracts

For testing, we leverage a sandboxed environment. Here’s an analogy: think of it as a safe playpen where your code can run and experiment without affecting the outside world. You are free to write your tests in either JavaScript or Rust!

Web Application Development

You have the flexibility to create a web application using:

If you are new to developing web applications with NEAR, following the web app quickstart can be immensely helpful. For package management, consider using pnpm, as it tends to be faster than npm or yarn.

Using CLI Arguments

The CLI supports arguments that can bypass the interactive prompts. Here’s how you can do that:

npx create-near-app project-name --frontend next-app --contract jsrs --install

All arguments are mandatory, except the –install option, which will automatically install dependencies from all package.json files.

Troubleshooting

If you encounter any issues or need further assistance, we’ve got you covered!

  • Visit our documentation for detailed guides and FAQs.
  • Join our community on Discord to get real-time help and connect with fellow developers.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Contributing to NEAR

If you’re interested in making changes to create-near-app itself:

  • Clone the repository (for Windows users, use git clone -c core.symlinks=true).
  • Navigate to one of the folders inside templates, like templates/frontend/next-app.
  • Run pnpm install to set up dependencies and pnpm run dev to start the local development server.

About Commit Messages

Creating well-structured commit messages helps in maintaining project organization. We adhere to semantic versioning and auto-generate release notes based on commit messages. To learn more about effective commit messages, visit Conventional Commits.

Deployment

If you’re ready to deploy a new version of your app, you will need:

Once you have completed these steps, you can run:

npm run release

or simply execute release-it.

Conclusion

And there you have it! A comprehensive guide to creating your very own NEAR app. Whether it’s contracts or web applications, the world of blockchain development awaits you with open arms.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox