Skip to content

🗺️ Advanced DND note-taking webapp for both sides of the equation

License

Notifications You must be signed in to change notification settings

Floffah/dndnotes

Repository files navigation

DNDNotes

Development

You need to have corepack enabled in your current node installation. Make sure you have node 21 installed and run the following in your terminal:

npm uninstall yarn -g
corepack enable
corepack install
yarn exec env # <-- This should output a path to the yarn binary rather than a list of environment variables - if it doesn't consult the yarn docs https://yarnpkg.com/corepack
yarn

Discord activity

To get tunnels set up for your discord activity, you need to do the following:

brew install cloudflared # install cloudflare tunnel service
cloudflared login # login to your cloudflare account - make sure to give it access to one of your domains here

cloudflared tunnel create discord-activity # create a tunnel named dndnotes
cloudflared tunnel route dns discord-activity dndatunnel.floffah.dev # replace domain with your own

cloudflare tunnel create dndnotes-web # create a tunnel named dndnotes-web
cloudflare tunnel route dns dndnotes-web dndnotestunnel.floffah.dev # replace domain with your own

yarn dev # start the dndnotes web dev server (where the api is hosted) and the discord-activity frontend dev server
yarn tunnel # start the cloudflare tunnels

Then link these domains to discord. In your developer dashboard, go to the "URL Mappings" tab and add the following mappings: (replace the domains with your own)

  • / - dndatunnel.floffah.dev
  • /dndnotes - dndnotestunnel.floffah.dev
  • /icons - api.iconify.design
  • /pubnub - ps.pndsn.com

Environment variables

Web

  • DISCORD_CLIENT_SECRET = discord oauth client secret
  • MONGODB_URI = mongodb connection string
  • NEXT_PUBLIC_BASE_URL = base url for the web server, should be http://localhost:3000 in dev - in prod i have it set to https://dndnotes.floffah.dev
  • NEXT_PUBLIC_DISCORD_CLIENT_ID = discord oauth client id
  • NEXT_PUBLIC_DISCORD_REDIRECT_URI = discord oauth redirect uri, set to http://localhost:3000/api/discord/redirect in dev

Server

  • MONGODB_URI_TESTS = mongodb connection string for tests

Discord activity

  • DISCORD_CLIENT_SECRET = discord oauth client secret
  • NEXT_PUBLIC_DISCORD_CLIENT_ID = discord oauth client id
  • NEXT_PUBLIC_BASE_URL = should be set to https://<discord client id>.discordsays.com in all environments. discord proxies the prod deployment AND the development cloudflare tunnel
  • NEXT_PUBLIC_FORCE_PROXIED_ICONS = should always be true in all environments - forced iconify to use the iconify api through a discordsays.com proxied url mapping