Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
Rename xtdb-starter to xtdb-demo, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeoffrey committed Jan 29, 2024
1 parent 184fb00 commit 28b875d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 28 deletions.
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{:extra-deps
{com.datomic/peer {:mvn/version "1.0.7075"}}}

:xtdb-starter ; process must be started with `XTDB_ENABLE_BYTEUTILS_SHA1=true clj -A:xtdb-starter:...`
:xtdb-demo ; process must be started with `XTDB_ENABLE_BYTEUTILS_SHA1=true clj -A:xtdb-demo:...`
{:extra-deps
{com.xtdb/xtdb-core {:mvn/version "1.23.0"}
com.xtdb/xtdb-rocksdb {:mvn/version "1.23.0"}}
Expand Down
24 changes: 24 additions & 0 deletions src/xtdb_demo/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Electric XTDB demo

* Adapted from [xtdb-in-a-box](https://github.com/xtdb/xtdb-in-a-box)
* Note: `XTDB_ENABLE_BYTEUTILS_SHA1=true` env var is required!


Start a REPL:
```shell
XTDB_ENABLE_BYTEUTILS_SHA1=true clj -A:dev:xtdb-demo
```
At the REPL:
```clojure
(dev/-main)
(dev/load-fiddle! 'xtdb-demo)
```

Visit [http://localhost:8080](http://localhost:8080)

Build and run for prod:

```shell
clojure -X:build:prod:xtdb-demo build-client :hyperfiddle/domain xtdb-demo
XTDB_ENABLE_BYTEUTILS_SHA1=true clj -M:prod:xtdb-demo -m prod
```
10 changes: 5 additions & 5 deletions src/xtdb_starter/fiddles.cljc → src/xtdb_demo/fiddles.cljc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(ns xtdb-starter.fiddles
(ns xtdb-demo.fiddles
(:require #?(:clj [clojure.java.io :as io])
#?(:clj [xtdb.api :as xt])
[hyperfiddle.electric-dom2 :as dom]
[hyperfiddle.electric :as e]
[xtdb-starter.todo-list :refer [Todo-list]]))
[xtdb-demo.todo-list :refer [Todo-list]]))

#?(:clj (defonce !xtdb-node (atom nil)))

Expand All @@ -20,7 +20,7 @@
:xtdb/document-store (kv-store "data/dev/doc-store")
:xtdb/index-store (kv-store "data/dev/index-store")}))))))

(e/defn XTDB-Starter []
(e/defn XTDB-Demo []
(e/server
(if-let [!xtdb (try (e/offload #(start-xtdb!))
(catch hyperfiddle.electric.Pending _
Expand All @@ -29,12 +29,12 @@
(e/client
(dom/p (dom/text "XTDB is starting ..."))))))

(e/def fiddles {`XTDB-Starter XTDB-Starter})
(e/def fiddles {`XTDB-Demo XTDB-Demo})

(e/defn FiddleMain [ring-request]
(e/client
(binding [dom/node js/document.body]
(XTDB-Starter.))))
(XTDB-Demo.))))

(comment
(.close @!xtdb-node)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns xtdb-starter.todo-list
(ns xtdb-demo.todo-list
(:require
#?(:clj [xtdb-starter.xtdb-contrib :as db])
#?(:clj [xtdb-demo.xtdb-contrib :as db])
[hyperfiddle.electric :as e]
[hyperfiddle.electric-dom2 :as dom]
[hyperfiddle.electric-ui4 :as ui]
Expand Down Expand Up @@ -65,7 +65,7 @@

(e/defn Todo-list [!xtdb]
(e/server
(binding [xtdb-starter.todo-list/!xtdb !xtdb
(binding [xtdb-demo.todo-list/!xtdb !xtdb
db (new (db/latest-db> !xtdb))]
(e/client
(dom/link (dom/props {:rel :stylesheet :href "/todo-list.css"}))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns xtdb-starter.xtdb-contrib
(ns xtdb-demo.xtdb-contrib
(:require [missionary.core :as m]
[xtdb.api :as xt]))

Expand Down
18 changes: 0 additions & 18 deletions src/xtdb_starter/Readme.md

This file was deleted.

0 comments on commit 28b875d

Please sign in to comment.