-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
440 lines (434 loc) · 24.8 KB
/
index.html
File metadata and controls
440 lines (434 loc) · 24.8 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Webhooks plug landing page - A webhooks as a service infrastructure</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="./stylesheets/reset.css" />
<link rel="stylesheet" href="./stylesheets/style.css" />
<link rel="stylesheet" href="./stylesheets/snackbar.css" />
</head>
<body>
<main>
<nav>
<div class="webhooks-nav">
<div class="logo">
<img src="./images/logo.png" width="30px" height="30px" />
</div>
<div class="links">
<ul>
<li>
<a href="#case-main">Case Study</a>
</li>
<li>
<a href="https://temporal-stork-160.notion.site/Webplug-Documentation-2a208d2620864246a6494fb36cfe6dbe?pvs=4"
target="_blank">Docs</a>
</li>
<li>
<a href="https://youtu.be/5Ns9REq0fLU?si=wvV2rQ2YqgJGMDiI" target="_blank">Video Demo</a>
</li>
<li>
<a href="https://github.com/webhooks-plug" target="_blank">Github</a>
</li>
</ul>
</div>
</div>
</nav>
<section class="webhooks-header">
<div class="tags">
<span>#webhooks <img src="./images/time.png" width="18px" height="18px" /></span>
<span>#endpoints <img src="./images/message.png" width="18px" height="18px" /></span>
<span class="notif">#sns <img src="./images/notification.png" width="16px" height="16px" /></span>
</div>
<p class="main-text">Webhooks as a <span style="color: #e68a00;">service</span> infrastructure.</p>
<p class="sub-text">Use WebPlug to manage webhooks for your customers.<br /> Deploy the
infrastructure to your own AWS account and get a management UI to <br /> oversee your users webhooks.
</p>
</section>
<section class="header-img container">
<img src="./images/header.webp" width="100%" height="350rem" />
</section>
<section class="case-study">
<aside class="case-aside">
<ul>
<li data-id="case-1">
<span class="dot"></span>
<a href="#case-1">About Webhooks Plug</a>
</li>
<li data-id="case-2">
<span class="dot"></span>
<a href="#case-2">What are webhooks?</a>
</li>
<li data-id="case-2" class="sub-li">
<span class="dot"></span>
<a href="#case-2-1">Alternatives to webhooks</a>
</li>
<li data-id="case-2" class="sub-li">
<span class="dot"></span>
<a href="#case-2-2">Examples of webhooks services</a>
</li>
<li data-id="case-3">
<span class="dot"></span>
<a href="#case-3">WebPlug Architecture</a>
</li>
<li data-id="case-3" class="sub-li">
<span class="dot"></span>
<a href="#case-3-1">Architecture Diagram</a>
</li>
<li data-id="case-3" class="sub-li">
<span class="dot"></span>
<a href="#case-3-2">Webplug Stack</a>
</li>
<li data-id="case-4">
<span class="dot"></span>
<a href="#case-4">How does WebPlug work?</a>
</li>
<li data-id="case-5">
<span class="dot"></span>
<a href="#case-5">Webplug JS client</a>
</li>
<li data-id="case-6">
<span class="dot"></span>
<a href="#case-6">Webplug CLI app</a>
</li>
<li data-id="case-7">
<span class="dot"></span>
<a href="#case-7">Webplug management UI</a>
</li>
<li data-id="case-8">
<span class="dot"></span>
<a href="#case-8">Future Considerations</a>
</li>
</ul>
</aside>
<div id="case-main" class="case-main container-fluid">
<h3>Case Study <span style="font-size: 0.875rem;">(Actively being written)</span></h3>
<div id="case-1">
<h4>1. About WebPlug</h4>
<p>
Webplug is a webhooks as a service infrastructure that aims to provide a template for managing
webhooks for users of a service.
</p>
<p>You would typically create a service which can be regarded as an application and then you can
register event types that your users may be interested in receiving notifications for.
Let's say you are a payment provider and you provide services for businesses to create cards for
their users. You would have some event types that a user can subscribe to; for example,
card_issued, card_debited or card_credited.
Whenever a user performs an operation on their card, you want the business to receive a
notification at whatever endpoint they have subscribed to for each event type,
so that they can then perform extra business logic for each user. This is a typical use case for
webplug.</p>
<p>Webplug is built on top of AWS and provides a CLI app for you to deploy the infrastructure to an
AWS account of your choice, there's also a command to destroy the infrastructure off your AWS
account. Lastly we provide a management UI built with shadcn/tailwind you can modify based on
your requirements</p>
</div>
<div id="case-2">
<h4>2. What are webhooks?</h4>
<p>
Webhooks are a mechanism for automating the flow of information between web applications in
real-time. They allow one application to send data to another in a push-based manner, triggering
events and enabling real-time communication. Webhooks are commonly used in scenarios where
immediate or near real-time updates are required, such as in notifications, integrations, and
automation workflows.
</p>
</div>
<div id="case-2-1">
<h4 class="sub">2.1. Alternatives to webhooks</h4>
<p>Webhoooks are not the only approach to real-time communication in software applications. There
are alternatice technologies and patterns that serve similar purposes. One of the major
differences between webhooks and other types of real real-time communication types is that
webhooks are omni-directional. This section outlines a
few of them:</p>
<ul>
<li style="list-style-type:decimal;"><b style="font-weight: 700; font-size: 1.1rem">
Web-Sockets:
</b>
Web Sockets provide full-duplex communication channels over a single, long-lived connection.
They are designed for real-time bidirectional communication, making them suitable for
applications requiring low-latency updates. Some of the use cases include: real-time chat
applications, live updated, collaborative editing.
</li>
<li style="list-style-type:decimal;"><b style="font-weight: 700; font-size: 1.1rem">
Polling:
</b>
Polling involves regularly checking a server for updates. Clients make periodic requeses to
the server, asking if there are any new events or data. Long polling is a variant where the
server holds the request open until new data is available.
</li>
<li style="list-style-type:decimal;"><b style="font-weight: 700; font-size: 1.1rem">
Server Side Events:
</b>
SSE is a simple and efficient mechanism for sending updates from a server to a client over a
single HTTP connection. It allows servers to push data to web clients over HTTP in
real-time. Some of the use cases include: News feeds, live score updates, stock tickers.
</li>
</ul>
</div>
<div id="case-2-2">
<h4 class="sub">2.2 Examples of webhook services</h4>
<p>
There are a couple services that currently use webhooks on a large scale. A couple of them
include:
</p>
<ul>
<li style="list-style-type:decimal;"><b style="font-weight: 700; font-size: 1.1rem">
Github Webhooks:
</b>
Github provides webhooks to notify external systems about events in a repository. For
example, you can set up a webhooks to receive notifications about new commits, pull
requests, or issues.
<p>This was the major inspiration behind webplug. I made use of github webhooks when setting
up
a CI/CD pipeline with AWS Codebuild and AWS Codepipeline and started to brainstorm on
how I
could abstract the functionality into a stand alone service.</p>
</li>
<li style="list-style-type:decimal;"><b style="font-weight: 700; font-size: 1.1rem">
Stripe Webhooks:
</b>
Stripe, a payment processing platform, uses webhooks to notify merchants about events
related to payments, subscriptions, and customer actions. This allows businesses to take
immediate actions based on payment events.
</li>
<li style="list-style-type:decimal;"><b style="font-weight: 700; font-size: 1.1rem">
Twilio Webhooks:
</b>
Twilio, a cloud communications platform, offers webhooks to handle events related to phone
calls, SMS messages, and other communication activities.
</li>
</ul>
</div>
<div id="case-3">
<h4>3. Webplug Architecture</h4>
</div>
<div id="case-3-1">
<h4 class="sub">3.1 Architecture diagram</h4>
<img src="./images/header.webp" width="100%" height="350rem" />
</div>
<div id="case-3-2">
<h4 class="sub">3.2 Webplug stack</h4>
<p>
This section outlines all the technologies employed to bring webplug to life.
</p>
<ul>
<li style="list-style-type:decimal;">
<b style="font-weight: 700; font-size: 1.1rem">AWS API Gateway</b>: Provides a unified API
for the client to interact with the backend service. Handles requests through the lambda
functions.
</li>
<li style="list-style-type:decimal;">
<b style="font-weight: 700; font-size: 1.1rem">AWS Simple Notification Service</b>: This is
a fully managed messaging service from AWS. SNS was used to subscribe a new event type as a
topic and then whenever a message is published, it would get sent to all subscribers of that
topic.
</li>
<li style="list-style-type:decimal;">
<b style="font-weight: 700; font-size: 1.1rem">AWS Lambda functions</b>: These were used to
handle the several api routes used in the
application.
</li>
<li style="list-style-type:decimal;">
<b style="font-weight: 700; font-size: 1.1rem">AWS Lambda layers</b>: Lambda layer was used
to initiate the pg pool connection and all lambda functions reference the connection.
</li>
<li style="list-style-type:decimal;">
<b style="font-weight: 700; font-size: 1.1rem">Cloudwatch Logs</b>: SNS was configured to
send the result of the message delivery to the cloudwatch logs of the log lambda. Whenever a
new message result is received, the status is updated in the database.
</li>
<li style="list-style-type:decimal;">
<b style="font-weight: 700; font-size: 1.1rem">AWS CDK</b>: AWS CDK was used to deploy the
webplug infrastructure to AWS.
</li>
<li style="list-style-type:decimal;">
<b style="font-weight: 700; font-size: 1.1rem">Shadcn/tailwind</b>: Shadcn/tailwind were
used to develop components and style the management UI.
</li>
</ul>
</div>
<div id="case-4">
<h4>4. How does Webplug work?</h4>
<p>This session explains everything that happens from client to server side communication.</p>
<p>Webplug mainly makes use of SNS to manage message delivery. The reason for this choice is because
SNS can fanout messages to multiple subscribers and also automatically handles message delivery
retries.
</p>
<p>The steps involved in the process flow include:</p>
<ul>
<li>
A new service is created
</li>
<li>
A user is created and registered under the service
</li>
<li>
Event types are created for the service. Whenever there is a request to create a new event
type, we create an SNS topic to represent the event type.
</li>
<li>
A user subscribes specific endpoints to particular event types. We retreive the SNS topic
for the event type and create a new subscription with the endpoint.
</li>
<li>
SNS sends a confirm subscription payload to the endpoint, you would need to copy the
subscribe url and paste in a new tab to confirm the subscription so that future messages
would be delivered.
</li>
<li>
Whenever a new message is published for that event type, SNS would automatically send the
message to all subscribers (endpoints) of that topic (event type).
</li>
</ul>
</div>
<div id="case-5">
<h4>5. Webplug JS Client</h4>
<p>A JS client was built to expose methods to communicate with the various modules. This includes
methods for the service, users, subscriptions, event types and events module.</p>
<p>The webplug JS client is installable from npm as shown in the <a
href="https://temporal-stork-160.notion.site/Webplug-Documentation-2a208d2620864246a6494fb36cfe6dbe?pvs=4"
target="_blank">documentation</a></p>
</div>
<div id="case-6">
<h4>6. Webplug CLI app</h4>
<p>A cli app was built to deploy and destroy the infrastructure on your AWS account as well as spin
up the management UI.
Information on how to install and use the cli app is specified in the <a
href="https://temporal-stork-160.notion.site/Webplug-Documentation-2a208d2620864246a6494fb36cfe6dbe?pvs=4"
target="_blank">documentation</a>.</p>
<p>The steps involved in deploying the infrastructure is as follows:</p>
<ul>
<li>
The cdk code is cloned from the github repository
</li>
<li>
The code for the management UI is cloned from the github repository
</li>
<li>
The code for the lambda functions is cloned from the github repository
</li>
<li>
When the deploy command is run, cdk references the lambda functions from the server
directory which is where the cloned lambda functions are saved. Once the deployment is
completed, cdk writes the api gateway url and api key id which can be used to retreive the
api key itself to the outputs.json file. These variables are then saved to the .env file in
the management UI codebase.
</li>
<li>
The code for the management UI is cloned from the github repository
</li>
</div>
<div id="case-7">
<h4>7. Webplug management UI</h4>
<p>The management dashboard provides a UI to manage all your services, users, event types,
subscriptions and view statuses of all messages sent to different subscribers (endpoints). Check
out the <a
href="https://temporal-stork-160.notion.site/Webplug-Documentation-2a208d2620864246a6494fb36cfe6dbe?pvs=4"
target="_blank">documentation</a> for how to access the management UI.</p>
<div style="margin-bottom: 3rem">
<img src="images/services.png" alt="View services for webplug infra" width="100%"
style="margin-bottom: .5rem" />
<sub style="font-size: .85rem;">View information about the services in the webplug
infrastructure.</sub>
</div>
<div style="margin-bottom: 3rem">
<img src="images/users.png" alt="Create a new user and view users of a service" width="100%"
style="margin-bottom: .5rem" />
<sub style="font-size: .85rem;">Create a new user and view users of a service.</sub>
</div>
<div style="margin-bottom: 3rem">
<img src="images/event_type.png" alt="View event types of a service" width="100%"
style="margin-bottom: .5rem" />
<sub style="font-size: .85rem;">Create a new event type or view event types for a service.</sub>
</div>
<div style="margin-bottom: 3rem">
<img src="images/subscription.png" alt="View subscriptions for a user" width="100%"
style="margin-bottom: .5rem" />
<sub style="font-size: .85rem;">View subscriptions for a user.</sub>
</div>
<div style="margin-bottom: 3rem">
<img src="images/messages.png" alt="View messages sent to subscribers for all users"
width="100%" style="margin-bottom: .5rem" />
<sub style="font-size: .85rem;">View messages sent to subscribers for all users.</sub>
</div>
</div>
<div id="case-8">
<h4>8. Future Considerations</h4>
<p>These are some of the future work that can be implemented</p>
<ul>
<li>Give users the ability to rate limit their webhook endpoints.</li>
<li>Implement functionality to manually trigger message retries after SNS fails to deliver the
message after the maximum number of retries.</li>
<li>Ensure orderly delivery of messages depending on the time they are created.</li>
<li>Dead letter queue to hold messages that fail to be processed.</li>
</ul>
</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</section>
<section id="team">
<div>
<h3>Author</h3>
<h4>I am currently exploring full-stack, devops and cloud engineering roles. If you like what you see or
are interested in knowing more, please reach out!</h4>
<div class="cards">
<div class="card">
<img alt="Author pic" src="./images/author.jpg" />
<h4>David Ajayi</h4>
<p>Lagos, Nigeria.</p>
<div class="socials">
<a href="https://github.com/thatjsprof" target="_blank"><i
class="fa-brands fa-github fa-2x"></i></a>
<a href="https://davidajayi.vercel.app/" target="_blank"><i
class="fa-solid fa-globe fa-2x"></i></a>
<a href="https://www.linkedin.com/in/ajayi-davetech/" target="_blank"><i
class="fa-brands fa-linkedin-in fa-2x"></i></a>
</div>
</div>
</div>
</div>
</section>
</main>
<footer>
<div class="container">
© 2023 Webhooks Plug Infra | All rights reserved
</div>
</footer>
<div id="snackbar">Text copied to clipboard</div>
<script src="https://kit.fontawesome.com/64857b4e9e.js" crossorigin="anonymous"></script>
<script src="./javascript/script.js"></script>
</body>
</html>