Skip to content

Wannabeloved/NodejsExpressNotes

Repository files navigation

Notes App

A web application for creating and managing notes with user authentication. This project evolved from my nodejs cli notes app, transforming it into a full-featured web application using Node.js (Express) server with EJS templating engine and Bootstrap for the frontend.

Requirements

  • Docker
  • Docker Compose

Installation and Launch

  1. Clone the repository:
git clone https://github.com/Wannabeloved/NodejsExpressNotes
cd NodejsExpressNotes
  1. Start the application using Docker Compose:
docker compose up -d

After launch:

  • Web application will be available at: http://localhost:3000
  • MongoDB will be available at: mongodb://localhost:27017

Environment Variables

The project uses environment variables for configuration. Example values are provided in .env.example:

JWT_SECRET=secret        # Secret key for JWT tokens
SALT_ROUNDS=10          # Number of salt rounds for password hashing
MONGODB_URI=...         # MongoDB connection string

For development and demonstration purposes, you can use these values as is by copying .env.example to .env. In production, you should change these values and use proper secret management.

Connecting to MongoDB via Compass

If you want to connect to the database using MongoDB Compass, use the following connection string:

mongodb://root:example@localhost:27017/notes?authSource=admin

Default credentials:

  • Username: root
  • Password: example
  • Database: notes
  • Auth Database: admin

Features

  • User registration and authentication
  • Create, view, edit, and delete notes
  • Each user sees only their own notes
  • Protected routes using JWT tokens
  • Responsive Bootstrap UI
  • Data persistence using MongoDB

Development

If you want to make changes to the code:

  1. Stop the containers:
docker compose down
  1. Make your changes

  2. Rebuild and start the containers:

docker compose up -d --build

Important Notes

  1. For production, it's recommended to change:

    • MongoDB password (in compose.yaml)
    • JWT_SECRET in constants.js
    • Use secure secret storage
  2. MongoDB data is stored in a Docker volume, so it persists even after container restarts

Tech Stack

  • Backend: Node.js with Express
  • Database: MongoDB
  • View Engine: EJS
  • Frontend: Bootstrap
  • Authentication: JWT
  • Containerization: Docker & Docker Compose

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published