This is the backend component of our Learning Management System (LMS). It serves as the core system that handles user authentication, course management, and student data for our online learning platform.
- Features
- Code Architecture
- Tech Stack
- Available Scripts
- Project Structure
- Prerequisites
- API Documentation
- How to Install
- How to Run
- User registration
- Authentication and authorization.
- Course creation and management.
- Submission file
- Enrollments and student data management.
- RESTful API for seamless integration with the frontend.
In this project, we use the repository pattern as the code architecture
-
controllers/
: This directory typically contains the controllers, which handle the incoming requests, process the input, interact with the services, and return the response. -
models/
: This directory usually contains the data models, which define the structure of the data that the application works with. -
repositories/
: This directory is where the repository pattern comes into play. The repositories abstract the data access logic from the controllers and services. They contain methods for retrieving and persisting data. -
services/
: This directory typically contains the business logic of the application. Services interact with repositories to perform data operations and provide an abstraction layer for the controllers.
The following technologies are used in the project:
- express - is a back end web application framework for building RESTful APIs with Node.js
- bcryptjs - is a JavaScript library that provides bcrypt hashing functions for Node.js.
- cors - is a middleware for Node.js web servers that simplifies the process of handling CORS in your applications
- dotenv - is a npm package for Node.js applications that helps manage environment variables in a project by loading them from a file named .env.
- firebase - a variety of tools and services that help developers with features like authentication, real-time databases, cloud functions, hosting, and more. but in this project only uses firebase storage
- joi - a schema description language and data validator for Javascript
- jsonwebtoken - is a npm library for Node.js that allows you to generate and verify JSON Web Tokens (JWTs).
- moment - a JavaScript date library for parsing, validating, manipulating, and formatting dates.
- mongoose - is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports Node.js and Deno (alpha).
- multer - is a node.js middleware for handling multipart/form-data, which is primarily used for uploading files.
- nodemailer - is an npm module for Node.js that allows you to send emails from your Node.js applications
- randombytes - a simple and reliable way to generate random data that is suitable for cryptographic purposes
This is the list of available scripts that you can run in the project directory:
npm start
npm run seed:user
backend/
├── app/
│ ├── controllers/
│ │ ├── userCtrl.js
│ │ └── index.js
│ ├── models/
│ │ └── userModel.js
│ ├── repositories/
│ │ └── userRepo.js
│ └── services/
│ └── userSvc.js
├── config/
│ ├── database.js
│ └── routes.js
├── package.json
└── index.json
Before getting started, make sure you have the following installed:
- Node.js
- MongoDB or your preferred database system
- Dependencies specified in
package.json
- Access Website
Access to API documentation
- User Admin
username: admin
Password: admin2023
username: kane
Password: adminkane
-
Clone the repository:
git clone https://github.com/FS-7-Talenesia/backend
-
cd or open to the cloned repository folder
-
run npm install and npm run seed:user
-
Open postman then input this url "http://localhost:8000/"
-
if not run locall, change this url "http://localhost:8000/" to "https://fs-7-talenesia-backend.vercel.app/"
-
next run the login endpoint to get the token
- User Admin
username: admin
Password: admin2023
username: kane
Password: adminkane
-
Pull image from dockerhub:
docker pull romiari/fs7_lms_be:latest docker run -d -p 8000:8000 romiari/fs7_lms_be
-
Open postman then input this url "http://localhost:8000/"
-
if not using docker, change this url "http://localhost:8000/" to "https://fs-7-talenesia-backend.vercel.app/"
-
next run the login endpoint to get the token