Skip to content

API for Secretle: A Wordle variation focused on no-cheating gameplay. Features a Daily Challenge with Global Stats, a Free Play mode with shareable links and an Adversarial mode.

Notifications You must be signed in to change notification settings

jrcamelo/Secretle-API-TS

Repository files navigation

Secretle API - TypeScript

Secretle

A Wordle variation focused on no-cheating gameplay

Every Wordle variation I tried had an easy way to cheat for the answers, but not this one!
Features a Daily Challenge with Global Stats, a Free Play mode with shareable links and an Adversarial mode.



TypeScript Next.js Jasmine



🔧 Environment Variables

Create a .env.development.local and follow the variable names based on .env.TEMPLATE.

Set the Database

This project utilizes MongoDB as the database, with Mongoose as the ORM.
Set DB_CONN_STRING pointing to your MongoDB instance.
You can use MongoDB Atlas to create a free MongoDB instance.

Set the Seeds

The DAILY_SEED will randomize the list of answers.
VALID_WORDS_SEED will randomize the codes generated for sharing games.
The seeds can be any random string, so go ahead and change them to something else.

🚀 Start the project

Install the dependencies with yarn.
Then start the project with yarn run dev

Unit Tests

This project uses Jasmine as the testing framework.
Run the tests with yarn run test.
I recommend the following VSCode extensions to tests easily:

Lint

Lint the code with yarn run lint or yarn run lint-fix.
Configure the rules by editing .eslintrc.
Linting also runs on every pull request with GitHub Actions.

📦 Deployment

You can deploy easily by using Vercel.

Deploy with Vercel

🚪 Endpoint Summary

You can get the Swagger UI at the main page, http://localhost:3000/.
The Swagger YAML is also available at /public/swagger.yaml or http://localhost:3000/swagger.yaml.

/game

Takes a token and returns an ongoing game or a new one if there is none.
You can use the mode parameter to choose the game mode.
This sets your user token in the cookies as well.

/playing/guess

Takes a token and a word, and, if there is an ongoing game, adds a guess to the guess list

/playing/random

Takes a token and, if there is an ongoing game, makes a random guess

/playing/giveup

Takes a token, and if there is an ongoing game, finishes it

/stats

Gets a list of statistics about the daily Wordle games, and can take a game number

/me

Takes a token and returns a list of statistics about the player past games

About

API for Secretle: A Wordle variation focused on no-cheating gameplay. Features a Daily Challenge with Global Stats, a Free Play mode with shareable links and an Adversarial mode.

Topics

Resources

Stars

Watchers

Forks

Languages