Skip to content

dizzyryan/CSCI3100-Secondhand-Marketplace

 
 

Repository files navigation

CSCI3100-Group16-Secondhand-Marketplace

CUHK Secondhand Marketplace — a Rails 8 web app for buying and selling second-hand items within the CUHK community.


Table of Contents


Setup Guide

Prerequisites

  • Ruby 3.3.8 (see .ruby-version)
  • PostgreSQL (hosted on Supabase)
  • Node.js (for assets)
  • Bundler (gem install bundler)

Installation

git clone https://github.com/Iriscsl/CSCI3100-Group16-Secondhand-Marketplace.git
cd CSCI3100-Group16-Secondhand-Marketplace
bundle install

Configuration

  1. Copy the environment template:

    cp .env.example .env.development
  2. Fill in the Supabase database credentials (from Supabase Dashboard → Project Settings → Database → Connection string, use the Session/Transaction mode pooler):

    • DATABASE_HOST — pooler host, e.g. aws-0-ap-southeast-1.pooler.supabase.com
    • DATABASE_PORT6543
    • DATABASE_NAMEpostgres
    • DATABASE_USERNAMEpostgres.YOUR_PROJECT_REF
    • DATABASE_PASSWORD — your Supabase database password
    • DATABASE_SSLMODErequire
    • DATABASE_PREPARED_STATEMENTSfalse
  3. Set Gmail SMTP credentials (optional — if omitted, emails open in-browser via letter_opener):

    • GMAIL_USERNAME — your Gmail address
    • GMAIL_APP_PASSWORD — a Gmail App Password
  4. Set Stripe API keys (optional — required for payment checkout):

    • STRIPE_SECRET_KEY
    • STRIPE_PUBLISHABLE_KEY

Running the App

bin/dev

Then visit http://localhost:3000.


How to Run Tests

Minitest (unit & controller tests)

bin/rails test

RSpec (model & request specs)

bundle exec rspec

Cucumber (acceptance / BDD tests)

bundle exec cucumber

All tests with coverage

SimpleCov is configured to generate a coverage report. After running the test suite, open coverage/index.html in your browser.


Implemented Features

Feature Name Primary Developer Secondary Developer Notes
User Authentication, CUHK-only access @shanli030 Sign up, login, logout with Devise; restricted to CUHK email (@link.cuhk.edu.hk), college-aware browsing instead of strict multi-tenant isolation
Item CRUD, lifestyle UI @Iriscsl listings, Available/Reserved/Sold
Search, filters @sheenachann Fuzzy search: Autocomplete showing suggestions as user type
Real-time chat @leungvanice Web-socket based messaging between buyer and seller
Payments, background jobs, email @dizzyryan Daily digest on new items in user’s community

Design Note: From Multi‑Tenant to College‑Aware

In the original proposal we planned a strict multi‑tenant design where each CUHK college would be fully isolated.
During implementation we decided to relax this constraint to give users more flexibility:

  • The app is still restricted to CUHK members only via CUHK email sign‑up.
  • Users can browse and trade across all colleges, which better matches real buying/selling behavior.
  • The item list page includes filters by college, so users who prefer to see items from a specific college can still do so.

This “college‑aware, CUHK‑only” approach keeps the spirit of the original idea (college context) while avoiding the usability and complexity issues of hard multi‑tenant isolation.

SimpleCov Report

SimpleCov Report

To generate: run all three test suites (bundle exec rspec, bin/rails test, and bundle exec cucumber) so that SimpleCov merges their coverage, then open coverage/index.html and save a screenshot as docs/simplecov.png.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 60.2%
  • HTML 30.7%
  • CSS 3.7%
  • Gherkin 2.7%
  • Dockerfile 1.2%
  • Shell 0.8%
  • JavaScript 0.7%