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).
- 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
localStorageif the backend is offline. - Java API – a Spark Java service exposes
/api/listingsendpoints 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.).
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.
- Java 17+
- Maven 3.9+
The backend hosts the API and serves the static assets, so you can run everything with Maven:
cd backend
mvn package
mvn exec:javaAfter 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.
- 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.NumberFormatformatter configured for theen-INlocale. - Resetting data: With the backend running, delete the
backend/data/rexchange.dbfile to reset the shared listings. For local-only usage, remove therexchangeListingskey from the browser's storage (Developer Tools → Application/Storage → Local Storage).
- 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.javato support search, filtering, or authentication-backed operations. - Tweak the fallback listings in
index.htmlor 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.