Full-stack note sharing app for UCR courses.
- Frontend: Vue 3 + Vite + Pinia + Bootstrap (
ucr-note-sharing/) - Backend: Node.js + Express + MySQL (
backend/)
backend/Express API and MySQL accessucr-note-sharing/Vue frontend
- Node.js 20+ (see
ucr-note-sharing/package.json) - MySQL 8+ (or compatible)
- Install dependencies:
cd backend
npm install- Configure environment:
cp .env.example .envUpdate backend/.env with your MySQL credentials and a JWT secret. The defaults are:
PORT=3000DB_HOST=localhostDB_PORT=3306DB_USER=your_db_userDB_PASS=your_db_passwordDB_NAME=ucr_note_sharing_devJWT_SECRET=replace_with_a_secure_random_string
-
Create the database and tables (example schema below).
-
Start the API server:
node src/app/server.jsOptional dev mode:
npx nodemon src/app/server.jsThe API will be available at http://localhost:3000/api by default.
- Install dependencies:
cd ucr-note-sharing
npm install- 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- Start the frontend:
npm run devOpen http://localhost:5173.
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;- PDF-only uploads are supported.
- Max file size is 10MB per note.
- Files are stored at
backend/uploads/notes/.
Frontend scripts live in ucr-note-sharing/package.json:
npm run devnpm run buildnpm run test:unitnpm run test:e2enpm run lint
- CORS: set
CORS_ORIGINSinbackend/.envif your frontend runs on a different URL. - Auth: registration is restricted to
@ucr.eduemails (seebackend/services/auth.service.js).