2025-11-11 22:16:48 +01:00

21 KiB

theme, background, title, class, drawings, transition, mdc
theme background title class drawings transition mdc
default assets/galaxy.jpg Datastar text-center
persist
false
slide-left true

To The Stars with Datastar

An interstellar journey


background: assets/galaxy.jpg

Drake Formular

$$ {1|2|3|4|5|6|7|all} \begin{aligned} N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \ R_* &= \text{rate of star formation} \ f_p &= \text{fraction of stars with planets} \ n_e &= \text{number of habitable planets per star} \ f_l &= \text{fraction where life develops} \ f_i &= \text{fraction where intelligent life evolves} \ f_c &= \text{fraction that develops detectable technology} \ L &= \text{length of time civilizations are detectable} \end{aligned}



</div>

---
class: text-center
---

<h2 v-click class="absolute top-4 left-1/2 -translate-x-1/2">The "Drake" Formular of Webtechnologies</h2>

<div class="mt-20">

$$ {1|all}
\begin{aligned}
N_w &= D_b \cdot L_b \cdot F_b \cdot P_t \cdot F_f \cdot S_m \cdot C_{ss} \cdot C_l \cdot H_p  \\
\\
N_w &= \text{Total Possible Tech Stacks} \\
D_b &= \text{databases (PostgreSQL, MongoDB, MySQL...)} \\
L_b &= \text{backend languages (Javascript, Python, Go...)} \\
F_b &= \text{backend frameworks (Express, Django, FastAPI...)} \\
P_t &= \text{transport protocols (REST, GraphQL, gRPC...)} \\
F_f &= \text{frontend frameworks (React, Vue, Svelte...)} \\
S_m &= \text{state management (Redux, Zustand, Pinia...)} \\
C_{ss} &= \text{CSS frameworks (Tailwind, UnoCSS, Bootstrap...)} \\
C_l &= \text{component libraries (shadcn, MUI, Ant Design...)} \\
H_p &= \text{hosting platforms (Vercel, AWS, VPS...)} \\
\end{aligned}
--- class: default ---

The Space of Webtechnologies

 
\begin{aligned}
N_w &= ( D_b ,  L_b , F_b , P_t , F_f , S_m , C_{ss} , C_l , H_p )  \\
\\
\end{aligned}
  • Every website or web application is one star in this space.
  • There are many combinations that work well. While others no so much.
  • We all plot our path in this space. And have our current home there.
  • There are clusters in this space, i.e. the React-Cluster, oder Angular or Vue.
  • My current home is in the L-O-B with Go and Vue vicinity.
  • There is an old Cluster called Hypermedia. Where all Webapps once lived.
  • Hypermedia has developed a new bulge called HTMX.
  • Next to it is a new tiny blob, called Datastar.

class: text-center

My name is

Thomas Hedeler

A holistic developer


class: default transition: fade-out

How did I find Datastar? What is my motivation?

Finding my combination of web technologies for a minimal viable web application.

  • Part 1: The Database: SQLite
  • Part 2: The No-ORM ORM - A very simple Data Abstraction Layer.
  • Part 3: Developing a Web Server Application in Go.
  • Part 4: Datastar - a lightweight framework for real-time collaborative web apps.
  • Part 5: Modern CSS.
  • Part 6: Web components.
  • Part 7: Simple Deployments with a VPS, Nginx, Certbot and a single binary file.

class: default transition: fade-out

Part 1: SQLite:

It is fast, feature complete* and rock solid.

It is not SQ-Lite, it is SQL-ite

Since everybody knows SQLite, today just a few highlights:

  • It has JSON and JSONB as built-in data types.
  • It has 29 new functions to extract from JSON or to create JSON objects.
  • It's CTEs make SQL Turing complete.
  • The SQLite CLI can be used to execute "SQL-scripts". See demo.
* from my pov and for my needs and purposes
--- class: default transition: fade-out ---

Part 2: A very simple Data Abstraction Layer:

Features:

  • Simplified Database Lifecycle Management.
  • Generic Data Handling.
  • High-Level CRUD Operations.
  • Fluent Transaction API.
  • Abstraction and Safety.
  • Utility Functions.
--- class: default transition: fade-out ---

Part 3: Developing a Web Server Application in Go.

Why Go?

  • Go is a compiled language that generates native machine code.
  • Go's core strength is its built-in, lightweight concurrency model using goroutines and channels.
  • Go has a small, well-defined specification and a deliberately simple syntax.
  • The standard library is comprehensive, especially for web development.
  • Go compiles into a single, static binary with no external dependencies.
  • Go is simple, just 25 reserved words in the language.
  • Can embed the database engine (modernc/sqlite)
  • Can serve static code from embeded folders and files.
  • Can embed other resources, like sql files or template files.
  • Has a built-in templating engine.

layout: quote transition: fade-out

Part 4: Datastar

Quote Gillian Delany: 

The problem is Datastar is actually a backend agnostic backend framework with a 10 Kb shim. There has never been anything like it in practice. So it is hard to explain.


class: default

Term-Soup:

