FinMan User Service

The FinMan User Service is a microservice responsible for managing user information in the FinMan system. It includes functionalities for creating, retrieving, updating, and deleting users, as well as handling user authentication and pagination. Please note that the default username and password is admin.

Table of Contents

Features

  • Create a new user
  • Retrieve user by ID
  • Retrieve all users
  • Update user details
  • Delete a user
  • Get user by username and password
  • Get users with pagination
  • Handle user authentication
  • Database migrations using golang-migrate
  • JWT authentication
  • Password hashing with bcrypt

Requirements

  • Go 1.22+
  • Docker (for containerized deployment)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/finman-user-service.git
    cd finman-user-service
  2. Install dependencies:

    go mod tidy
  3. Set up the environment variables in a .env file (see Environment Variables section).

or simply run it with docker

Usage

Running the Service

  1. Build the service:

    go build -o user-service .
  2. Run the service:

    ./user-service

Using Docker

  1. Build the Docker image:

    docker build -t finman-user-service .
  2. Run the Docker container:

    docker-compose up --build 

Environment Variables

Create a .env file in the root directory with the following content:

DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=finman-user
PORT=8081
IP=0.0.0.0
    ```