Table of Contents
pnpm install
First, make sure a web4 proxy server is running (see setup):
pnpm run web4:start:testnet
Then start the dev server. This will run the app and the express proxy server.
pnpm run dev
pnpm run build
pnpm run test
See the full testing guide.
This project is a structured as a monorepo with Turborepo.
.
├── apps
│ ├── api
│ └── www
├── packages
│ ├── config-eslint
│ ├── config-typescript
It consists of several components:
-
Vite project using near-vite-starter template, bundle stored on NEARFS, served through Web4
-
Web4 NEAR login to authorize a local-first session with Jazz for data storage and sync
-
Types stored on-chain in the social-db
-
Express proxy server for Open AI requests to gpt-4o-mini for NLP and structured outputs
-
Automatic form generation based on JSON Schemas, using react-jsonschema-form
To learn more about NEAR, take a look at the following resources:
- NEAR Developer Portal - homebase for near developers.
- NEAR Documentation - learn about NEAR.
- Frontend Docs - learn about this example.
You can check out the NEAR repository - your feedback and contributions are welcome!
-
Install mkcert.
-
Install local certificate authority (this allows browser to trust self-signed certificates):
mkcert -install
-
Create
*.near.page
SSL certificate and store these at the project root:mkcert "*.near.page"
-
Run
web4
man-in-the-middle proxy locally:IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=mainnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near
-
May have to configure hosts on MacOS:
sudo sh -c 'echo "127.0.0.1 every.near.page" >> /etc/hosts'
- Run the web4 proxy server for designated network
pnpm run web4:start:testnet
To deploy the main app, go to /apps/www
, then follow the below:
- Build the project
pnpm run build
- Create a web4 subaccount of your master account (this will be your domain).
near account create-account fund-myself web4.MASTER_ACCOUNT.testnet '1 NEAR' autogenerate-new-keypair save-to-keychain sign-as MASTER_ACCOUNT.testnet network-config testnet sign-with-keychain send`
Be sure to "Store the access key in legacy keychain"!
- Run web4-deploy to upload production bundle to nearfs and deploy it to a minimum-web4 contract to your account.
npx github:vgrichina/web4-deploy dist web4.MASTER_ACCOUNT.testnet --deploy-contract --nearfs
Deploy shoudl be accessible and your website accessible at
testnet
: MASTER_ACCOUNT.testnet.page
mainnet
: MASTER_ACCOUNT.near.page
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you're interested in contributing to this project, please read the contribution guide.