ADR, core+plugins, Signals, Ideomorph, Core-Engine, Plug-ins, SSE, You have to control the backend, Templating, HTMX, Hypermedia, Hateoas, Locality of behaviour, Declarative vs. Imperative, DS conforms strictly to the web's specs.


class: default

HTTP - Protocol

POST https://api.example.com/api/users/search?page=2&limit=10 HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
Cookie: sessionId=abc123; theme=dark
Content-Length: 89
{
body: data for the search request
}

class: default

Reducing the Network to a Remote Procedure Call

{
    const { data, error } = await to(fetch("https://api.example.com/api/board"));
    if (error) {
      // handle error
      return;
    }
    // handle data
}
{
    const { data, error } = await to(fetch("https://api.example.com/api/users/12"));
    if (error) {
      // handle error
      return;
    }
    // handle data
}

// the function that "unwraps" the promise:
export function to(promise: Promise<Response>) {
  return promise
    .then((response) => response.json())
    .then((data) => ({ data, error: null }))
    .catch((error) => ({ data: null, error }));
}


class: default

Learn Some Templating System:

Concept Example Meaning
Interpolation {{ name }} Insert value of name
Loop {% for item in items %}...{% endfor %} Repeat block for each item
Condition {% if logged_in %}Welcome{% endif %} Conditional rendering
Include {% include 'header.html' %} Reuse a subtemplate
Escaping {{{ raw_html }}} or {{& raw_html}} Control HTML escaping

class: default

Templating and Hypermedia:

Templating Hypermedia as the Engine of Application State
Input Data Data + available transitions
Output Document (HTML) Document representing a state with actions
Function Bind data to structure Bind state transitions to structure
Goal Present information Drive navigation and state evolution
Mechanism Placeholder substitution Link/form embedding
Example {{.Title}} → “Article” <a href="{{.Links.Edit}}">Edit</a>

transition: slide-up level: 2

Navigation

Hover on the bottom-left corner to see the navigation's controls panel, learn more

Keyboard Shortcuts

right / space next animation or slide
left / shiftspace previous animation or slide
up previous slide
down next slide

Here!


layout: two-cols layoutClass: gap-16

Table of contents

You can use the Toc component to generate a table of contents for your slides:

<Toc minDepth="1" maxDepth="1" />

The title will be inferred from your slide content, or you can override it with title and level in your frontmatter.

::right::


layout: image-right image: https://cover.sli.dev

Code

Use code snippets and get the highlighting directly, and even types hover!

// TwoSlash enables TypeScript hover information
// and errors in markdown code blocks
// More at https://shiki.style/packages/twoslash
import { computed, ref } from 'vue'

const count = ref(0)
const doubled = computed(() => count.value * 2)

doubled.value = 2

<<< @/snippets/external.ts#snippet

Learn more


level: 2

Shiki Magic Move

Powered by shiki-magic-move, Slidev supports animations across multiple code snippets.

Add multiple code blocks and wrap them with ````md magic-move (four backticks) to enable the magic move. For example:

```ts {*|2|*}
// step 1
const author = reactive({
  name: 'John Doe',
  books: [
    'Vue 2 - Advanced Guide',
    'Vue 3 - Basic Guide',
    'Vue 4 - The Mystery'
  ]
})
```

```ts {*|1-2|3-4|3-4,8}
// step 2
export default {
  data() {
    return {
      author: {
        name: 'John Doe',
        books: [
          'Vue 2 - Advanced Guide',
          'Vue 3 - Basic Guide',
          'Vue 4 - The Mystery'
        ]
      }
    }
  }
}
```

```ts
// step 3
export default {
  data: () => ({
    author: {
      name: 'John Doe',
      books: [
        'Vue 2 - Advanced Guide',
        'Vue 3 - Basic Guide',
        'Vue 4 - The Mystery'
      ]
    }
  })
}
```

Non-code blocks are ignored.

```vue
<!-- step 4 -->
<script setup>
const author = {
  name: 'John Doe',
  books: [
    'Vue 2 - Advanced Guide',
    'Vue 3 - Basic Guide',
    'Vue 4 - The Mystery'
  ]
}
</script>
```

Components

You can use Vue components directly inside your slides.

We have provided a few built-in components like <Tweet/> and <Youtube/> that you can use directly. And adding your custom components is also super easy.

<Counter :count="10" />

Check out the guides for more.

<Tweet id="1390115482657726468" />

class: px-20

Themes

Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switching between themes by just one edit in your frontmatter:

---
theme: default
---
---
theme: seriph
---

Read more about How to use a theme and check out the Awesome Themes Gallery.


Clicks Animations

You can add v-click to elements to add a click animation.

This shows up when you click the slide:

<div v-click>This shows up when you click the slide.</div>

The v-mark directive also allows you to add inline marks , powered by Rough Notation:

<span v-mark.underline.orange>inline markers</span>
---

HTTP - Protocol

POST https://api.example.com/api/users/search?page=2&limit=10 HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
Cookie: sessionId=abc123; theme=dark
Content-Length: 89
{
body: data for the search request
}

Reducing the Network to a Remote Procedure Call

{
    const { data, error } = await to(fetch("https://api.example.com/api/users/11"));
    if (error) {
      // handle error
      return;
    }
    // handle data
}


