Skip to content

hossainchisty/LeafLine-Server

Repository files navigation

LeafLine

The LeafLine Book Store is an online platform that aims to provide a user-friendly and efficient way for customers to explore, purchase, and manage books.

Live Demo: Link

LeafLine API Docs: Link

Software Requirements Specification for LeafLine: Link

Jump to What's new?

Technologies and Tools

  • Backend: Node.js, Express.js
  • Frontend: Tailwind CSS, React, RTK Query
  • Database: MongoDB, Redis
  • Payment Gateway Integration: Stripe
  • Software Design: Clean Architecture
  • Authentication: JSON Web Tokens (JWT)
  • Devops: Github Actions, Docker
  • Tests: Jest, Supertest
  • Version Control: Git
  • Tools: Swagger (API Documentation), VS Code, Postman, Notion

Setting Up Your Node.js App

Follow these steps to set up and run the Node.js application locally on your machine.

Prerequisites

  • Node.js installed on your machine.

Installation

  1. Clone the Repository:

    git clone <repository-url>
    cd <repository-folder>
  2. Install Dependencies:

    npm install

Configuration

  1. Environment Variables:
    • Create a .env file in the root directory of the project.
    • Define the necessary environment variables in the .env file. For example:
      NODE_ENV=
      MONGO_URL = 
      JWT_SECRET = 
      EMAIL = 
      PASSWORD =
      FRONTEND_URL = http://localhost:5173
      # localhost:5173 does not work on production
      STRIPE_API_KEY=

Running the Application

  1. Development Mode:

    npm run dev

    This will start the server in development mode using nodemon, which will automatically restart the server when changes are detected.

  2. Production Mode:

    npm start

    This will start the server in production mode.

By default, the application will be accessible at http://localhost:3000. You can change the port number in the .env file if needed.

Testing

Explain how to run tests, if applicable.

npm test