Skip to content

Expense Manager API built using Spring Boot and PostgreSQL, ensuring a robust and scalable foundation. It simplifies expense tracking, allowing users to perform CRUD operations on expenses, manage profiles, and authenticate securely.

Notifications You must be signed in to change notification settings

iamkibeh/expense-manager-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expense Manager API

Project Logo

Table of Contents

Introduction

Welcome to the Expense Manager API! This is a simple REST API created using Spring Boot and PostgreSQL. It provides a robust platform for managing expenses, allowing users to authenticate, manage profiles, and perform CRUD operations on expenses. It is designed to be user-friendly and highly customizable.

Features

  • Secure User Authentication
  • User Profile Management
  • Effortless CRUD Operations for Expenses
  • Smart Expense Retrieval Based on Logged-In User:

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/iamkibeh/expense-manager-api.git
  2. Navigate to the project directory

    cd expense-manager-api
  3. Build the project using Maven

    mvn clean install

Configuration

  • Update application.properties with your database and application configuration.
  • Customize other configuration files as needed.

Explore REST APIs endpoints

User Authentication

Method URL Description Return
POST api/v1/auth/register User registration User object
POST api/v1/auth/login User login JSON Web Token (jwt)

Expenses

Method URL Description Return
GET api/v1/expenses Get all user expenses Array of JSON objects
GET api/v1/expenses/{id} Get a specific user expenses by id Single JSON objects
GET api/v1/expenses/name?name={name} Filter expenses by name Array of filtered JSON objects
GET api/v1/expenses/category?category={category} Filter expenses by name Array of filtered JSON objects
POST api/v1/expenses Create a user expenses Created JSON objects
PUT api/v1/expenses/{id} Update a user expenses Updated JSON objects
DELETE api/v1/expenses/{id} Delete a user expenses No content

** NOTE: ** The endpoints of Expenses are restricted. To access these endpoints, use the token generated after logging in as the value of Bearer in the Authorization header as follows: "Authorization: Bearer Token_id"

You can also retrieve expenses with optional pagination and sorting.

  • Parameters:
    • page (optional): Page number for pagination. Defaults to 0.

    • size (optional): Number of items per page. Defaults to a configured value.

    • sort (optional): Sorting order. Example: sort=id,desc.

    • Example Request:

      GET /api/v1/expenses?page=0&size=3&sort=id,desc
      • Example Response:
    {
      "content": [
         {
            "id": 2,
            "name": "Food",
            "description": "this is expense 2",
            "amount": 200.00,
            "category": "expense",
            "date": "2024-01-29",
            "createdAt": "2024-01-30T05:03:23.710+00:00",
            "updatedAt": "2024-01-30T05:03:23.710+00:00"
        }
        // Additional expenses...
      ],
      "pageable": {
        "pageNumber": 0,
        "pageSize": 3,
        "sort": {
          "sorted": true,
          "unsorted": false,
          "empty": false
        }
      },
      "totalElements": 10,
      "totalPages": 4,
      "last": false,
      "first": true,
      "sort": {
        "sorted": true,
        "unsorted": false,
        "empty": false
      },
      "numberOfElements": 3,
      "size": 3,
      "number": 0,
      "empty": false
    }

Sample of Request Body

User - Registration

    POST api/v1/auth/register
    Content-Type: application/json
   {
    "email": "[email protected]",
    "password": "12345678",
    "name": "liam"
    }

User - Login

    POST api/v1/auth/login
    Content-Type: application/json
   {
    "email": "[email protected]",
    "password": "12345678",
    }

User - Profile

  GET api/v1/profile
  Authorization: Bearer your_auth_token

Expenses

  POST api/v1/expenses
  Authorization: Bearer your_auth_token
  Content-Type: application/json
  {
    "name": "Expense 1",
    "description": "this is my test expense",
    "amount": 18000,
    "category": "expense",
    "date": "2023-10-30"
  }

Contributing

If you'd like to contribute, please fork the repository and create a new branch. Pull requests are welcome!

License

This project is licensed under the MIT License.

About

Expense Manager API built using Spring Boot and PostgreSQL, ensuring a robust and scalable foundation. It simplifies expense tracking, allowing users to perform CRUD operations on expenses, manage profiles, and authenticate securely.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages