WELCOME!! This is an open source repository of STUDYBUDDI made by Don Do Phan and Daniel Nguyen.
This is a web app that allows students to connect with peers, similar to Hinge but for finding study partners.
Frontend:
- React 19.2
- Vite (build tool)
- CSS3
Backend:
- Node.js
- Express.js 5.1
- MySQL 2 (mysql2 driver)
Development Tools:
- ESLint (code linting)
- Nodemon (auto-restart)
- Concurrently (run multiple processes)
👉 See SETUP_GUIDE.md for detailed setup instructions!
- Node.js (v16 or higher)
- npm or yarn
- MySQL (v5.7 or higher)
For macOS/Linux:
./setup.shFor Windows:
setup.batBoth scripts will:
- ✅ Check prerequisites
- ✅ Install all dependencies
- ✅ Create
.envfile - ✅ Show next steps
- Clone the repository
git clone https://github.com/donphn/StudyBuddi.git
cd StudyBuddi- Install dependencies
npm install- Set up environment variables
cp .env.example .envThen edit .env with your MySQL credentials:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=studybuddi
DB_PORT=3306
- Create the database
mysql -u root -p < server/models/schema.sql- Start the development servers
npm run devThis will start:
- Frontend on http://localhost:3000
- Backend API on http://localhost:5000
| Command | Description |
|---|---|
npm run dev |
Start both frontend and backend concurrently |
npm run client |
Start only the frontend (Vite dev server) |
npm run server |
Start only the backend (Express server) |
npm run build |
Build frontend for production |
npm run preview |
Preview production build |
npm run lint |
Run ESLint to check code quality |
StudyBuddi/
├── src/ # Frontend React application
│ ├── App.jsx # Main React component
│ ├── main.jsx # React entry point
│ ├── App.css # Component styles
│ └── index.css # Global styles
├── server/ # Backend Express application
│ ├── config/ # Configuration files
│ │ └── database.js # MySQL connection setup
│ ├── controllers/ # Request handlers
│ │ └── exampleController.js
│ ├── routes/ # API routes
│ │ └── exampleRoutes.js
│ ├── models/ # Database models and schema
│ │ └── schema.sql # Database schema
│ ├── middleware/ # Custom middleware (future)
│ └── server.js # Express app entry point
├── public/ # Static assets
├── index.html # HTML entry point
├── vite.config.js # Vite configuration
├── package.json # Dependencies and scripts
├── .env.example # Environment variables template
├── setup.sh # Setup script for macOS/Linux
└── setup.bat # Setup script for Windows
http://localhost:5000/api
Get all items
GET /api/examplesGet single item
GET /api/examples/:idCreate new item
POST /api/examples
Content-Type: application/json
{
"name": "Item Name",
"description": "Item Description"
}Update item
PUT /api/examples/:id
Content-Type: application/json
{
"name": "Updated Name",
"description": "Updated Description"
}Delete item
DELETE /api/examples/:idSee server/README.md for detailed API documentation.
The application uses MySQL with the following main tables:
users- User accounts with authenticationitems- Example table with CRUD operationsshared_counter1&shared_counter2- Real-time counter storagestudy_sessions- Study session tracking (planned)
See server/models/schema.sql for the complete schema.
The application now includes JWT-based authentication:
- Login/Signup endpoints at
/api/users/loginand/api/users/signup - Passwords stored in database (use bcrypt in production!)
- JWT tokens for session management
- Protected routes for authenticated users only
- Code Style: Follow ESLint rules configured in the project
- Commits: Write clear, descriptive commit messages
- Branches: Create feature branches from
main - Pull Requests: Include description of changes and testing done
- Make sure MySQL is running:
brew services start mysql(macOS) orsudo systemctl start mysql(Linux) - Check your
.envfile has correct credentials - Verify database exists:
mysql -u root -p -e "SHOW DATABASES;"
- Frontend (3000): Stop other Vite/React apps or change port in vite.config.js
- Backend (5000): Stop other Node apps or change
PORTin.env
- Clear npm cache:
npm cache clean --force - Delete
node_modulesandpackage-lock.json, then runnpm install
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
ISC License
Project Link: https://github.com/donphn/StudyBuddi