Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit c6a9359

Browse files
committed
add monolith vs microservice to readme
1 parent 1bb35ee commit c6a9359

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

readme.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ are indeed the next progression when applications scale and reach that turning p
99
using Lucid, the transition process will be logically simpler to think about and physically straight-forward to
1010
implement.
1111

12+
To see how it compares to the monolithic application and when to use which, check [Monolith vs. Microservice](#monolith-vs-microservice)
13+
1214
## Installation
1315
To get rolling, you need to create a new project using Composer:
1416
```
@@ -133,6 +135,39 @@ That's it! Now serve the application with `php artisan serve` and visit `http://
133135

134136
---
135137

138+
## Monolith vs. Microservice
139+
In the monolith Lucid application we have multiple services (i.e. Api, Web) and these typically will exist in
140+
`src/Services/Api` and `src/Services/Web` respectively. With the microservice the `src` does not exist, since
141+
it is intended to be one service serving a single purpose, the `app` directory will do.
142+
It will hold the following directories:
143+
- **Data** For all your models, repositories and value objects.
144+
- **Domains** Holds the Domains and their Jobs.
145+
- **Features** The service's Features.
146+
147+
### Directory Structure
148+
| Component | Monolith | Microservice |
149+
|---------|---------|--------------|
150+
|Job | src/Domains/[domain]/Jobs/[job] | app/Domains/[domain]/Jobs/[job] |
151+
| Feature | src/Services/[service]/Features/[feature] | app/Features/[feature] |
152+
| Service | src/Service/[service] | N/A (app) as equivalent |
153+
154+
### Tests
155+
One other significant difference is in the location of tests:
156+
157+
|Component|Monolith | Microservice |
158+
|---------|---------|--------------|
159+
|Job | src/Domains/[domain]/Tests/Jobs/[JobTest] | tests/Domains/[domain]/Jobs/[JobTest] |
160+
| Feature | src/Services/[service]/Tests/Features/[FeatureTest] | tests/Features/[Feature]Test.php |
161+
162+
## How To Choose
163+
It is always [recommended](http://martinfowler.com/bliki/MonolithFirst.html) that you start with a monolith
164+
and work on it until it gets so big that it is crucial to be dissected into single-purpose services (microservices).
165+
It would be challenging to be able to figure out the different services your application would need moving forward.
166+
167+
This project is also useful when you know for sure that your application will not have to deal with multiple Services but you would still like to use Lucid.
168+
169+
---
170+
136171
# Laravel PHP Framework
137172

138173
[![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework)

0 commit comments

Comments
 (0)