Gateways
The Components
you create are stored in the NEAR blockchain. To read and execute their code you will need a Gateway
.
A Gateway
is nothing but a Next.js application with the added ability of retrieving components from the blockchain and rendering their code.
This allow you to create the frontend of your application combining classic Next
components with Web3
components that interact with your desired blockchain.
Building a Gateway
Building your own Gateway
is as simple as cloning the example repository, and running it:
# Clone gateway
git clone git@github.com:near-examples/bos-gateway.git
# Install dependencies
cd bos-gateway
npm install
# Run the gateway
npm run dev
Make sure to change the src/data/bos-components.ts
file
Deploying Gateway in Vercel
Launching your own NEAR BOS gateway instance is a quick and simple process. In this example we'll be using Vercel to build and deploy a new BOS gateway, but you can also use other platforms.
Just follow these easy steps:
- Clone the
near/bos-gateway
repository - Sign up on Vercel and import the cloned repository
- Setup the project:
- Any team name
- Build command:
npm run build
- Output directory:
dist
- Press Deploy
Click on this link to try it out.
Now just wait a few minutes for Vercel to build the website and enjoy your BOS gateway!
If you want to host the gateway on a specific domain you can configure it on Vercel.
If you want to change the home page component, modify
src/data/widgets.js
in your fork to point at different components.