Welcome to Spill the Tea! A solution for rating the teas found in Hubben 2.2.
For setting up your own instance, see SETUP.md.
For developing, continue reading below.
This project uses these tools:
If using Nix, simply run nix develop to install these.
The website also requires a Gamma Client with an API key to integrate with Gamma and enable login. Follow the guide on Creating a User Client in the Gamma documentation.
When creating the client, make sure that Generate api key is checked and
Redirect url is set to the local callback route at
http://localhost:3000/callback. Keep the page open so you can copy your
credentials later.
First, run the command below to install dependencies.
pnpm installThis will also create a .env file and generate the Prisma Client
automatically. However, this is a best-effort and you may need to generate the
Prisma client manually. To do so run this command:
pnpm prisma generateAfter the .env file is created you must provide the Gamma Client credentials.
Open .env and you should see some empty fields, fill all these in:
| Environment variable | Description |
|---|---|
GAMMA_CLIENT_SECRET |
Client secret of the Gamma Client. |
GAMMA_CLIENT_ID |
Client id of the Gamma Client. |
GAMMA_API_KEY_ID |
API key id. Found between pre-shared and : in the generated Authorization header. |
GAMMA_API_KEY_SECRET |
API key secret. Displayed as "Api key" below the client secret. |
Tip
You may also want to add yourself as an administrator. See SETUP.md for how administrators are managed.
Then run the development server:
pnpm devThis will also do a few tasks automatically:
- Run a development database with Docker compose
- Update the database with the latest Prisma migrations
The compose file should be stopped automatically after the development server is stopped. If it does not run this command manually:
docker compose downIf you want starter data in a fresh local database, run:
pnpm prisma db seedOpen http://localhost:3000 with your browser to see the current website.
You can edit the page by modifying the files in src/. The page auto-updates as you edit.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
To work with Prisma you need to generate the Prisma client. You can do so by running:
pnpm prisma generateTip
In this project this happens automatically when installing dependencies
using the postinstall script.
Then you can import the Prisma Client in your code:
import { prisma } from "@/lib/prisma";See the official Prisma Client documentation for how to write queries with Prisma: https://www.prisma.io/docs/orm/prisma-client/queries/crud.
See Overview of Prisma Schema for the schema syntax.
After modification you can run pnpm prisma db push to test the new schema in the database.
Remember to regenerate the Prisma Client afterwards with pnpm prisma generate.
When you are done you can create a migration with the migrate command:
pnpm prisma migrate dev --name add_table_for_thingyUse the compose.prod.yaml file.