Dining API for CMU dining locations and availability https://cmueats.com
  • HTML 82%
  • TypeScript 17.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Eric Xu 024438a80c
Merge pull request #261 from ScottyLabs/staging
Feat: bypass google account picker on sign in
2026-05-18 16:26:56 -04:00
.github/workflows Merge branch 'staging' into twefest 2026-01-03 21:38:48 -05:00
documentation Slight grammar and linking changes (#43) 2023-07-18 13:35:50 -07:00
drizzle db generate 2026-02-21 18:21:02 -05:00
src fix: address some of copilot comments 2026-05-18 16:24:05 -04:00
tests fix: address some of copilot comments 2026-05-18 16:24:05 -04:00
.dockerignore migrate to bun and elysia (#132) 2024-01-15 11:34:43 -05:00
.env.example migrate to bun and elysia (#132) 2024-01-15 11:34:43 -05:00
.env.test chore: fix tests 2026-02-09 20:24:50 -05:00
.gitignore tests: add all timing edge cases (#158) 2024-09-22 19:26:34 -04:00
babel.config.js fix: migrate from bun to rollup + node 2025-07-19 12:37:05 -04:00
categories.ts migrate to bun and elysia (#132) 2024-01-15 11:34:43 -05:00
docker-compose.yml chore: rename dockerfile 2025-09-20 16:24:51 -04:00
Dockerfile chore: move from jest to vitest 2025-11-09 19:27:52 -05:00
Dockerfile.pnpm.simple feat: automatic db migrations, move overwrite logic directly under api endpoint, create bun and pnpm dockerfiles 2025-09-16 11:30:33 -04:00
drizzle.config.ts feat: automatic db migrations, move overwrite logic directly under api endpoint, create bun and pnpm dockerfiles 2025-09-16 11:30:33 -04:00
package.json feat: send email on report 2026-02-09 20:19:43 -05:00
pnpm-lock.yaml feat: send email on report 2026-02-09 20:19:43 -05:00
pnpm-workspace.yaml fix: pnpm-workspace 2026-05-18 15:21:02 -04:00
README.md feat: add ratingsAvg field for endpoint locations 2026-01-31 17:32:04 -05:00
rollup.config.js fix: migrate from bun to rollup + node 2025-07-19 12:37:05 -04:00
run-pnpm.sh feat: automatic db migrations, move overwrite logic directly under api endpoint, create bun and pnpm dockerfiles 2025-09-16 11:30:33 -04:00
swagger.json migrate to bun and elysia (#132) 2024-01-15 11:34:43 -05:00
tsconfig.json test: very preliminary auth 2025-12-27 19:05:06 -05:00
vitest.config.ts fix: extend test timeout 2025-12-28 13:30:43 -05:00

Dining API

This Dining API scrapes location data from the CMU dining sites and distributes it as a RESTful API. Access the API here.

To build and deploy the service, you'll need pnpm, which you should install beforehand.

Then, clone this repository to your computer by running

git clone https://github.com/ScottyLabs/dining-api.git

after making sure you have git downloaded or running

gh repo clone ScottyLabs/dining-api

if you have the Github CLI.

If you already have the node_modules folder or package-lock.json from previous versions of the Dining API, please remove them before continuing.

Now install the API's dependencies by 'cd'-ing into the root of the repository and running:

pnpm install

Then start your local database with (assuming you have the correct env variables)

pnpm db:start
pnpm db:push # if this is your first time running the db
pnpm dev

To see the contents of the database, I recommend using DBeaver. You can also run pnpm db:studio to start up drizzle studio

Database schema changes (important!)

When you make changes to the database schema, be sure to run pnpm db:push to keep your local db in sync.

Before merging your PR, be sure to run pnpm db:generate to generate a migration file, which will then be automatically applied to the staging and production databases when deployed. (You should do this before running tests as well!)

To test if the migration files work, you can run pnpm run-prod, which will spin up a production version of the server and a postgres database mounted on a new volume. The server is created using the same Dockerfile used in our Railway deployments, so if it works locally, it (probably) works in production as well.

Extra docker commands

Run bash inside it (for debugging): docker run --rm -it --entrypoint bash dining-api-server Close dockerfile + delete volumes: docker-compose down --volumes

Under the hood

We get the entire list of locations from DINING_URL, fetch location specifics under their corresponding CONCEPT_BASE_LINK, and retrieve soups and specials from DINING_SOUPS_URL and DINING_SPECIALS_URL, respectively. See the process() method in diningParser.ts for more details.

Before submitting a PR

  • Make sure all tests pass with pnpm test or pnpm test --watch for watch mode.

Random notes

the "cheerio" package is pinned at version "1.0.0-rc.12" because newer versions seem to be incompatible with jest.