A York University campus marketplace for students to buy and sell used textbooks, furniture, electronics, and other student essentials.
- Project Structure
- Getting Started
- Database Setup
- Data Lake Setup
The project is a monorepo containing the frontend and backend of the YUBuy application
The frontend is a React application built with Vite.
Code Structure:
frontend/src/assets: Contains static assets like CSS and images.frontend/src/pages: Contains React pages.frontend/src/components: Contains reusable React componentsfrontend/src/App.jsx: The root React component.frontend/src/main.jsx: The entry point of the application.frontend/src/test: Contains test cases for frontend pages.
The backend is a Node.js application using the Express framework.
Code Structure:
backend/src/api: Contains all the API modules. Each module is organized by feature.*Controller.js: Handles incoming requests, validates input, and calls the appropriate service.*Router.js: Defines the routes for the module.*Service.js: Contains the business logic for the module.
backend/src/db: Contains the database connection and initialization code.backend/tests: Contains unit and integration tests for backend endpoints.
- Node.js (v20 or higher) and Prisma ORM for connecting to the database
You can run the frontend and backend services locally concurrently.
cd frontend
npm install
npm run buildcd backend
npm install
# Make sure your .env file is configured
node src/server.jsThe following environment variables are required to run the backend application. These should be set in the backend/.env file.
| Variable | Description |
|---|---|
DATABASE_URL |
The connection string to your Prisma ORM. |
FRONTEND_URL |
The frontend URL that requests will be coming from |
SESSION_SECRET |
A session secret key (can be any value) |
AZURE_STORAGE_CONNECTION_STRING |
The connection string to your Azure storage account for ADLS |
EMAIL_USER |
yubuy.noreply@gmail.com |
GMAIL_CLIENT_ID |
Gmail client access ID for Oauth2 API |
GMAIL_CLIENT_SECRET |
The client secret for the Gmail access ID for Oauth2 API |
GMAIL_REFRESH_TOKEN |
The refresh token required for Oauth2 API |
The following environment variable is required to run the frontend application. This should be set in the frontend/.env file.
| Variable | Description |
|---|---|
VITE_API_BASE_URL |
http://localhost:8080 |
This project uses a Prisma ORM for the database.
- Get your connection string: Quickstart: Prisma ORM with PostgreSQL | Prisma Documentation.
- Set the
DATABASE_URLin thebackend/.envfile.
Once your backend/.env is configured with DATABASE_URL, run the following from the project root to create all the tables:
npx prisma generate
npx prisma migrate devThis project uses an Azure ADLS Gen2 instance to host the data lake.
- Create an Azure storage account.
- IMPORTANT: When creating your storage account, in the advanced settings, enable "Hierarchical namespace".
- Inside of the storage account, create a container named "raw".
- Under
Access Keys, retrieve yourConnection string (Key 1)and paste it underAZURE_STORAGE_CONNECTION_STRINGin thebackend/.envfile.