This project is aimed at building a simple library management system using Node.js, Express, and MongoDB.
- Allows users to view, add, update, and delete books, authors, genres and copies of books.
- User authentication for all operations related to creation, updation and deletion.
- Session management.
-
Clone the repository.
git clone https://github.com/anakinsonone/local-library.git
-
Install dependencies with
npm install
. -
Set up a MongoDB database and update the configuration in
.env
. -
You can also specify a port in the same
.env
. -
Specify your mongodb url against the
DATABASE_URL
env variable. -
Create a session secret. You can use
openssl rand -base64 32
-
Run the application with
npm start
. -
Access the application at
http://localhost:<port_number>
(default: 3000).
-
Pull the docker image using
docker pull anakinsonone/locallibrary:latest
-
Run the image using
docker run --name local_library -d -p 8080:3000 anakinsonone/locallibrary:latest
This command will do the following things:
--name
- This assigns the name "local_library" to the container.-d
- This runs the container in detached mode (as a background process).-p 8080:3000
- This maps port 3000 from inside the container to port 8080 on the host machine. This means you can access the application by going tolocalhost:8080
in your web browser.
The project has been deployed on Render.com. Click here to view the project live.