Skip to content

js-developer-codebase/Invoicelite-Backend

Repository files navigation

InvoiceLite Backend

A lightweight, production-ready REST API for an invoicing SaaS designed for micro and small businesses. Built with Node.js, Express, and MongoDB.

Features

  • Authentication System: Secure user registration and login using JWT and bcrypt.
  • Client Management: Full CRUD operations for managing clients.
  • Invoice Tracking: Create, read, update, and delete invoices. Includes automatic subtotal, tax, and total calculations.
  • Automated Status Logic: Invoices are automatically marked as "overdue" if their due date has passed and they remain unpaid.
  • API Documentation: Interactive Swagger (OpenAPI 3.0) documentation available out of the box.

Tech Stack

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB with Mongoose ODM
  • Authentication: JSON Web Tokens (JWT) & bcryptjs
  • Documentation: swagger-jsdoc & swagger-ui-express

Project Structure

server/
├── controllers/    # API request handlers and business logic
├── models/         # Mongoose schema definitions
├── routes/         # Express endpoint definitions
├── middleware/     # Custom HTTP middleware (auth, error handler)
├── config/         # Environment and database config files
├── utils/          # Helper utilities (JWT generation)
├── docs/           # Swagger configuration
├── app.js          # Express app setup and middleware pipeline
└── server.js       # Application entry point and server startup

Getting Started

Prerequisites

  • Node.js (v16+)
  • MongoDB installed and running locally on the default port 27017 (or modify MONGODB_URI in .env).

Installation

  1. Clone or download the repository, then navigate to the backend directory:
    cd Backend
  2. Install the dependencies:
    npm install

Configuration

A .env.example file is provided. Create a new file named .env and configure your local environment variables:

PORT=5000
MONGODB_URI=mongodb://localhost:27017/invoicelite
JWT_SECRET=your_super_secret_jwt_key
JWT_EXPIRE=30d

Running the API

Start the development server with auto-reloading (nodemon):

npm run dev

Or start the server normally:

node server.js

The server will be available at http://localhost:5000.

Documentation

Interactive API documentation is generated automatically using Swagger. Once the server is running, you can explore the endpoints and test the API at:

http://localhost:5000/api/docs

License

ISC License

About

A lightweight, production-ready REST API for an invoicing SaaS designed for micro and small businesses. Built with Node.js, Express, and MongoDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors