Skip to content

NehitPahuja/ReXchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReXchange

ReXchange is a campus marketplace prototype tailored for university students who want to swap or sell second-hand items around campus. The project now combines a lightweight static front end with a Java + JDBC backend so students can instantly "sign in," publish listings, and browse curated campus deals in Indian Rupees (INR).

Features

  • Instant access authentication – a dedicated login screen seeds a mock campus user into localStorage, so no credentials are required.
  • Listing creation form – authenticated users can publish items with images, prices in INR, condition, and descriptions directly from the homepage.
  • Persistent storage – listings are stored in an embedded SQLite database via JDBC, with a graceful fallback to browser localStorage if the backend is offline.
  • Java API – a Spark Java service exposes /api/listings endpoints for retrieving and creating listings while also serving the static site assets.
  • Responsive layout – the navigation, hero, listing form, and item cards adapt from mobile widths through large desktop screens.
  • Student-focused content – copy, categories, and default listings are tuned for common campus needs (textbooks, bikes, dorm furniture, etc.).

Project structure

  • index.html – main marketplace experience with hero content, listing feed, and inline JavaScript for authentication-aware UI updates and API calls.
  • login.html – instant sign-in page that stores a mock user profile and routes back to the marketplace.
  • styles.css – shared styling for both pages, including layout primitives, typography, and responsive rules.
  • backend/ – Maven project containing the Spark Java application, SQLite persistence layer, and REST endpoints.

Getting started

Requirements

  • Java 17+
  • Maven 3.9+

Run the Java backend & front end together

The backend hosts the API and serves the static assets, so you can run everything with Maven:

cd backend
mvn package
mvn exec:java

After the server starts, open http://localhost:4567/index.html in your browser. Use the Login link to visit login.html, click Enter ReXchange, and you will be redirected back with publishing capabilities enabled.

Working with listings

  • Publishing: After signing in, complete the "Create your listing" form and submit. When the backend is available the listing is stored in SQLite and instantly returned to the feed; if the service cannot be reached it is saved locally and will display alongside the demo listings.
  • Currency: All prices are displayed in INR via the built-in Intl.NumberFormat formatter configured for the en-IN locale.
  • Resetting data: With the backend running, delete the backend/data/rexchange.db file to reset the shared listings. For local-only usage, remove the rexchangeListings key from the browser's storage (Developer Tools → Application/Storage → Local Storage).

Customization tips

  • Adjust theme colors, typography, or layout by editing the relevant sections inside styles.css.
  • Extend the Spark routes in backend/src/main/java/com/rexchange/App.java to support search, filtering, or authentication-backed operations.
  • Tweak the fallback listings in index.html or replace them with a fetch to another service if the backend is intentionally disabled.

This project is meant as a design and front-end prototype to showcase how a campus-focused second-hand exchange could look and feel.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors