Skip to content

harsh-1806/user-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Service - Expense Tracker Service

The User Service is responsible for managing user information. It saves user data received from an authentication service through Kafka and provides various endpoints for managing user-related information.

Table of Contents

Features

  • Save user information received from the Auth Service via Kafka.
  • Manage user info through various endpoints.
  • CRUD operations for user data.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/user-service.git
    cd user-service
  2. Set up PostgreSQL:

    Make sure you have PostgreSQL installed and running. Create a database for the service.

  3. Configure the application:

    Update the application.properties file with your database and Kafka configurations.

  4. Build and run the service:

    ./mvnw clean install
    ./mvnw spring-boot:run

Usage

The User Service listens to Kafka topics for user information and provides RESTful endpoints for managing user data.

API Endpoints

User Endpoints

  • Create User

    • URL: /users
    • Method: POST
    • Description: Create a new user.
    • Request Body:
      {
        "username": "string",
        "email": "string",
        "password": "string"
      }
  • Get User by ID

    • URL: /users/{id}
    • Method: GET
    • Description: Retrieve user information by user ID.
  • Update User

    • URL: /users/{id}
    • Method: PUT
    • Description: Update user information.
    • Request Body:
      {
        "username": "string",
        "email": "string"
      }
  • Delete User

    • URL: /users/{id}
    • Method: DELETE
    • Description: Delete a user by ID.

Kafka Listener

The service listens to the auth-service topic for user information and processes the messages to save or update user data in the database.

Configuration

The application configuration is managed through the application.properties file. Ensure to update the following properties:

POSTGRES_HOST=db.example.com
POSTGRES_PORT=5432
POSTGRES_USER=myuser
POSTGRES_PASSWORD=mypassword
POSTGRES_DB=mydatabase
KAFKA_HOST=kafka.example.com
KAFKA_PORT=9092
USER_SERVICE_PORT=8080

Todo

  • Add more endpoints
  • Code comments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published