I need some wisdom on this. Currently I'm learning about micro-services architecture, and so I decided to make a simple project in a micro-services architecture. The project I'm building is just a simple Inventory management application, where the functionality is, well just to add Item and information about it. So at the current state, I have a:
- Authentication server
- Item management server
The Authentication server has responsibilities to handle registering a
User, changing its password, and exchanging http basic auth to jwt token to be used in Item management server. Item management server is a basic CRUD server for
The way I do this, I create a single database, both server connecting to this database and I have another repo that runs migration on the database that satisfies both servers. Currently I'm using PostgreSQL. Let's say this is the schema:
MyAppDb: - UserTable - id ;; UUID - username - password - ItemTable - id - owner ;; foreign key to UserTable id - name
This article states that using a single database for many apps is bad, because your server is actually tightly coupled to the others through the database. If I'm going to apply this, then I have to change how I work with the database:
MyUserDb: - UserTable - id ;; UUID - username - password MyItemDb: - ItemTable - id - owner ;; not sure what the type of this, should this be a plain UUID? - name
So the question is:
- What would be the suitable data type for
ItemTablethat previously points to user id?
- Since I'm no longer using shared databases, for example, if I need to query an
Itemand I also want to display its
owner, does that mean I have to do an HTTP call (assuming I'm using REST) to the Authentication server (assuming the Authentication server is capable of doing this)?