A comprehensive role-based loyalty program management system built for the Computer Science Students Union (CSSU).
CSSU Rewards is a full-stack web application that enables student organizations to manage a points-based loyalty program. Users can earn points through purchases and events, redeem them for promotions, and transfer points to other members.
- π― Multi-role System - Support for Regular Users, Cashiers, Managers, Event Organizers, and Superusers
- π° Points Management - Earn, redeem, and transfer points with full transaction history
- ποΈ Event Management - Create events, manage RSVPs, and award attendance points
- π Promotions - Create and manage promotional campaigns with point redemption
- π± QR Code Integration - Quick user identification and redemption processing
- π Secure Authentication - JWT-based authentication with role-based access control
- π Dashboard - Role-specific dashboards with quick actions and insights
- React 19 with React Router 7
- Vite 7 for fast development and building
- Axios for API communication
- QRCode.react for QR code generation
- Vitest for testing
- Express 5 REST API
- Prisma ORM with SQLite
- JWT for authentication
- bcrypt for password hashing
- Zod for validation
- Node.js 18 or higher
- npm or yarn
-
Clone the repository
git clone <repository-url> cd CSC309
-
Set up the backend
cd backend npm install # Set up environment variables cp .env.example .env # Edit .env with your configuration # Run database migrations npx prisma migrate dev # Seed the database (optional) npm run seed # Create a superuser npm run createsuperuser
-
Set up the frontend
cd frontend npm install
Start the backend server:
cd backend
npm startOr specify a port:
node index.js 3000The API will be available at http://localhost:3000.
Start the frontend development server:
cd frontend
npm startThe app will be available at http://localhost:5173.
CSC309/
βββ backend/
β βββ index.js # Express app entry point
β βββ prisma/
β β βββ schema.prisma # Database schema
β β βββ seed.js # Database seeding
β β βββ createsu.js # Superuser creation script
β βββ package.json
βββ frontend/
β βββ src/
β β βββ api/ # API client modules
β β βββ components/ # Reusable components
β β βββ contexts/ # React contexts
β β βββ pages/ # Page components
β β βββ utils/ # Utilities
β βββ index.html
β βββ package.json
βββ README.md
| Role | Description |
|---|---|
| Regular User | View points balance, transactions, events; redeem promotions; transfer points |
| Cashier | Create purchase transactions; process redemption requests |
| Manager | Manage users, events, promotions, and all transactions |
| Event Organizer | Manage assigned events, attendees, and award points |
| Superuser | Full system access including role management |
Users can hold multiple roles and switch between them using the role switcher.
The backend provides a RESTful API. Key endpoints include:
POST /auth/login- User authenticationGET /users- User managementGET /transactions- Transaction historyGET /events- Event listingsGET /promotions- Promotion listings
Frontend tests:
cd frontend
npm testWith coverage:
npm run test:coverageFrontend:
cd frontend
npm run buildThe build output will be in the frontend/build directory.
The application can be deployed using Docker. A Dockerfile is provided in the backend directory.
cd backend
docker build -t cssu-rewards-backend .
docker run -p 3000:3000 cssu-rewards-backendFor the frontend, serve the built files from any static file server or CDN.
This project is licensed under the MIT License - see the LICENSE file for details.
Note: Logo and branding assets are NOT covered by the MIT License and remain proprietary. See the LICENSE file for details.
- Joe Fang - csc309@oss.joefang.org
- Michael Lin - xiaoshu.lin@mail.utoronto.ca
- CSC309 Course Staff, University of Toronto
- Computer Science Students Union (CSSU)