Databases

Databases

This is a published deck. Feel free look around, review cards, or make changes, but you'll need to clone it to save your progress.
Column View
Improvements to CouchDB
4
Custom DB
2

Replicache

replicache.dev

Initial load

One downside of a local-first approach is that the initial load of an app is often slower than a pure-cloud app.

Blitz.js

A “zero-api” framework. Backend actions can be "imported" and used in the front end. I guess this would be similar to using the same re-frame event in both the front-end and back-end.

RxDB GraphQL replication

The graphql replication works by storing a last updated_at timestamp on the client. The client then sends a request to the server for all documents updated past that timestamp. The same works for pushes from the client to the server.

InvaliDB

Reactive queries

CouchDB access control

Asami

An in-memory graph database, for Clojure and ClojureScript.

Datalevin

Datalevin is a simple durable Datalog database.

Hasura access control

In Hasura access-control rules are defined on the row and column level.

Crux

Crux is a general purpose database with graph-oriented bitemporal indexes. Datalog, SQL & EQL queries are supported, and Java, HTTP & Clojure APIs are provided.

etebase

An end-to-end encrypted open source version of firebase.

hypercore

Hypercore is a secure, distributed append-only log.

Access Control

CouchDB

Caching

Datalog

Automerge

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.

CRDT

Materialized views

A materialized view is a bit like a cached query that, in most cases, needs to be updated manually.

Materialize

Incrementally-updated materialized views - in ANSI Standard SQL and in real time.

Feeding data to components

It is a common pattern in React to create a data "provider" component that wraps a pure component. The impure data provider component grabs its data side band and passes it as props to the pure component.

Relay in CLJS

Sample of a relay-like system for building a query graph from component fragments.

Relay

A "GraphQL client for React." Built by facebook, the key insight of Relay is that is co-locates GraphQL fragments with the components that use them. The component tree is wrapped in a QueryRenderer which combines all of the fragments in the tree into a single GraphQL query.

Data prefetching

This refers to a technique in which application state is pre-fetched server-side and injected into a server-side rendered page. Many frameworks integrate with GraphQL to handle this automatically.

PostgREST

Similar to Hasura, PostgREST is a REST API over top of a Postgres database. It is used by supabase, an open source alternative to firebase.

Hasura

Hasura is a GraphQL API on top of a Postgresql database. It embraces the idea of the client querying the database directly.

CouchDB

CouchDB is a JSON Document store with robust replication capabilities. It is fairly common that each users has their own database when using CouchDB.

PouchDB

PouchDB is a javascript implementation of CouchDB that runs in the browser and node.

Datahike

Datahike is a Datalog databased based on datomic. It has a pluggable storage backend via konserve.

Datomic

re-frame

re-frame uses subscriptions to fetch data from the app-db. Subscriptions are reactive queries depending on their "input signals". The input signal can either be the app-db itself, or another query.

Event reduce

An algorithim that optimizes the re-running of queries based on some mutation event. It is used by rxdb to create reactive queries.

Reactive queries

Queries that can be watched and automatically re-run when the underlying data changes.

RxDB

A reactive database that supports reactive queries.

Datalog

Pathom

In a nutshell: GraphQL, but in Clojure.

GraphQL

Datomic pull syntax

Contrast to Datalog

EQL

EDN Query language is a bit like Datomic pull syntax or GraphQL.
Keyboard shortcuts
Press
?
to toggle this panel.
Markdown formatting
You can format text using markdown.
H1
# Heading 1
H2
## Heading 2
H3
### Heading 3
New Side
---
Shift
Bold
**bold**
Ctrl
b
Italic
_italic_
Ctrl
i
Strikethrough
~~strikethrough~~
Highlight
==highlighted text==
Ctrl
h
Link
[link text](my-site.com)
https://my-site.com
Reference
[[card title|id]]
[[id]]
[[id:embed]]
@
Media
![title](Media URL)
Ctrl
o
List
- list item
Ctrl
.
Ordered List
1. list item
Quote
> quote
Definition List
term
: definition
Ctrl
d
Hidden text
{{text}}
Ctrl
Shift
l
Hidden text group
{{1::text}}
Ctrl
1
...
9
Code
`code`
Code Fence
```clj
(defn foo)
```
Ctrl
Shift
f
Inline Latex
$\LaTeX$
Display Latex
$$
\LaTeX
$$
Superscript
20^th^
Subscript
H~2~0
Ruby characters
{振り仮名}(ふがな)
Tag
#my-new-tag
Editor
These shortcuts are usable within the editor.
Save and exit
Ctrl
Enter
Exit without saving
Esc
Open reference
Ctrl
Click
New card (from selection)
Ctrl
n
Deck page
These shortcuts are usable on the deck page.
Add a card
n
Review cards that are due
r
Learn new cards
l
List view (select mode)
Shortcuts to move around, select, and edit cards on the list view.
Move selection
j
k
Move card up
Ctrl
k
/
Ctrl
Move card down
Ctrl
j
/
Ctrl
Cancel selection
Esc
Edit card
e
Preview card
Space
Delete card
d
Notebook view (select mode)
Shortcuts to move around, select, and edit cards on the notebook view.
Move selection
j
k
Move card up
Ctrl
k
/
Ctrl
Move card down
Ctrl
j
/
Ctrl
Cancel selection
Esc
Edit card
e
Preview card
Space
Delete card
d
Add card below
o
Add card above
Shift
o
Notebook view (edit mode)
Shortcuts to use while editing a card in notebook view.
Add a new side
Ctrl
-
Split card at cursor
Ctrl
Shift
Save and add a new card
Ctrl
Save and finish editing.
Esc
Deck page (column view)
Shortcuts to move around, select, and edit cards on the column view.
Move selection
j
k
Move card up
Ctrl
k
/
Ctrl
Move card down
Ctrl
j
/
Ctrl
Cancel selection
Esc
Edit card
e
Delete card
d
Review / Learn page
These shortcuts are usable on the review or 'learn new cards' pages.
Show next side of card
Space
j
Hide last side
k
Mark as "remembered"
Space
Skip sides and mark as "remembered"
Shift
Space
Mark as "forgot"
f
Archive card
a
Toggle Reverse Reviews
v
Edit card
e
Delete card
d
Replay audio
r
Pause/play audio
p
Miscellaneous
Various other shortcuts.
Exit modal
Esc
Save editor
Ctrl
Show this panel
?