Skip to content

lightandluck/nextjs-potluck

Repository files navigation

Potluck Prototype

This is an MVP (minimum viable product) for running Math Trades. The hope is that it can facilitate a math trade for things other than boardgames, which was the intention of the original TradeMaximizer.

Demo: https://nextjs-potluck.netlify.app/

Rough deploy instructions: https://cryptpad.fr/pad/#/2/pad/view/Sbm+8JbQnOvRhN5yHpyD+-1Fbn1rpWAEY77IzuJ-Bp0/

How to install

1. Set up a MongoDB database

Either locally or with MongoDB Atlas for free.

  • How to install mongodb locally
    • To start mongodb, start from command line: brew services start mongodb-community@6.0
    • To stop: brew services stop mongodb-community@6.0
    • Connect with cli: mongosh --port 27017 --authenticationDatabase "admin" -u "myUserAdmin" -p
    • Enable access control with SCRAM: Authenticate with SCRAM
    • Export and import data using scripts in /local-scripts
  • Reference articles

2. Set up environment variables

Copy the env.local.example file in this directory to .env.local (which will be ignored by Git):

cp .env.local.example .env.local

Set these variables in .env.local:

  • LOCAL_MONGOOSE_URI - URI with local db in connection string

  • ATLAS_MONGOOSE_URI - URI with cloud db in connection string

  • SEED_PREFIX - Starting seed prefix. TODO: Have the app set automatically from this config, instead of manually by the developer

  • These were for the native nodejs mongodb driver, but are no longer used. Keeping around just in case.

    • ATLAS_URI - Cloud connection string
    • LOCAL_URI - Local DB connection string
    • LOCAL_MONGODB_DB - Local DB Name
    • ATLAS_MONGODB_DB - Cloud DB Name

3. Run Next.js in development mode

npm install
npm run dev

# or

yarn install
yarn dev

Your app should be up and running on http://localhost:3001!

4. Set up seed. IMPORTANT!

You only have to do this once, before using the application for the first time. Hit the api endpoint: "http:/localhost:3001/api/seeds" with a POST request with an object of form:

{
  prefix: YOUR_CHOICE_STRING,
  counter: 0
}

This will create a seed that is used to create the official names for offerings.

Deploy Your Local Project

Innovation

To create the wantlists instead of using a grid like the OLWLG and Abecorn, or setting individual values, instead we simply sort a list. This means that the process of evaluating trades for the user decreases from O(n^2) to O(n) complexity.

!Warning - Still need to implement duplicate protection though!

Credits and Prior Art

Links to useful things

About

Wantlist generator for Math Trades

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published