This repository contains the source code for the "Online Job Fair Registration" project. It features a complete backend system built with Node.js (Express) and a frontend starter using React + Vite, developed by ArtmaybeDEV.
- About The Project
- ✨ Features
- 🛠️ Built With
- 📂 Project Structure
- 🚀 Getting Started
- 🔑 Environment Variables
- 🌐 API Endpoint Documentation
This project is a backend-focused Web API designed to handle the registration and interview booking process for an online job fair. The system provides RESTful endpoints for user management, company information, and booking operations.
In addition to the core requirements, this project includes advanced features such as searching for companies by geographical distance and allowing users to manage a list of their favorite companies.
- User Authentication: Secure user registration and login using JWT (JSON Web Tokens).
- Interview Booking: Users can book, view, edit, and delete up to 3 interview sessions.
- Admin Capabilities:
- Admins can view, edit, and delete all user bookings.
- Admins can add, edit, delete company data.
- Company Search:
- View a list of participating companies.
- [Extra] Search for companies within a specific distance (e.g., within 10 km).
- User Favorites:
- [Extra] Users can add companies to their personal favorites list.
- [Extra] Users can view and remove companies from their favorites.
- Node.js
- Express.js
- MongoDB Atlas with Mongoose
- JSON Web Token (JWT) for authentication
- Bcrypt.js for password hashing
- Dotenv for environment variables
ArtmaybeDEV/
├── 📁 backend/
│ ├── 📁 src/
│ │ ├── config/
│ │ ├── controllers/
│ │ ├── data/
│ │ ├── middleware/
│ │ ├── models/
│ │ ├── routes/
│ │ └── services/ # ส่วนจัดการ Business Logic ที่ซับซ้อน (เช่น คำนวณระยะทาง)
│ ├── .env
│ ├── package.json
│ └── server.js
│
└── 📁 frontend/
├── 📁 src/
│ ├── app/
│ ├── assets/
│ ├── components/
│ ├── features/
│ ├── lib/
│ ├── pages/
│ ├── App.css
│ ├── App.jsx
│ ├── index.css
│ └── main.jsx
├── eslint.config.js
├── index.html
├── package.json
├── README.md
└── vite.config.js
To get a local copy up and running, follow these simple steps.
Make sure you have the following installed on your machine:
-
Clone the repository:
git clone [https://github.com/your-username/ArtmaybeDEV.git](https://github.com/your-username/ArtmaybeDEV.git) cd ArtmaybeDEV -
Setup the Backend:
cd Backend npm installCreate a
.envfile in thebackenddirectory and add the necessary environment variables (see below).npm run dev
The backend server will start on
http://localhost:5003(or your configured port). -
Setup the Frontend:
cd Frontend npm installThe frontend dev server needs to know the backend API URL. You might need to configure a proxy in
vite.config.jsor set the base URL in your Axios instance.npm run dev
The frontend will be available at
http://localhost:5173(or another port if 5173 is busy).
To run the backend, you need to create a .env file in the /backend folder and add the following variables.
# Port for the server to run on (Mac 5003 / Window 5000)
PORT=5003
# Your MongoDB Atlas connection string
MONGO_URI="mongodb+srv://<user>:<password>@cluster.mongodb.net/yourDatabaseName?retryWrites=true&w=majority"
# Secret key for signing JWT tokens
JWT_SECRET="your_super_secret_and_long_key_for_jwt"
Here are the main API endpoints available. (🔒 = Authentication Required)
| Method | Endpoint | Description |
|---|---|---|
POST |
/register |
Register a new user. |
POST |
/login |
Log in to get an access token. |
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Get a list of all companies. |
GET |
/:id |
Get details for a specific company. |
POST |
/ |
Create a new company (🔒). |
PUT |
/:id |
Update a company (🔒). |
DELETE |
/:id |
Delete a company (🔒). |
GET |
/search/dist |
Search for companies by distance (🔒). |
| Method | Endpoint | Description |
|---|---|---|
GET |
/me/favorites |
Get the current user's favorite companies. |
GET |
/me/favorites/:id |
Get details for a specific favorite. |
POST |
/me/favorites |
Add a company to favorites. |
DELETE |
/me/favorites/:companyId |
Remove a company from favorites. |
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Get all bookings (for admin) or own bookings (for user). |
GET |
/:id |
Get details for a specific bookings |
POST |
/ |
Create a new interview booking. |
PUT |
/:id |
Update a booking. |
DELETE |
/:id |
Delete a booking. |