backend

module
v0.0.0-...-1dbcda5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2023 License: MIT

README

Renotion API backend

The backend which server the Renotion web3 app.

It checks on-chain state (from Polygon), and then fetches relevant metadata, and asserts Cloudflare Custom Domains registration.

Successful registrations are then forwarded to the Renotion CF Worker which proxies Notion pages based on blockchain state.

Development

It relies on the deployed Renotion Smart Contract.

Setup
  1. First cp .env.example .env – and then setup your environment
  2. go run cmd/main.go to run the fiber webapp

Deployment

Secrets

First, you need to setup the secrets for the fly.io app:

flyctl secrets set \
  CF_API_TOKEN=$CF_API_TOKEN \
  MORALIS_API_KEY=$MORALIS_API_KEY \
  ZONE_NAME=$ZONE_NAME \
  CHAIN=$CHAIN \
  RPC_URL=$RPC_URL \
  RENOTION_CONTRACT=$RENOTION_CONTRACT \
  TOKEN_ADDRESS=$TOKEN_ADDRESS
Test
flyctl deploy -a renotion-test
Production
flyctl deploy

API

  • GET /api/tokens/:owner
    Fetches page registrations owned by an account
  • GET /api/domains/:owner
    Fetches page registrations from chain, and then asserts Cloudflare domain associations.
  • GET /api/metadata/:tokenID
    Reads metadata from chain, currently only hostname and an associated page
  • GET /api/domain/:tokenID
    Fetches page registrations from chain, and then asserts Cloudflare domain association for the given registration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL