Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/benschlegel/owldle

๐ŸŽฎ Guess the overwatch league player
https://github.com/benschlegel/owldle

game nextjs typescript

Last synced: about 2 months ago
JSON representation

๐ŸŽฎ Guess the overwatch league player

Awesome Lists containing this project

README

        


Logo



Guess the Overwatch League (OWL) player using a series of clues (like the players team, role, country and region). Resets every day at midnight.


Showcase
ยท
Features
ยท
Getting Started
ยท
About
ยท
Sponsor





Stargazers


Releases


Issues


Commits

Contributors
Number of passing tests

Link to website

## Showcase

| ![Showcase 1 (Showing screenshot of game)](images/showcase1.png) | ![Showcase 2 (Showing screenshot of game in light mode)](images/showcase2.png) |
| --- | --- |
| ![Showcase 3 (Showing victory screen)](images/showcase3.png) | ![Showcase 3 (Showing mobile layout)](images/showcase4.png) |

## Features

This project was built using [`Next.js`](https://nextjs.org/) and [`tailwindcss`](https://tailwindcss.com/). Components are based on [`shadcn/ui`](https://ui.shadcn.com/). Tests were written with [`vitest`](https://vitest.dev/) and [`bun`](https://bun.sh/) is used instead of `npm`.

Major features are:

- ๐ŸŽจ Consistent and dynamic themes (light + dark mode)
- All components use theme colors and automatically switch to correct theme
- ๐Ÿ“ฑ Fully responsive
- Works and looks good on any screen size (desktop + mobile + everything in-between)
- ๐Ÿ›ข Dynamic database scheme
- Supports dynamic game iteration length (e.g. default to 1 reset per day, but can have more on event day)
- Supports multiple datasets (e.g. different seasons)
- saves iteration data to log (iteration number, correct player, time of reset)
- ๐Ÿ•ต Anonymous game result collection (game result + guesses, no information that could identify users)
- Scheme can be found under `types/database` (`type DbLoggedGame`)
- saved using `lib/databaseAccess.ts` (`function logGame()`)
- ๐ŸŽฒ Batched pseudo random selection
- Random backlog of players generated (to keep the game from being stale but also to avoid duplicate players for `backlog.length` iterations)
- ๐Ÿ› ๏ธ Easily configurable
- The behavior of the game can easily be adjusted by changing values in `game.config.json`
- Check `lib/config.ts` to find out more info about the config.
- ๐Ÿฆฟ Following modern accessiblity recommendations
- Fully compatible with screen readers
- Entire website can be navigated/used with keyboard inputs only
- All dialogs use search parameters (meaning you can share a link where e.g. the feedback dialog is open)
- ๐Ÿ•ต Anonymous + EU compliant analytics (using [`Plausible`](https://plausible.io/))
- โšก Blazingly fast through server side rendering + vercel edge functions/distributed servers
- ๐Ÿ“ƒ Follows modern SEO standards
- Automatically generates `robots.txt` (through `robots.ts`)
- Automatically generates sitemap (through `sitemap.ts`)
- Uses site metadata (preview image, title, description, etc)
- ๐Ÿงช Contains tests for critical functionality
- Can be configured to automatically write test report/be ran through Github actions
- Tests for:
- Main game process + results
- Checks to ensure all images (even from country flag api) still work
- Database functions
- โš ๏ธ Full error handling
- All invalid input errors are caught client side (with toasts that show what went wrong, works on desktop and mobile) + server side (zod schema validation for all api post endpoints)
- Rate limit on all api endpoints to increase stability
- and more!

## Getting Started

First, clone the project locally and install dependencies. If you're only working locally, you can also use npm/pnpm/yarn, but this project was built and tested with bun.

```bash
bun install
# or
npm install
```

### env
Before starting the project, make sure you provide the following values to the environment (either directly or by creating a file called `.env.local` in the project root folder):

```bash
MONGO_URI=""
CRON_SECRET=""
# optional
ADMIN_API_TOKEN=""
```

The only *strictly necessary* entry is `MONGO_URI` (as you won't have a database otherwise), so make sure you provide a valid [`Mongodb`](https://www.mongodb.com/) [connection uri](https://www.mongodb.com/docs/manual/reference/connection-string/).

When trying to use this project in production, you should provide `CRON_SECRET`. This secret gets used in the `api/cron` path, which is responsible for resetting the game periodically (e.g. once per day).

The `ADMIN_API_TOKEN` can be used to secure the (WIP, not yet implemented) admin dashboard and can be skipped for now.

---
After setting up your environment and installing all dependencies, you can start the project like this:

```bash
bun run dev
# or
npm run dev
```

You should now be able to see the website running on `localhost:3000`.

To built the project, you can run
```bash
bun run build
bun run start
# or
npm run build
npm run start
```

## Tests
This project contains tests for the major features under `tests/*.test.ts`. Tests that only run locally are postfixed by `*.local.test.ts` to allow filtering when running tests and ensure local tests always run with maximum performance.

To run tests, run
```bash
bun run test:local # only runs local tests
# or
bun run test # runs all tests
# or (using npm)
npm run test:local # only runs local tests
# or
npm run test # runs all tests
```

I also created a custom test reporter, which writes the following fields to `tests/report.json`:

```json
{
"numTotalTests": "",
"numPassedTests": "",
"numFailedTests": "",
"numPendingTests": "
Link to Ko-fi