This is the companion repository for the Neon's Branching Tutorial, which you should definitely read before diving in here.
This app is a Discord bot written using Harmony designed to run on Deno, because the out-of-the-box TypeScript experience is great. A docker image based on Deno's is provided in case you don't want to install anything.
It also features a back-end micro web service that serves a form and handles submission, where users enter their shipping information to receive their prizes, which is written using ExpressJS.
Finally, Prisma is used to manage migrations, while we take advantage of a lightweight drop-in replacement for Node's postgres module, PostgresJS.
You'll need to sign up for Neon, of course. You'll need a Discord application key which you can obtain here after you watch this extremely helpful 2-minute video on how to get the correct secret quickly.
You can also, optionally, just watch a quick demo of the bot functioning if you're simply curious.
If you have Deno installed, navigate to the repository root and just run:
> npx prisma migrate dev
This will (if your database string is configured correctly) initialize the database schema.
Next, start the development server:
> deno task dev
This will grab whatever dependencies are needed, and start the services with a watcher so it restarts if you change the code. If you don't have Deno available you can run the less-interactive Docker image like so:
> sudo docker compose up --build
While the demo is fairly feature-complete, insert your favorite disclaimer about polishing some things up a bit before unleashing it on the world for real - all code is for demonstration purposes only.
When running migrations, use npx prisma migrate dev
if you get an error from Deno that it can't find a URL
to import. There seems to be a temporary glitch at the time this was published, so noting it just in case.