Skip to content

About

Surplus-food marketplace for Baguio: stores list end-of-day food at a discount, buyers reserve it and pick it up.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

88 Commits

Folders and files

Repository files navigation

Thryx, ThriftBite's mascot

ThriftBite

Tonight's surplus, saved before closing.

A marketplace for surplus food in Baguio. Bakeries and carinderias list end-of-day food at a discount; buyers reserve it, then pick it up and pay at the counter before it goes to waste.

Try the live demo · API · How it works · Deploy

CI

The demo has one-tap logins for a buyer, a store owner and an admin, with sample Baguio data that resets every 6 hours. It runs on free hosting, so the first load after a quiet spell can take about a minute while the server wakes up.


What it does

Who What they can do
Buyers Browse food for sale store by store, or every deal at once, sorted by closing time or discount. Reserve from several stores in one checkout and get a claim code per store, then pay at the counter. Follow stores to get an alert when they post, and see how much they've saved.
Store owners List food with a photo and a pickup window, or use Post again to relist what usually sells, adjusted by how it went last week. Hand over pickups by checking claim codes, and see sales: money made, share sold, leftovers by weekday, pickups by hour. Add up to five staff logins for the counter.
Admins Approve new stores, answer buyers' problem reports, and suspend accounts that break the rules. Every action goes into an activity log that can't be edited.

Built to hold up

  • Live stock. When someone reserves, the count drops on every open screen over a WebSocket. Updates go out only after the database commits, so a checkout that fails announces nothing, and messages carry no private data.
  • All-or-nothing checkout. A cart spanning several stores reserves everything or nothing, with one reservation and claim code per store. Stock comes off in one conditional update that only succeeds if enough is left, so two buyers can never both get the last item.
  • Accounts without email. Signing up gives eight one-time recovery codes instead of a reset link. Changing a password logs out every other device at once.
  • Fair limits. Reserving is free, so missed pickups pause reserving for a while, wrong claim codes and passwords are rate-limited, and none of it lets a stranger lock someone else out.
  • Safe photos. Uploads are decoded and redrawn as JPEGs on the server, which drops location data and anything that isn't really a picture. It's sized to run in 512 MB.
  • Light and dark. The look takes its colours from Thryx, and dark mode follows the device until you pick one.
  • Moderation that's honest. Reports are checked against real pickups, the store never learns who reported it, and an admin can excuse an unfair missed pickup.

The details behind each of these are in How it works.

Tech stack

Layer Technology
Backend Java 21, Spring Boot 4 (Web MVC, Security, Data JPA, Validation, WebSocket)
Database PostgreSQL 17, Flyway migrations
Frontend React, TypeScript, Vite
Testing JUnit 5, Testcontainers
CI GitHub Actions
Hosting Vercel (frontend), Render (API, Docker), Neon (Postgres), all in or near Singapore
flowchart LR
  B[Browser] -->|HTTPS| V[Vercel<br/>React app]
  B -->|REST + WebSocket| R[Render<br/>Spring Boot API]
  R --> N[(Neon<br/>PostgreSQL)]
Loading

Run it locally

Requirements: JDK 21+, Node.js 22+, Docker Desktop (running).

Backend: starts Postgres automatically through backend/compose.yaml.

cd backend
./mvnw spring-boot:run        # Windows PowerShell: .\mvnw spring-boot:run

The API runs at http://localhost:8080 (health check: /actuator/health).

To create an admin account locally, set these before starting (PowerShell):

$env:APP_ADMIN_USERNAME = "admin"
$env:APP_ADMIN_PASSWORD = "<at-least-12-characters>"

To get the one-tap demo accounts (and a month of sample sales) locally, also set $env:APP_DEMO_ENABLED = "true" before starting the API. This wipes the local database's other accounts on startup.

Frontend

cd frontend
npm install
npm run dev                   # http://localhost:5173, talks to the API on :8080

The API address comes from VITE_API_URL (see frontend/.env.example); without it the app uses http://localhost:8080.

Tests

cd backend
./mvnw verify                 # needs Docker for Testcontainers

Deploy

The live demo runs on free tiers: Neon for Postgres, Render for the API (render.yaml sets it up as a Blueprint, deploying from main only after CI passes), and Vercel for the frontend. Step-by-step setup and the free-tier notes are in Deploying ThriftBite.

Project structure

backend/    Spring Boot API: one package per feature (auth, store, item, cart, reservation, live, admin, …)
frontend/   React + TypeScript app: one page per screen in src/pages
docs/       API reference, design notes and deploy guide
.github/    CI workflow

Evolution

ThriftBite started as a Team 7 university project and was rebuilt from scratch as a web app.

Version Communication Storage Client
v1 (original-version, tag v1.0) Raw TCP sockets, thread per client XML files Java Swing
v2 (main) REST + WebSockets PostgreSQL React web app

A version built on Java RMI lives in thriftbite-rmi.

My role

v2: I rebuilt the whole project, backend and frontend, with AI-assisted development.

v1 (Team 7, university project): I was the backend developer. I built the socket server, the request handling for all 25 protocol actions, and the XML persistence layer.

Credits

Thryx, ThriftBite's mascot, was designed by a teammate from the original Team 7. Thank you for creating him, and for letting him carry on into v2.

About

Surplus-food marketplace for Baguio: stores list end-of-day food at a discount, buyers reserve it and pick it up.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages