diff --git a/README.md b/README.md index 0349a91..60382ee 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,18 @@ # Hilde 🏆 +> [!CAUTION] +> WIP 1.0.0 + ![Build](https://img.shields.io/github/actions/workflow/status/nehalist/hilde/build.yml?branch=main) ![License](https://img.shields.io/github/license/nehalist/hilde) ![Docker Pulls](https://img.shields.io/docker/pulls/nehalist/hilde) -You've got a foosball table or similar in your office and want to track your matches, player progress and compare yourself to your -colleagues and see who's the best? You've come to the right place. -**Hilde** is a match tracking app for games like foosball, table tennis, air hockey, etc. with achievements, elo ratings, statistics and -more. **Hilde** is easy to setup and can be used by everyone. - -A public **demo** is available at [demo.hilde.gg](https://demo.hilde.gg). +[//]: # (You've got a foosball table or similar in your office and want to track your matches, player progress and compare yourself to your) +[//]: # (colleagues and see who's the best? You've come to the right place.) +[//]: # (**Hilde** is a match tracking app for games like foosball, table tennis, air hockey, etc. with achievements, elo ratings, statistics and) +[//]: # (more. **Hilde** is easy to setup and can be used by everyone.) +[//]: # () +[//]: # (A public **demo** is available at [demo.hilde.gg](https://demo.hilde.gg).) ![Hilde](hilde.png) @@ -23,36 +26,27 @@ A public **demo** is available at [demo.hilde.gg](https://demo.hilde.gg). ## ⚡️ Features -- Simple, intuitive interface -- **Elo rating** for each team -- **Seasons** (managable via admin interface) -- Detailed team statistics (winstreaks, winrate, elo history chart, ...) -- **Achievements** (e.g. "Win 100 Matches", "Win 10 Matches in a row", ...) -- Compare teams against each other -- Teams of any size, simply separated by a comma in the team name -- **Light/Dark theme** -- Match comments -- **Leaderboards** -- *Optional*: Deployable for free with Vercel & Planetscale -- *Optional*: Fully dockerized +[//]: # (- Simple, intuitive interface) +[//]: # (- **Elo rating** for each team) +[//]: # (- **Seasons** (managable via admin interface)) +[//]: # (- Detailed team statistics (winstreaks, winrate, elo history chart, ...)) +[//]: # (- **Achievements** (e.g. "Win 100 Matches", "Win 10 Matches in a row", ...)) +[//]: # (- Compare teams against each other) +[//]: # (- Teams of any size, simply separated by a comma in the team name) +[//]: # (- **Light/Dark theme**) +[//]: # (- Match comments) +[//]: # (- **Leaderboards**) +[//]: # (- *Optional*: Deployable for free with Vercel & Planetscale) +[//]: # (- *Optional*: Fully dockerized) ## ⭐ Getting Started -Hilde can be installed in a few minutes, either by deploying it to Vercel, using Docker or setting it up manually. +[//]: # (Hilde can be installed in a few minutes, either by deploying it to Vercel, using Docker or setting it up manually.) Requirements: -- Node 14 -- MySQL (5.7+) - -Keep in mind that after installing you need to add a season via the admin ui (`/admin`) using the password from the environment variable (`ADMIN_PASSWORD`). - -### Free hosting with Vercel & Planetscale - -Hilde is designed in a way that it could easily be hosted for free, using [Vercel](https://vercel.com) for hosting -and [Planetscale](https://planetscale.com) for the database. - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fnehalist%2Fhilde) +- Node 20 +- PostgreSQL 13+ ### Docker Compose @@ -72,17 +66,17 @@ services: - '127.0.0.1:3000:3000' environment: - DATABASE_URL=mysql://root:hildepw@database:3306/hilde - - ADMIN_PASSWORD=v3rys3cr3tp4ssw0rd - database: - networks: - - internal - image: mysql:8.0 - environment: - - MYSQL_DATABASE=hilde - - MYSQL_ROOT_PASSWORD=hildepw + db: + image: postgres:13.3 + ports: + - "5432:5432" volumes: - - db:/var/lib/mysql + - db_data:/var/lib/postgresql/data/ + environment: + POSTGRES_DB: app + POSTGRES_USER: user + POSTGRES_PASSWORD: password volumes: db: @@ -98,8 +92,9 @@ After running `docker-compose up -d` Hilde is running on `localhost:3000`. 1. Clone/fork the repository 2. Run `npm ci` to install dependencies 3. Run `docker-compose up -d` in order to start the database container (or adjust the `.env` file to use a different db) -4. Run `npm run dev` to start the development server -5. Add awesome features. +4. Run `npm run db:migrations:make` to execute all migrations +5. Run `npm run dev` to start the development server (at `localhost:3000`) +6. Add **awesome** features. ### Docker @@ -112,32 +107,32 @@ via: ## ⚙️ Usage -### Administration - -Hilde provides an admin ui at `/admin` which can be used to manage seasons. - ### Commands Hilde provides a set of utility terminal commands: -| Command | Description | -|-------------------|-------------------------------| -| `npm run dev` | Starts the development server | -| `npm run build` | Builds the app | -| `npm run start` | Starts the production server | -| `npm run lint` | Lints files | -| `npm run migrate` | Executes Prisma migrations | +| Command | Description | +|---------------------------------|----------------------------------------------------------------------| +| `npm run dev` | Starts the development server | +| `npm run build` | Builds the app | +| `npm run start` | Starts the production server | +| `npm run lint` | Lints files | +| `npm run db:migrations:make` | Create migrations | +| `npm run db:migrations:execute` | Execute migrations | +| `npm run email:dev` | Run [react-email dev server](https://react.email/docs/cli#email-dev) | ### Configuration Hilde can be configured via environment variables in the `.env` file. -| Variable | Description | Default | -|-------------------|----------------------------|------------------------------------------------| -| `ADMIN_PASSWORD` | Administration password | `h1ldeb3steV3r` | -| `NEXTAUTH_SECRET` | Token secret | `+Zrk5zW6fgog5k0LbN4bxL1YXKIhvb65Yln5ZKf+g3o=` | -| `NEXTAUTH_URL` | Deployed URL of Hilde | `http://localhost:3000` | -| `DATABASE_URL` | Database connection string | `mysql://root:hildepw@localhost:3309/hilde` | +| Variable | Description | Default | +|------------------------|----------------------------|--------------------------------------------------------------------| +| `NEXT_PUBLIC_SITE_URL` | Site URL | `http://localhost:3000` | +| `EMAIL_SERVER` | Email server config | `smtp://localhost:1025` | +| `EMAIL_FROM` | Default sender email | `noreply@hilde.gg` | +| `NEXTAUTH_SECRET` | Token secret | `+Zrk5zW6fgog5k0LbN4bxL1YXKIhvb65Yln5ZKf+g3o=` | +| `NEXTAUTH_URL` | Deployed URL of Hilde | `http://localhost:3000` | +| `DATABASE_URL` | Database connection string | `postgresql://user:password@127.0.0.1:5432/app?search_path=public` | ## 👐 Contributing @@ -145,11 +140,10 @@ Hilde was created for fun and to play around with technologies I don't use on a It's built on: -- [Next.js 13](https://nextjs.org/) -- [tRPC](https://trpc.io/) +- [Next.js 14](https://nextjs.org/) - [Tailwind CSS](https://tailwindcss.com/) - [TypeScript](https://www.typescriptlang.org/) -- [Prisma](https://www.prisma.io/) +- [Drizzle](https://orm.drizzle.team/) - [NextAuth.js](https://next-auth.js.org/) - and many more (see [package.json](package.json)) diff --git a/docker-compose.yml b/docker-compose.yml index 3ecf139..881f9c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,6 @@ version: '3' services: - database: - container_name: hilde_db - image: mysql:8.0 - environment: - - MYSQL_DATABASE=hilde - - MYSQL_ROOT_PASSWORD=hildepw - ports: - - "127.0.0.1:3309:3306" - volumes: - - db:/var/lib/mysql - db: image: postgres:13.3 ports: @@ -30,5 +19,4 @@ services: - "8025:8025" volumes: - db: db_data: diff --git a/src/lib/cache.ts b/src/lib/cache.ts deleted file mode 100644 index d1c725d..0000000 --- a/src/lib/cache.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum CacheKey { - Leagues = "leagues", -}