Skip to content

paultdo/UCRNoteSharing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UCR Note Sharing

Full-stack note sharing app for UCR courses.

Tech stack

  • Frontend: Vue 3 + Vite + Pinia + Bootstrap (ucr-note-sharing/)
  • Backend: Node.js + Express + MySQL (backend/)

Project structure

  • backend/ Express API and MySQL access
  • ucr-note-sharing/ Vue frontend

Requirements

  • Node.js 20+ (see ucr-note-sharing/package.json)
  • MySQL 8+ (or compatible)

Backend setup

  1. Install dependencies:
cd backend
npm install
  1. Configure environment:
cp .env.example .env

Update backend/.env with your MySQL credentials and a JWT secret. The defaults are:

  • PORT=3000
  • DB_HOST=localhost
  • DB_PORT=3306
  • DB_USER=your_db_user
  • DB_PASS=your_db_password
  • DB_NAME=ucr_note_sharing_dev
  • JWT_SECRET=replace_with_a_secure_random_string
  1. Create the database and tables (example schema below).

  2. Start the API server:

node src/app/server.js

Optional dev mode:

npx nodemon src/app/server.js

The API will be available at http://localhost:3000/api by default.

Frontend setup

  1. Install dependencies:
cd ucr-note-sharing
npm install
  1. Configure the API base URL (optional). The default is http://localhost:3000/api.

Create ucr-note-sharing/.env if you want to override:

VITE_API_BASE_URL=http://localhost:3000/api
  1. Start the frontend:
npm run dev

Open http://localhost:5173.

Database schema

This schema matches the current MySQL tables.

CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `role` enum('Admin','User') NOT NULL,
  `emailVerified` tinyint(1) NOT NULL DEFAULT '0',
  `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedAt` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  UNIQUE KEY `constraint_name` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

CREATE TABLE `courses` (
  `id` int NOT NULL AUTO_INCREMENT,
  `courseCode` varchar(255) NOT NULL,
  `courseName` varchar(255) NOT NULL,
  `department` varchar(255) NOT NULL,
  `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedAt` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

CREATE TABLE `notes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `description` text,
  `courseId` int NOT NULL,
  `professor` varchar(255) DEFAULT NULL,
  `quarter` varchar(255) NOT NULL,
  `noteType` enum('lecture_notes','full_solution_set','lab','quiz_test_key','practice_problems') NOT NULL,
  `filePath` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `uploaderId` int NOT NULL,
  `likesCount` int NOT NULL DEFAULT '0',
  `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedAt` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `courseId` (`courseId`),
  KEY `uploaderId` (`uploaderId`),
  CONSTRAINT `notes_ibfk_1` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`),
  CONSTRAINT `notes_ibfk_2` FOREIGN KEY (`uploaderId`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

CREATE TABLE `likes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `userId` int NOT NULL,
  `noteId` int NOT NULL,
  `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `userId` (`userId`),
  KEY `noteId` (`noteId`),
  CONSTRAINT `likes_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`),
  CONSTRAINT `likes_ibfk_2` FOREIGN KEY (`noteId`) REFERENCES `notes` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

File uploads

  • PDF-only uploads are supported.
  • Max file size is 10MB per note.
  • Files are stored at backend/uploads/notes/.

Useful scripts

Frontend scripts live in ucr-note-sharing/package.json:

  • npm run dev
  • npm run build
  • npm run test:unit
  • npm run test:e2e
  • npm run lint

Troubleshooting

  • CORS: set CORS_ORIGINS in backend/.env if your frontend runs on a different URL.
  • Auth: registration is restricted to @ucr.edu emails (see backend/services/auth.service.js).

About

note sharing fullstack app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors