11---
2- title : A CLI App
2+ title : A Movie Data CLI App
33---
44
55import { Code } from " @astrojs/starlight/components" ;
@@ -10,7 +10,7 @@ TrailBase and write a simple client CLI application to query the data using
1010* Record APIs* .
1111
1212In an effort to demonstrate TrailBase's loose coupling and the possibility of
13- simply trying out TrailBase with an existing SQLite-based data analysis
13+ simply trying out TrailBase with an existing SQLite-based data-focused
1414project, we will also offer an alternative path to bootstrapping the database
1515using the vanilla ` sqlite3 ` CLI.
1616
@@ -89,7 +89,15 @@ sqlite> SELECT COUNT(*) FROM movies;
89891000
9090```
9191
92- ## Reading the Data
92+ ## API Data Access
93+
94+
95+ <Aside type = " note" title = " Try TrailBase on Existing Datasets" >
96+ Until here - setting up the schema and ingesting data - TrailBase wasn't
97+ strictly needed, which goes to show that you can use TrailBase on
98+ pre-existing SQLite databases. For example, exploring the data using the
99+ dashboard or exposing and querying it using APIs as follows.
100+ </Aside >
93101
94102With TrailBase up and running (` trail run ` ), the easiest way to explore your
95103data is go to the admin dashboard under
@@ -134,7 +142,10 @@ the respective movies.
134142## Writing Data with a Custom CLI
135143
136144Finally, let's authenticate and use privileged APIs to first delete all movies
137- and then add them back using type-safe APIs rather than ` sqlite3 ` .
145+ and then add them back using type-safe APIs rather than ` sqlite3 ` . This
146+ may seem silly at first, however, many uses cases will require more complex
147+ ingestion strategies such as incremental insertion over time, de-duping against
148+ existing records, or access across an auth and process boundary.
138149
139150Let's first create the JSON Schema type definitions from the database schema we
140151added above. Note, that the type definition for creation, reading, and updating
@@ -173,10 +184,13 @@ import fillCode from "@root/examples/data-cli-tutorial/src/fill.ts?raw";
173184## What's Next?
174185
175186Thanks for making it to the end.
176- Beyond the basic example above, the repository contains a more involved Blog
177- example (` /examples/blog ` ) including both, a Web and Flutter UI.
178- The blog example also demonstrates more complex APIs, authorization, custom
179- user profiles, etc.
187+ Beyond the basic example above, the repository contains a more involved examples, such as:
188+
189+ * A [ Blog] ( https://github.com/trailbaseio/trailbase/tree/main/examples/blog )
190+ with both, a Web and Flutter UI, more complex APIs, authorization and custom
191+ user profiles.
192+ * A collaborative clicker "Game" demonstrating server-side rendering (SSR) with
193+ popular JS frameworks and "realtime" updates to synchronize state.
180194
181195Any questions or suggestions? Reach out on GitHub and help us improve the docs.
182196Thanks!
0 commit comments