Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

347 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spill the Tea

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.

Prerequisites

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.

Getting Started

First, run the command below to install dependencies.

pnpm install

This 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 generate

After 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 dev

This will also do a few tasks automatically:

  1. Run a development database with Docker compose
  2. 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 down

If you want starter data in a fresh local database, run:

pnpm prisma db seed

Open 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.

Prisma

To work with Prisma you need to generate the Prisma client. You can do so by running:

pnpm prisma generate

Tip

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.

Updating the Schema

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_thingy

Deployment

Use the compose.prod.yaml file.

Releases

Packages

Contributors

Languages