Skip to content

rohit-ganesan/ezdebtsolv-backend-app

Repository files navigation

EZDebtSolv Backend API

This is the backend API for the EZDebtSolv application, a platform designed to help users manage and solve their debt issues.

Setup

Prerequisites

  • Node.js (v14+)
  • MongoDB

Installation

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Create a .env file in the root directory with the following variables:
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/ezdebtsolv

Running the server

For development:

npm run dev

For production:

npm start

API Documentation

Swagger documentation is available at /api-docs when the server is running.

Main API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login user
  • GET /api/auth/profile - Get user profile (protected)
  • PUT /api/auth/profile - Update user profile (protected)

Users

  • GET /api/users - Get all users (admin only)
  • GET /api/users/:id - Get a single user (admin only)
  • PUT /api/users/:id - Update a user (admin only)
  • DELETE /api/users/:id - Delete a user (admin only)

Debts

  • GET /api/debts - Get all user debts (protected)
  • GET /api/debts/:id - Get a specific debt (protected)
  • POST /api/debts - Create a new debt (protected)
  • PUT /api/debts/:id - Update a debt (protected)
  • DELETE /api/debts/:id - Delete a debt (protected)
  • GET /api/debts/summary - Get debt summary statistics (protected)

Payment Plans

  • GET /api/plans - Get all payment plans (protected)
  • GET /api/plans/:id - Get a specific payment plan (protected)
  • POST /api/plans - Create a new payment plan (protected)
  • PUT /api/plans/:id - Update a payment plan (protected)
  • DELETE /api/plans/:id - Delete a payment plan (protected)

Database Models

User Model

{
  name: String (required),
  email: String (required, unique),
  password: String (required, min length: 6),
  role: String (enum: ['user', 'admin'], default: 'user'),
  createdAt: Date,
  updatedAt: Date
}

Project Structure

ezdebtsolv-backend-app/
├── src/
│   ├── config/        # Configuration files
│   ├── controllers/   # Route controllers
│   ├── middleware/    # Custom middleware
│   ├── models/        # Database models
│   ├── routes/        # API routes
│   ├── utils/         # Utility functions
│   └── server.js      # Main application file
├── .env               # Environment variables
├── .gitignore         # Git ignore file
├── package.json       # Project dependencies
└── README.md          # Project documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published