Skip to content

Infrastructure for a user owned internet: apps and packages for creating and defining things

License

Notifications You must be signed in to change notification settings

elliotBraem/everything

everything

apps and packages for creating and defining things

Table of Contents

Getting Started

Installing dependencies

pnpm install

Running the app

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

Building for production

pnpm run build

Running tests

pnpm run test

See the full testing guide.

Project Structure

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

Learn more about NEAR

To learn more about NEAR, take a look at the following resources:

You can check out the NEAR repository - your feedback and contributions are welcome!

Running web4 locally

  1. Install mkcert.

  2. Install local certificate authority (this allows browser to trust self-signed certificates):

    mkcert -install
  3. Create *.near.page SSL certificate and store these at the project root:

    mkcert "*.near.page"
  4. 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
  5. May have to configure hosts on MacOS:

sudo sh -c 'echo "127.0.0.1 every.near.page" >> /etc/hosts'
  1. Run the web4 proxy server for designated network
pnpm run web4:start:testnet

Deploy to web4

To deploy the main app, go to /apps/www, then follow the below:

  1. Build the project
pnpm run build
  1. 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"!

  1. 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

Contributing

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.

About

Infrastructure for a user owned internet: apps and packages for creating and defining things

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks