Skip to content

Commit 7e31b11

Browse files
committed
Add a "Collaborative Clicker + SSR" tutorial to the docs.
1 parent cf85a53 commit 7e31b11

File tree

6 files changed

+456
-19
lines changed

6 files changed

+456
-19
lines changed

docs/astro.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export default defineConfig({
4747
label: "Data CLI",
4848
slug: "getting-started/first-cli-app",
4949
},
50+
{
51+
label: "Realtime Sync & SSR",
52+
slug: "getting-started/first-realtime-app",
53+
},
5054
],
5155
},
5256
{

docs/src/content/docs/getting-started/first-cli-app.mdx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: A CLI App
2+
title: A Movie Data CLI App
33
---
44

55
import { 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

1212
In 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
1414
project, we will also offer an alternative path to bootstrapping the database
1515
using the vanilla `sqlite3` CLI.
1616

@@ -89,7 +89,15 @@ sqlite> SELECT COUNT(*) FROM movies;
8989
1000
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

94102
With TrailBase up and running (`trail run`), the easiest way to explore your
95103
data is go to the admin dashboard under
@@ -134,7 +142,10 @@ the respective movies.
134142
## Writing Data with a Custom CLI
135143

136144
Finally, 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

139150
Let's first create the JSON Schema type definitions from the database schema we
140151
added 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

175186
Thanks 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

181195
Any questions or suggestions? Reach out on GitHub and help us improve the docs.
182196
Thanks!

0 commit comments

Comments
 (0)