I'm new to microservices. Always used monolith frameworks.
I don't quite understand how to implement in microservices architecture for this sample project:
Client Application (SPA)
Backend
- Users with different access (user, admin)
- Quizzes (with quiz-sessions for each user.)
- Gifts (for successfully completing quiz or questionary)
- Images for quizzes
- Images for gifts
I am planning on using API Gateway pattern for all requests from client side to be checked for authentication.
I kind of understand that API Gateway can generate JWT Tokens or similar and give them back to client side. Also API Gateway will store routes which require authentication and pass requests through only on authentication being successful.
I don't understand how to connect users microservice here. If I understand correctly - microservices are designed not only for decoupling but also for being reusable components (at least my main wish to create reusable microservices).
So API Gateway can be aware of user microservice and create users for registration there.
But what about sending emails for confirmation? How can this be done here? I assume I can create email sender microservice, and API Gateway will be aware of it as well.
But when business logic dictates to add additional field to users, except fields like email, name, phone etc. For example age, occupation, height etc? Wouldn't it make users microservice contaminated with custom business logic?
And after all that, I wonder how can I make relations between users and quizzes and gifts?
I intend to use docker and each stateful microservice to have it's own separate database (each microservice - separate docker compose files). Again, for reusing microservices after in different projects.
And how to store images? In what microservice precisely?
Aucun commentaire:
Enregistrer un commentaire