// the function that "unwraps" the promise:
export function to(promise: Promise<Response>) {
  return promise
    .then((response) => response.json())
    .then((data) => ({ data, error: null }))
    .catch((error) => ({ data: null, error }));
}


LaTeX

LaTeX is supported out-of-box. Powered by KaTeX.

Inline \sqrt{3x-1}+(1+x)^2

Block $$ {1|3|all} \begin{aligned} \nabla \cdot \vec{E} &= \frac{\rho}{\varepsilon_0} \ \nabla \cdot \vec{B} &= 0 \ \nabla \times \vec{E} &= -\frac{\partial\vec{B}}{\partial t} \ \nabla \times \vec{B} &= \mu_0\vec{J} + \mu_0\varepsilon_0\frac{\partial\vec{E}}{\partial t} \end{aligned}


---



$$ {1|2|3|4|5|6|7|all}
\begin{aligned}
N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \\
R_* &= \text{rate of star formation} \\
f_p &= \text{fraction of stars with planets} \\
n_e &= \text{number of habitable planets per star} \\
f_l &= \text{fraction where life develops} \\
f_i &= \text{fraction where intelligent life evolves} \\
f_c &= \text{fraction that develops detectable technology} \\
L &= \text{length of time civilizations are detectable}
\end{aligned}

Drake Formular


Drake Formular

$$ {1|2|3|4|5|6|7|all} \begin{aligned} N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \ R_* &= \text{rate of star formation} \ f_p &= \text{fraction of stars with planets} \ n_e &= \text{number of habitable planets per star} \ f_l &= \text{fraction where life develops} \ f_i &= \text{fraction where intelligent life evolves} \ f_c &= \text{fraction that develops detectable technology} \ L &= \text{length of time civilizations are detectable} \end{aligned}



</div>
---
class: text-center
---
## The "Drake" Formular of Webtechnologies

$$ {1|all|1}
\begin{aligned}
N_w &= D_b \cdot L_b \cdot F_b \cdot P_t \cdot F_f \cdot S_m \cdot C_{ss} \cdot C_l \cdot H_p  \\
\\
N_w &= \text{Total Possible Tech Stacks} \\
D_b &= \text{databases (PostgreSQL, MongoDB, MySQL...)} \\
L_b &= \text{backend languages (Javascript, Python, Go...)} \\
F_b &= \text{backend frameworks (Express, Django, FastAPI...)} \\
P_t &= \text{transport protocols (REST, GraphQL, gRPC...)} \\
F_f &= \text{frontend frameworks (React, Vue, Svelte...)} \\
S_m &= \text{state management (Redux, Zustand, Pinia...)} \\
C_{ss} &= \text{CSS frameworks (Tailwind, UnoCSS, Bootstrap...)} \\
C_l &= \text{component libraries (shadcn, MUI, Ant Design...)} \\
H_p &= \text{hosting platforms (Vercel, AWS, VPS...)} \\
\end{aligned}

Diagrams

You can create diagrams / graphs from textual descriptions, directly in your Markdown.

sequenceDiagram
    Alice->John: Hello John, how are you?
    Note over Alice,John: A typical interaction
graph TD
B[Text] --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
mindmap
  root((mindmap))
    Origins
      Long history
      ::icon(fa fa-book)
      Popularisation
        British popular psychology author Tony Buzan
    Research
      On effectiveness<br/>and features
      On Automatic creation
        Uses
            Creative techniques
            Strategic planning
            Argument mapping
    Tools
      Pen and paper
      Mermaid
@startuml

package "Some Group" {
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  FTP - [Second Component]
  [First Component] --> FTP
}

cloud {
  [Example 1]
}

database "MySql" {
  folder "This is my folder" {
    [Folder 3]
  }
  frame "Foo" {
    [Frame 4]
  }
}

[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]

@enduml

Learn more: Mermaid Diagrams and PlantUML Diagrams

class: text-center

The Journey

In the beginning, there was chaos...

But then a hero emerged!

And everything changed.


foo: bar dragPos: square: 691,32,167,_,-16

Draggable Elements

Double-click on the draggable elements to edit their positions.


Directive Usage
<img v-drag="'square'" src="https://sli.dev/logo.png">

Component Usage
<v-drag text-3xl>
  <div class="i-carbon:arrow-up" />
  Use the `v-drag` component to have a draggable container!
</v-drag>
Double-click me!
Draggable Arrow
<v-drag-arrow two-way />

src: ./pages/imported-slides.md hide: false


Monaco Editor

Slidev provides built-in Monaco Editor support.

Add {monaco} to the code block to turn it into an editor:

import { ref } from 'vue'
import { emptyArray } from './external'

const arr = ref(emptyArray(10))

Use {monaco-run} to create an editor that can execute the code directly in the slide:

import { version } from 'vue'
import { emptyArray, sayHello } from './external'

sayHello()
console.log(`vue ${version}`)
console.log(emptyArray<number>(10).reduce(fib => [...fib, fib.at(-1)! + fib.at(-2)!], [1, 1]))

layout: center class: text-center

Learn More

Documentation · GitHub · Showcases