This repository was archived by the owner on Aug 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpresentation.html
More file actions
306 lines (304 loc) · 9.59 KB
/
Copy pathpresentation.html
File metadata and controls
306 lines (304 loc) · 9.59 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Newt -- presentation</title>
<link rel="stylesheet" href="https://caltechlibrary.github.io/css/site.css">
<base href="./">
</head>
<body>
<header>
<a href="https://library.caltech.edu"><img src="https://caltechlibrary.github.io/assets/liblogo.gif" alt="Caltech Library logo"></a>
</header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="./">README</a></li>
<li><a href="user_manual.html">User Manual</a></li>
<li><a href="LICENSE">LICENSE</a></li>
<li><a href="INSTALL.html">INSTALL</a></li>
<li><a href="about.html">About</a></li>
<li><a href="search.html">Search</a></li>
<li><a href="https://github.com/caltechlibrary/newt">GitHub</a></li>
</ul>
</nav>
<section>
<h1 id="the-experiment">The experiment</h1>
<p>How do we make building web applications for Libraries, Archives and
Museums simpler?</p>
<h1 id="focus-on-three-abstractions">Focus on three abstractions</h1>
<ul>
<li>A JSON source for managing data => <a
href="https://postgresql.org">Postgres</a> + <a
href="https://postgrest.org">PostgREST</a></li>
<li>A template engine => <a href="https://pandoc.org">Pandoc</a></li>
<li>A data router and form validator => <a
href="https://github.com/caltechlibrary/newt/">Newt</a></li>
</ul>
<h1 id="three-implementations-a-bird-sighting-website">Three
implementations a bird sighting website</h1>
<ol type="1">
<li>static site derived from CSV data file
<ul>
<li>(CSV file holds our sighting list)</li>
</ul></li>
<li>dynamic, SQL and browser JavaScript
<ul>
<li>(bird sighting list held in SQL database)</li>
</ul></li>
<li>dynamic, SQL and no browser JavaScript
<ul>
<li>(bird sighting list held in SQL database)</li>
</ul></li>
</ol>
<p>What are trade-offs?</p>
<h1 id="birds-version-1-static-site-pandoc"><a
href="https://github.com/caltechlibrary/newt/tree/main/demos/birds1">birds
version 1</a>, static site, Pandoc</h1>
<p>CSV file, Pandoc, 2 directories, 5 files, <strong>75 total line
count</strong>, static site</p>
<table>
<thead>
<tr>
<th style="text-align: left;">Lines</th>
<th style="text-align: left;">Files</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">26</td>
<td style="text-align: left;">README.md</td>
</tr>
<tr>
<td style="text-align: left;">4</td>
<td style="text-align: left;">birds.csv <– this is used in each of
the demos</td>
</tr>
<tr>
<td style="text-align: left;">6</td>
<td style="text-align: left;">build.sh</td>
</tr>
<tr>
<td style="text-align: left;">7</td>
<td style="text-align: left;">page.tmpl</td>
</tr>
<tr>
<td style="text-align: left;">32</td>
<td style="text-align: left;">htdocs/index.html</td>
</tr>
</tbody>
</table>
<h1 id="birds-version-2-dynamic-site-browser-javascript"><a
href="https://github.com/caltechlibrary/newt/tree/main/demos/birds2">birds
version 2</a>, dynamic site, browser JavaScript</h1>
<p>SQL (Postgres + PostgREST), Browser JavaScript, 2 directories, 8
files, <strong>232 total line count</strong>, dynamic site</p>
<table>
<thead>
<tr>
<th style="text-align: left;">Lines</th>
<th style="text-align: left;">Files</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">29</td>
<td style="text-align: left;">README.md</td>
</tr>
<tr>
<td style="text-align: left;">4</td>
<td style="text-align: left;">birds.csv <– from birds1</td>
</tr>
<tr>
<td style="text-align: left;">34</td>
<td style="text-align: left;">setup.sql</td>
</tr>
<tr>
<td style="text-align: left;">60</td>
<td style="text-align: left;">models.sql <– implements our data
models</td>
</tr>
<tr>
<td style="text-align: left;">15</td>
<td style="text-align: left;">models_test.sql</td>
</tr>
<tr>
<td style="text-align: left;">3</td>
<td style="text-align: left;">postgrest.conf</td>
</tr>
<tr>
<td style="text-align: left;">24</td>
<td style="text-align: left;">htdocs/index.html <– hand coded</td>
</tr>
<tr>
<td style="text-align: left;">63</td>
<td style="text-align: left;">htdocs/sightings.js <– hand coded</td>
</tr>
</tbody>
</table>
<h1 id="birds-version-3-dynamic-site-no-browser-javascript"><a
href="https://github.com/caltechlibrary/newt/tree/main/demos/birds3">birds
version 3</a>, dynamic site, no browser JavaScript</h1>
<p>SQL (Postgres + PostgREST), Pandoc, Newt, 1 directory, 9 files,
<strong>225 total line count</strong>, dynamic site</p>
<table>
<thead>
<tr>
<th style="text-align: left;">Lines</th>
<th style="text-align: left;">Files</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">43</td>
<td style="text-align: left;">README.md</td>
</tr>
<tr>
<td style="text-align: left;">4</td>
<td style="text-align: left;">birds.csv <– from birds1</td>
</tr>
<tr>
<td style="text-align: left;">34</td>
<td style="text-align: left;">setup.sql <– from birds2</td>
</tr>
<tr>
<td style="text-align: left;">60</td>
<td style="text-align: left;">models.sql <– from birds2</td>
</tr>
<tr>
<td style="text-align: left;">15</td>
<td style="text-align: left;">models_test.sql <– from birds2</td>
</tr>
<tr>
<td style="text-align: left;">3</td>
<td style="text-align: left;">postgrest.conf <– from birds2</td>
</tr>
<tr>
<td style="text-align: left;">23</td>
<td style="text-align: left;">birds.yaml</td>
</tr>
<tr>
<td style="text-align: left;">36</td>
<td style="text-align: left;">page.tmpl</td>
</tr>
<tr>
<td style="text-align: left;">7</td>
<td style="text-align: left;">post_result.tmpl</td>
</tr>
</tbody>
</table>
<h1 id="insights-from-experiment">Insights from experiment</h1>
<ul>
<li>A few “Off the shelf” microservices can make application
construction easier</li>
<li>Orchestrating the data pipeline in YAML is reasonable</li>
<li>SQL turns some people off
<ul>
<li>models could be bootstrapped from Newt’s YAML</li>
</ul></li>
<li>Pandoc templates are simple to learn and well documented at <a
href="https://pandoc.org">pandoc.org</a></li>
<li>Newt stack plays well with HTML5 and front-end best practices</li>
<li>I encountered an unexpected result …</li>
</ul>
<h1 id="an-unexpected-result">An unexpected result</h1>
<ul>
<li>Newt like PostgREST and Pandoc <strong>do not require</strong>
shared synchronous state</li>
<li>Postgres can be deployed in a <a href="High-availability"
title="high available cluster">HA cluster</a></li>
</ul>
<blockquote>
<p>The Newt stack can scale really big</p>
</blockquote>
<h1 id="newt-has-weaknesses">Newt has weaknesses</h1>
<ul>
<li>Newt is <strong>an experimental prototype</strong> (June/July 2023,
six weeks old)</li>
<li>Newt doesn’t support file uploads</li>
</ul>
<h1 id="newt-stack-has-strengths">Newt stack has strengths</h1>
<blockquote>
<p>A very mature foundation</p>
</blockquote>
<ul>
<li>20th Century tech
<ul>
<li>SQL (1974), HTTP (1991), HTML (1993), Postgres (1996)</li>
</ul></li>
<li>21st Century tech
<ul>
<li>JSON (2001), YAML (2001), Pandoc (2006), PostgREST (2014)</li>
</ul></li>
</ul>
<h1 id="next-steps-for-newt">Next steps for Newt?</h1>
<ol type="1">
<li>Test with Solr/Elasticsearch as alternate JSON sources</li>
<li>Build staff facing applications this Summer (2023)</li>
<li>Explore generating PostgREST configuration/SQL Models from Newt’s
YAML</li>
<li>(hopefully) move beyond my proof of concept in Fall/Winter
(2023)</li>
</ol>
<h1 id="newts-someday-maybe">Newt’s someday, maybe …</h1>
<ul>
<li>Have Newt delegate file uploads to an S3 like service
<ul>
<li>One approach would be Minio using file streams</li>
</ul></li>
<li>Explore integrating SQLite3 support as a JSON data source</li>
<li>Consider implementing Newt in Haskell for richer Pandoc
integration</li>
<li>A Newt community to share YAML, SQL and Pandoc templates</li>
</ul>
<h1 id="related-resources">Related resources</h1>
<ul>
<li>Newt <a href="https://github.com/caltechlibrary/newt"
class="uri">https://github.com/caltechlibrary/newt</a></li>
<li>Postgres <a href="https://postgres.org"
class="uri">https://postgres.org</a> + PostgREST <a
href="https://postgrest.org" class="uri">https://postgrest.org</a>
<ul>
<li>PostgREST Community Tutorials <a
href="https://postgrest.org/en/stable/ecosystem.html"
class="uri">https://postgrest.org/en/stable/ecosystem.html</a></li>
</ul></li>
<li>Pandoc <a href="https://pandoc.org"
class="uri">https://pandoc.org</a>
<ul>
<li>Templates <a href="https://pandoc.org/MANUAL.html#templates"
class="uri">https://pandoc.org/MANUAL.html#templates</a></li>
<li>Pandoc Server <a href="https://pandoc.org/pandoc-server.html"
class="uri">https://pandoc.org/pandoc-server.html</a></li>
</ul></li>
<li>Compiling Pandoc or PostgREST requires Haskell
<ul>
<li>Install Haskell GHCup <a href="https://www.haskell.org/ghcup/"
class="uri">https://www.haskell.org/ghcup/</a></li>
<li><a
href="https://rsdoiel.github.io/blog/2023/07/05/quick-recipe-compiling-PostgREST-M1.html">Quick
recipe, Compile PostgREST (M1)</a></li>
<li><a
href="https://rsdoiel.github.io/blog/2023/07/05/quick-recipe-compiling-Pandoc-M1.html">Quick
recipe, Compiling Pandoc (M1)</a></li>
</ul></li>
</ul>
<h1 id="thank-you">Thank you!</h1>
<ul>
<li>This Presentation <a
href="https://caltechlibrary.github.io/newt/presentation/"
class="uri">https://caltechlibrary.github.io/newt/presentation/</a></li>
<li>Project: <a href="https://github.com/caltechlibrary/newt"
class="uri">https://github.com/caltechlibrary/newt</a></li>
<li>Email: rsdoiel@caltech.edu</li>
</ul>
</section>
<footer>
<span><h1><A href="http://caltech.edu">Caltech</a></h1></span>
<span>© 2024 <a href="https://www.library.caltech.edu/copyright">Caltech library</a></span>
<address>1200 E California Blvd, Mail Code 1-32, Pasadena, CA 91125-3200</address>
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span>
<span><a href="mailto:library@caltech.edu">Email Us</a></span>
<a class="cl-hide" href="sitemap.xml">Site Map</a>
</footer>
</body>
</html>