-
Notifications
You must be signed in to change notification settings - Fork 4
/
doc.go
73 lines (73 loc) · 3.85 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Catalyst started out as a microservice base that can be used to create REST APIs.
// It contains many essential parts that you would need for a microservice such as,
// - Configurability
// - A basic dependency injection mechanism
// - Request response cycle handling
// - Structure and field validations
// - Error handling
// - Logging
// - Database resource management
// - Application metrics
//
// Written using the Clean Architecture paradigm it offers clean separation between
// business (domain) logic and facilitation logic.
//
// In the context of `Catalyst` we use a concept called `Transport mediums` to define ways in which you can communicate
// with the microservice.
//
// A package inside the `transport` directory consists of all the logic needed to handle communication with the
// outside world using one type of transport medium.
//
// Out of the box, Catalyst contain two such transport mediums.
// - http (to handle REST web requests)
// - metrics (to expose application metrics)
//
// What makes Catalyst a REST API is this `http` package which handles the complete lifecycle of REST web requests.
//
// + ------- + + -------- +
// | REQUEST | | RESPONSE |
// + ------- + + -------- +
// || /\
// \/ ||
// + ------------ + ||
// | Middleware | ||
// + ------------ + ||
// || ||
// \/ ||
// + ------------ + ||
// | Router | ||
// + ------------ + ||
// || ||
// || ||
// || + --------------------------- +
// || | Transformer | Error Handler |
// || + --------------------------- +
// || /\
// \/ ||
// + -------------------- + => + -------------- +
// | Unpacker | Validator | | Controller |
// + -------------------- + <= + -------------- +
// || /\
// \/ ||
// + -------------- +
// | Use Case |
// + -------------- +
// || /\
// \/ ||
// _____________________________________
// + ---------- + + ------- +
// | Repository | | Service |
// + ---------- + + ------- +
// || /\ || /\
// \/ || \/ ||
// + ---------- + + ------- +
// | Database | | APIs |
// + ---------- + + ------- +
//
// Likewise the `metrics` transport medium exposes an endpoint to let `Prometheus` scrape application metrics.
//
// You can add other transport mediums to leverage a project based on Catalyst.
//
// For an example a `stream` package can be added to communicate with a streaming platform like `Kafka`.
// Or an `mqtt` package can be added to communicate with `IoT` devices.
package main