Full Spring Boot authentication microservice with Domain-Driven Design approach.
This is a list of the main goals of this repository:
- Showing how you can implement a Domain-Drive design
- Showing how you can implement a CQRS
- Presentation of the full implementation of an application
- This is not another proof of concept (PoC)
- The goal is to present the implementation of an application that would be ready to run in production
- Showing the application of best practices and object-oriented programming principles
- Presentation of the use of design patterns. When, how and why they can be used
- Presentation of the implementation using Domain-Driven Design approach (tactical patterns)
- Presentation of the implementation of Unit Tests for Domain Model (Testable Design in mind)
- Presentation of the implementation of Integration Tests
- Presentation of the implementation of testing Web-Layer only
- Give it a star
- Share it
- Become a contributor
The main idea of this repository is to create small microservice for authentication that provides next functionalities:
- Form Registration
- Form Login, Google Login, Facebook Login
- Password recovery
- Email notifications
- Session identification and authentication
- Run database docker container first:
docker-compose up -d
- Run application locally with
local
profile - Plan is to dockerize the application in order to run it easy
- Run database docker container first:
docker-compose up -d
. Plan is to add testdb for testing purposes. - Run Integration test separately
- Run Unit test separately
- Run Web-Layer (tests that are testing Spring Boot implementation and Rest Controller) tests separately
- Clean the code from inconsistencies
- Add more session details
- Implement a tool like ELK
- Caching if/when needed
- More tests
- CI
- Pull out 'ddd' folder and create a library
- Pull out 'CQRS' folders (contracts and configuration) and create a library
- Finish SpringBoot security and CSFR token
- Dockerize
4. The main idea is to create a reusable microservice network that consists of the next microservices:
- Service discovery (probably with K8s).
- Create a microservice for authentication (current repository).
- Create a microservice for authorization - simple implementation of RBAC.
- Create a microservice for sending emails.
- Create a microservice for localization - the idea is to provide UI for translating the application to various languages as a common part of most applications.
- Create a microservice for asynchronous communication (AC) - the idea is to create a microservice that distributes the messages between microservices. The microservice should work over DB (e.g. Redis) and RMQ to provide asynchrony. The microservice should provide the REST API for accessing it. In this way, we should have RMQ in only one place and communication with this microservice should go over REST API.
The microservice should provide these routes:
- route for registering messages by other microservices. E.g. Email-Microservice could register message send-email with required properties, endpoint, and version. That configuration should be saved into a DB.
- sending messages - E.g. Authentication microservice should send a message after registering a user with the name send-email and required properties. The AC microservice will receive that message, validate the required properties, enrich the message body with an endpoint (which is saved in DB) and publish a message to RMQ. The RMQ consumer will consume the message and distribute it to the endpoint.
The project is under MIT license.
- "Domain-Driven Design: Tackling Complexity in the Heart of Software" book, Eric Evans
- "Implementing Domain-Driven Design" book, Vaughn Vernon
- "Domain-Driven Design in PHP" book, by Carlos Buenosvinos, Christian Soronellas, Keyvan Akbary
- "IDDD_Samples" GH repository, Vaughn Vernon
- "Blog CQRS" GH repository, by Carlos Buenosvinos, Christian Soronellas, Keyvan Akbary
- "DDD example - Last Wishes" GH repository, by Carlos Buenosvinos, Christian Soronellas, Keyvan Akbary
- "Modular Monolith with DDD" GH repository, by Kamil Grzybek
- "Mediator implementation" GH repository, by Jimmy Bogard
- "Patterns of Enterprise Application Architecture" book, Martin Fowler
- "Clean Architecture: A Craftsman's Guide to Software Structure and Design (Robert C. Martin Series" book, Robert C. Martin
- "The Clean Architecture" article, Robert C. Martin
- "DDD, Hexagonal, Onion, Clean, CQRS, … How I put it all together" article, Herberto Graca
- "Building Microservices: Designing Fine-Grained Systems" book, Sam Newman
- "Clean Code: A Handbook of Agile Software Craftsmanship" book, Robert C. Martin
- "Design Patterns: Elements of Reusable Object-Oriented Software" book, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides