Skip to content

jerrywuworks/SlowSoupExpress

Repository files navigation

Slow Soup Express

About

Early prototype of a lateral-thinking-puzzle community app.

  • Stack: Express.js • Handlebars • MongoDB • Passport.js
  • Focus: Core puzzle submission, solution tracking, and session-based auth
  • Status: The current production version (Next.js, Auth.js, MongoDB) is live at slowsoup.app

Quick Look of this MVP (GitHub Codespaces)

If you’d like to browse the code without cloning locally, you can open this repo in GitHub Codespaces

  1. Click Code ▸ Codespaces ▸ Create codespace on main
    (or the “Open in Codespaces” button if you see one)
  2. Wait for Codespaces to finish setting up — you’ll be automatically redirected to the demo website once it’s ready.

Overview

Lateral Thinking Puzzles is now becoming one of the most popular party games in China, but it is lack of modernized support. The game itself requires:

  1. a pre-written plain-text puzzle consisted of
    1. a mystery
    2. a corresponding truth
  2. player(s) that:
    1. ask yes/no question based on the mystery
    2. guess the solution based on known information
  3. a judge that
    1. answer question by: yes/no/irrelevent
    2. compare the solution to the truth... end the game if the truth has been found

Slow Soup aim to provide a online platform for

  1. puzzle writers to share their works to the world
  2. player(s) to solve the shared puzzles by interacting with the AI judge supported by LLM

Data Model

The application will store User, Puzzle, PlayRecord, Liked, Saved, Favorites

All relations will be done via referencing. Liked, Saved, and Favorites will share the same schema called bookmark.

  • User
  • Puzzle
    • have reference(s) to User
    • User & Puzzle: One to Many
      • a Puzzle has one User as the author
      • a User may have 0 to many Puzzle as one's work
  • PlayRecord
    • have reference to User and Puzzle
    • PlayRecord & (Puzzle + User): One to one
    • Record will be updated if User plays the same Puzzle again (instead of adding a new PlayRecord)
  • bookmark (Liked / Saved / Favorites)
    • have reference to User and Puzzle
    • bookmark & (Puzzle + User): One to One
    • bookmark will be updated if modified by User (instead of adding a new bookmark)

An Example User:

{
  username: "soupmaker",
  email: "[email protected]",
  hash: // a password hash,
}

An Example Puzzle with references to User (puzzle example retrieved from https://en.wikipedia.org/wiki/Situation_puzzle#Example):

{
  title: "Example Puzzle From Wikepedia",
  mystery: 'A man walks into a bar, and asks the bartender for a drink of water. The bartender pulls out a gun, points it at the man, and cocks it. The man pauses, before saying "Thank you" and leaving. What happened?',
  truth: "The man had the hiccups, and his reason for requesting a drink of water was not to quench his thirst but to cure his hiccups. The bartender realized this and chose instead to cure the hiccups by frightening the man with the gun. Once the man realized that his hiccups were gone, he no longer needed a drink of water, gratefully thanked the bartender, and left.",
  author: // reference to User
  createdAt: // timestamp
}

An Example PlayRecord with references to User and Puzzle

{
  puzzle:  // reference to Puzzle,
  player:  // reference to User,
  attemptsUsed: 32,
  secondsUsed: 602,
  createdAt:  // timestamp,
}

An Example (Favorites / Liked / Saved) with references to User and Puzzle

{
  puzzle:  // reference to Puzzle,
  player:  // reference to User,
  createdAt: // timestamp,
}

Link to Commented First Draft Schema

Wireframes

/ - page for showing all shared puzzles

soup

/create - page for creating and sharing a new puzzle

create

/puzzle/:title - page for playing specific puzzle

puzzle slug

/login - page for login

login

/signup - page for login

signup

user/:username - page for my profile

profile

user/:username/favorites - page for viewing puzzles marked as favorites

profile favorites

user/:username/liked - page for viewing puzzles liked

user liked

user/:username/saved - page for viewing puzzles saved

user saved

Site map

site map

User Stories or Use Cases

  1. as non-registered user, I can register a new account with the site
  2. as a user, I can log in to the site
  3. as a user, I can create a new puzzle
  4. as a user, I can view all of the puzzles
  5. as a user, I can play any puzzle with the judge
  6. as a user, I can like a puzzle
  7. as a user, I can mark a puzzle as Favorites
  8. as a user, I can save a puzzle for later

Research Topics

10 points total out of 8 required points (addtional points will not count for extra credit)

ps: I want to start working on the frontend with react during the summer, so I used the backend & frontend folder structure. But frontend may be empty till the course ends...

Annotations / References Used

  1. passport.js authentication docs -> auth.mjs, app.mjs
  2. connect-mongo npm docs -> app.mjs
  3. adding adobe fonts to css -> layout.hbs
  4. color palette -> color styling of views in general
  5. Groq Documentation -> groq.mjs

About

Express.js + handlebars.js version of Slow Soup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors