Skip to content

A microservice responsible for User CRUD operations and authentication (JWTs and Refresh Tokens)

Notifications You must be signed in to change notification settings

joaocgduarte/users-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Users gRPC

Simple user management microservice.

Goals of this project:

  • Learn about microservices
  • Learn about gRPC
  • Be able to use this service along with other microservice (have an API Gateway, a frontend in React, and interact with a To-Dos service.

To-do:

  • Creates the migrations/seeds for the database.
  • Request for login, returning JWT token and Refresh token, that the API Gateway will use.
  • Refresh the access tokens, if current refresh token is valid.
  • Register a new user with a certain role (needs to have a valid JWT).
  • CRUD For the users and roles (missing Delete, Patch and Read routes for user and roles).
  • Add proper gRPC error handling.
  • Unit Test everything.
  • Do all the service integration tests.

Installation

Requirements

  1. Have docker, docker-compose installed.
  2. Have golang installed if you want to run the unit and integration tests on your machine.

Process to install

docker network create -d bridge todos-infrastructure
cd ~/workspace
git clone git@github.com:plagioriginal/users-service.git
cd users-service
cp .env.example .env
docker-compose up

You will have available a gRPC service running at http://localhost:8080 (port is editable in the .env file).

Run unit and integration tests

docker pull postgres
cd ~/workspace/users-service/src
go test ./...

Need to pull latest postgres image to run the integration tests.

Overall project architecture

API Gateway

Click here for repository.

  • REST API (returns in JSON)
  • A client for all the gRPC microservices (reads all the gRPC services).
  • Responsible for the interactions between all the microservices.

Users gRPC

Click here for repository.

  • Manages the users (CRUD operations)
  • Manages logins, logouts and refresh-token requests.
  • Uses Users Service Grpc package for contract.

To-dos gRPC

Repository yet to be created.

  • Manages all the to-dos.
  • Maybe will be used for note-taking as well.

Frontend

Click here for repository.

  • In React, will only call and use data from the API Gateway.

About

A microservice responsible for User CRUD operations and authentication (JWTs and Refresh Tokens)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages