-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlet-databases-eat-the-world.html
128 lines (126 loc) · 4.91 KB
/
let-databases-eat-the-world.html
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Let Databases eat the World</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="./styles/output.css"
type="text/css"
media="screen"
/>
<script
defer
data-domain="aswinmohan.me"
data-api="/stats/api/event"
src="/stats/js/script.js"
></script>
</head>
<body>
<header class="flex items-center justify-between">
<p><a href="/">back to home</a></p>
<p>2022-Oct-20</p>
</header>
<article>
<!--
* Let databases eat the world
* APIs are awesome, they let us string together already existing services together to create products faster
* Integrating APIs are hard though
* APIs at it's core are just moving around data from one database to another
* What if we skip the error prone middlelayer, have a consistent interface such that databases can talk to each other
* Let databases talk to each other and let the API serve out errors and
* SQL is well understood language
* Less Error Prone, API limits are automatically taken care of
* Need M + N integrations with stable core
-->
<h1>Let Databases Eat the World</h1>
<p>
APIs are awesome. They make the modern web and by it's extension, the
modern world tick. They enable us to build complex systems by building
on top of existing services and infrastructure. All this seems like APIs
are the best thing to ever happen to web development since Vim
</p>
<section>
<h2>APIs, the hard parts</h2>
<p>
Even though APIs handle a lot of complexity underneath their shiny
interfaces and help us to punch far beyond our weight. They are still
without their issues.
</p>
<h3>Integrating APIs are hard</h3>
<p>
Every API is different. In a perfect world APIs would only act as an
interface without any concern of implementaiton. But in the real
world, APIs are seldom well designed. The surface the quirks of the
implementation and we need to work around it. Most of the issues are
mitigated by SDKs that wrap around them, but they come with their own
issues.
</p>
<p>
Integrating APIs take a non-zero amount of development time and we
need to work on it.
</p>
<h3>Error handling and rate limits</h3>
<p>
While directly using APIs we have to take care of not hitting their
limits. We need to specify the
</p>
<h3>Duplicated Efforts</h3>
<p>
Take Stripe. Even though every business use case is different, it's
the same way to integrate it. The only thing that needs to change is
the mapping between the data-model and the database.
</p>
</section>
<section>
<h2>Moving data around</h2>
<p>
At it's core APIs are just moving data around. They can trigger side
effects in the world, but the start and end of that side effect is
still data.
</p>
<p>
Calling an API changes the data stored in another service. There are
no other things that you can do from that.
</p>
</section>
<section>
<h2>Databases to handle data</h2>
<p>
Since we are handling data, we can use the best tool for the job,
Relational Databases.
</p>
<p>
Since we are using SQL to get and scale the data, we can use it to
create and fetch more than enough for the entire system.
</p>
</section>
<section>
<h2>The middleware for the Internet of APIs</h2>
<p>
When integrating M services with N services, we can either connect
them directly, needing MxN integrations or through a common interface
requiring only M+n integrations. Rather than integrating the data
between one and all.
</p>
<p>
Rather than APIs talking to each other we could have databases that
talk to each other. We just insert the customer_id value to a column
in Stripe table and we can have the sytem automatically fetch data
related from the Stripe API and insert it into another database with
the value. To then get the information about the customer we can query
the join table.
</p>
<p>
We need a single system to get the data from one database to another.
</p>
<h3>Authentication</h3>
<p></p>
<h3>Error Handling</h3>
</section>
</article>
</body>
</html>