Sign inSign up

codingsan17/library-management-system

By codingsan17

Updated about 2 years ago

Library Management Project Using Golang, PostgreSQL, gRPC, JWT, Docker/Kubernetes

Image
Languages & frameworks
API management
Web servers
0

265

codingsan17/library-management-system repository overview

library-management-system

Junior Backend Developer Synapsis Test Library Management Project Using Golang, PostgreSQL, gRPC, JWT, REDIS, Docker/Kubernetes

Example Endpoint API Result

image

image

image

image

User Service

Overview

User Service is a microservice designed to manage user accounts and authentication. It supports user registration, login, profile updates, and deletion. This service is built using Go and gRPC.

Features

  • Register User: Create a new user account.
  • Login: Authenticate a user and generate a JWT token.
  • Get User: Retrieve details of a specific user by ID.
  • Update User: Modify user details.
  • Delete User: Remove a user account.

Author Service

Overview

Author Service is a microservice designed to manage authors in a system. It provides functionalities to create, read, list, update, and delete authors. This service is built using Go and gRPC.

Features

  • Add Author: Create a new author entry.
  • Get Author: Retrieve details of a specific author by ID.
  • List Authors: Get a list of all authors.
  • Update Author: Modify details of an existing author.
  • Delete Author: Remove an author from the system.

Book Service

Overview

Book Service is a microservice designed to manage books in a system. It provides functionalities to add, update, borrow, return, and delete books. This service is built using Go and gRPC.

Features

  • Add Book: Add a new book to the system.
  • Update Stock: Update the stock for a specific book.
  • Borrow Book: Borrow a book from the system.
  • Return Book: Return a book to the system.
  • Delete Book: Remove a book from the system.

Category Service

Overview

Category Service is a microservice designed to manage categories in a system. It provides functionalities to create, read, update, and delete categories. This service is built using Go and gRPC for efficient communication between services.

Features

  • Create Category: Add new categories with a name and description.
  • Read Category: Retrieve details of a specific category by ID.
  • List Categories: Get a list of all categories.
  • Update Category: Modify details of an existing category.
  • Delete Category: Remove a category from the system.

Prerequisites

  • Go (version 1.18 or later)
  • Protocol Buffers compiler (protoc)
  • gRPC libraries for Go

Installation

  1. Clone the repository:

    git clone https://github.com/ihsan-developer/library-management-system.git
    cd yourPath/library-management-system
    go mod install
    
  2. Open Pgadmin4 GUI and create 4 database for every services and migrate every table and seed the example data from Database/ directory. Use AuthorDB, BookDB, CategoryDB, and UserDB directory to initiate table, then seed/fill the example data from ExampleData directory image

  3. Generate your JWT secret key on utils/generate-token/generate_token.go by running: go run main.go on terminal, then put it on JWT_SECRET_KEY variable on every .env services

     go run main.go on
     JWT_SECRET_KEY=YOUR_SECRET_KEY
    
  4. adjust other .env variable on every services

    DB_USER=YOUR_DB_USERNAME
    DB_NAME_USER=YOUR_DB_NAME_FOR_EACH_SERVICE
    DB_PASSWORD=YOUR_DB_PASSWORD
    DB_SSLMODE=disable
    JWT_SECRET_KEY=YOUR_SECRET_KEY
    
  5. Open terminal cmd GUI then change directory to your library-management-system project then you can change directory again to specific service you want to try, then run go run server.go command

    cd user-service
    go run server.go
    
    cd category-service
    go run server.go
    
    cd author-service
    go run server.go
    
    cd book-service
    go run server.go
    
  6. Open Postman API then create some request like example want to try login function

    • PORT : 8081 (user-service), 8084 (category-service), 8083 (book-service), 8082 (author-service)
    • set the url to http://localhost:8081/login
    • change the method to POST
    • Go to "body"
    • Select raw
    • Input this json
    • {
         "username": "yourUsername",
         "password": "yourPassword"
      }
      
    • output image

    POSTMAN API Collection Link Gdrive: https://drive.google.com/drive/folders/173rNNTWgXpuBly2_5iJXzDuw7LfR6Njp?usp=sharing

Tag summary

Content type

Image

Digest

sha256:7d4d4d240

Size

46.6 MB

Last updated

about 2 years ago

docker pull codingsan17/library-management-system