Table of Contents
This is a Next.js project bootstrapped with create-next-app
and tailwindcss
created for easy-to-start as a React + Rust skeleton template in the Pagoda Gallery. Smart-contract was initialized with create-near-app. Use this template and start to build your own gallery project!
create-next-app
, tailwindcss
, tailwindui
, @headlessui/react
, @heroicons/react
, create-near-app, amazing-github-template
Make sure you have a current version of Node.js installed β we are targeting versions 18>
.
Read about other prerequisites in our docs.
Install all dependencies:
npm install
Build your contract:
npm run build
Deploy your contract to TestNet with a temporary dev account:
npm run deploy
Start your frontend:
npm run start
Open http://localhost:3000 with your browser to see the result.
Test your contract:
npm run test
- The smart-contract code lives in the
/contract
folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app. - The frontend code lives in the
/frontend
folder. You can start editing the page by modifyingfrontend/pages/index.tsx
. The page auto-updates as you edit the file. This is your entrypoint to learn how the frontend connects to the NEAR blockchain. - Test your contract:
npm test
, this will run the tests inintegration-tests
directory. - API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in
frontend/pages/api/hello.ts
. - The
frontend/pages/api
directory is mapped to/api/*
. Files in this directory are treated as API routes instead of React pages. - This project uses
next/font
to automatically optimize and load Inter, a custom Google Font.
Every smart contract in NEAR has its own associated account.
When you run npm run deploy
, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account.
When you're ready to make it permanent, here's how:
near-cli is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local node_modules
folder when you ran npm install
, but for best ergonomics you may want to install it globally:
npm install --global near-cli
Or, if you'd rather use the locally-installed version, you can prefix all near
commands with npx
Ensure that it's installed with near --version
(or npx near --version
)
Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as your-name.testnet
, you can deploy your contract to near-blank-project.your-name.testnet
. Assuming you've already created an account on NEAR Wallet, here's how to create near-blank-project.your-name.testnet
:
-
Authorize NEAR CLI, following the commands it gives you:
near login
-
Create a subaccount (replace
YOUR-NAME
below with your actual account name):near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet
Use the CLI to deploy the contract to TestNet with your account ID.
Replace PATH_TO_WASM_FILE
with the wasm
that was generated in contract
build directory.
near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE
Modify the line in contract/neardev/dev-account.env
that sets the account name of the contract. Set it to the account id you used above.
CONTRACT_NAME=near-blank-project.YOUR-NAME.testnet
On Windows, if you're seeing an error containing EPERM
it may be related to spaces in your path. Please see this issue for more details.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
See the open issues for a list of proposed features (and known issues).
- Top Feature Requests (Add your votes using the π reaction)
- Top Bugs (Add your votes using the π reaction)
- Newest Bugs
Reach out to the maintainer:
If you want to say thank you or/and support active development of Rust Boilerplate Template:
- Add a GitHub Star to the project.
- Tweet about the Rust Boilerplate Template.
- Write interesting articles about the project on Dev.to, Medium or your personal blog.
Together, we can make Rust Boilerplate Template better!
First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.
Please read our contribution guidelines, and thank you for being involved!
The original setup of this repository is by Dmitriy Sheleg.
For a full list of all authors and contributors, see the contributors page.
Rust Boilerplate Template follows good practices of security, but 100% security cannot be assured. Rust Boilerplate Template is provided "as is" without any warranty. Use at your own risk.
For more information and to report security issues, please refer to our security documentation.