Welcome to UBook! This project enables users to create accounts as either Business owners or Consumers, facilitating the offering and booking of services. Below, you'll find detailed information about the project's features, how to get started, and various other details.
- Features
- Technology Stack
- Getting Started
- Authentication
- Email Verification
- Dockerization
- Contributing
- License
- Business Accounts: Business owners can create and manage their services, set prices, and view booked appointments on a calendar.
- Consumer Accounts: Consumers can browse available services, book appointments, rate services, and check the status of their bookings.
- Booking Management: Allows seamless booking and management of appointments between businesses and consumers.
- Rating System: Consumers can rate the services they have used.
- Email Verification: New users receive account verification emails powered by Nodemailer.
- React: A JavaScript library for building user interfaces.
- Redux: State management for handling global state across the application.
- MUI (Material-UI): A library for styling and pre-built components that follow Material Design guidelines.
- Express: A Node.js web application framework for building the back-end.
- JWT: JSON Web Tokens for secure user authentication.
- MySQL2: A Node.js MySQL client for interacting with the MySQL database.
- Nodemailer: A Node.js module for sending emails (used for account verification).
- Pug: A template engine for rendering dynamic email content.
- Docker: The entire application, including the front-end, back-end, and database, is containerized for easy deployment and consistent environment setup.
Before you begin, ensure you have the following installed:
- Node.js (v14.x or later)
- npm (v6.x or later) or yarn (v1.x or later)
- Docker and Docker Compose for containerization
-
Clone the repository:
git clone https://github.com/AtroxEGO/ubook.git cd ubook -
Install dependencies for both front-end and back-end:
cd client npm install cd ../server npm install
-
Set up environment variables:
Create a
.envfile in theserverdirectory and configure the necessary environment variables:DB_PASSWORD=your_db_password MAIL_USER=email@example.com MAIL_PASSWORD=your_email_password JWT_PRIVATE_KEY=your_jwt_private_keyCreate a
.envfile in theclientdirectory and configure the necessary environment variables:REACT_APP_API_HOST = "http://localhost:3002/api" -
Start the MySQL database:
Ensure your MySQL server is running and that the database specified in the
.envfile is created. -
Start the back-end:
cd server npm run start -
Start the front-end:
cd client npm startThe front-end will be available at
http://localhost:3000and the back-end athttp://localhost:3002.
-
Build and start the Docker containers:
docker compose up --build
This will start both the front-end and back-end services along with a MySQL database. The front-end will be available at
http://localhost:3000and the back-end athttp://localhost:3002.
Authentication is managed using JSON Web Tokens (JWT). Users can log in with an email and password, and each session is secured with a JWT that must be included in the authorization header for protected routes.
Nodemailer is used to send verification emails to new users. Email templates are rendered using Pug, which allows for dynamic content in the emails.
The application is fully containerized using Docker, with the following services defined in the compose.yml file:
- frontend: Runs the React application.
- backend: Runs the Express server.
- database: Runs the MySQL database.
-
Build and start containers:
docker compose up --build
-
Stop containers:
docker compose down
-
Rebuild without cache:
docker compose build --no-cache
This project is licensed under the MIT License. See the LICENSE file for more details.