Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Nov 1, 2024
1 parent 1e12c9b commit 84520c7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
- [Building for production](#building-for-production)
- [Running tests](#running-tests)
- [Learn more about NEAR](#learn-more-about-near)
- [Ethereum wallet login](#ethereum-wallet-login)
- [Preparing for production](#preparing-for-production)
- [Contributing](#contributing)

</details>
Expand All @@ -38,7 +36,13 @@ pnpm install

### Running the app

First, run the development server:
First, make sure a web4 proxy server is running (see [setup](#running-web4-locally)):

```bash
pnpm run web4:start:testnet
```

Then start the dev server. This will run the app and the express proxy server.

```bash
pnpm run dev
Expand All @@ -56,12 +60,6 @@ pnpm run build
pnpm run test
```

### Load shadcn component

```bash
pnpm dlx shadcn@latest add <component-name>
```

See the full [testing guide](./playwright-tests/README.md).

## Project Structure
Expand Down Expand Up @@ -100,34 +98,39 @@ To learn more about NEAR, take a look at the following resources:

You can check out [the NEAR repository](https://github.com/near) - your feedback and contributions are welcome!

## Running locally
## Running web4 locally

1. Install [mkcert](https://mkcert.dev/).
2. Install local certificate authority (this allows browser to trust self-signed certificates):

```bash
mkcert -install
```

3. Create `*.near.page` SSL certificate:

```bash
mkcert "*.near.page"
```

4. Run `web4` man-in-the-middle proxy locally:

```bash
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. Setup browser to use [automatic proxy configuration file](https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file) at `http://localhost:8080/` or to use `localhost:8080` as an HTTPS proxy server.

I had to do:

`sudo sh -c 'echo "127.0.0.1 every.near.page" >> /etc/hosts'`

and
5. Setup browser to use [automatic proxy configuration file](https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file) at `http://localhost:8080/` or to use `localhost:8080` as an HTTPS proxy server.

`pnpm run dev --host every.near.page`
6. May have to configure hosts on MacOS:

```bash
sudo sh -c 'echo "127.0.0.1 every.near.page" >> /etc/hosts'
```

## Deploy to web4

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

1. Build the project

```cmd
Expand Down
2 changes: 0 additions & 2 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"preview": "vite preview",
"nearfs:publish-library:create:car": "ipfs-car pack dist/ --output dist.car",
"nearfs:publish-library:upload:car": "node ./node_modules/nearfs/scripts/upload-car.js dist.car",
"web4:start:mainnet": "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",
"web4:start:testnet": "IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=testnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near",
"fmt": "prettier --write '**/*.{js,jsx,ts,tsx,json}'",
"fmt:check": "prettier --check '**/*.{js,jsx,ts,tsx,json}'",
"test": "npx playwright test",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"build": "turbo run build",
"clean": "turbo run clean",
"dev": "turbo run dev",
"web4:start:mainnet": "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",
"web4:start:testnet": "IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=testnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"lint": "turbo run lint",
"test": "turbo run test",
Expand Down

0 comments on commit 84520c7

Please sign in to comment.