Fork me on GitHub
#pathom
<
2019-11-23
>
tianshu15:11:19

Hi, I want to know you guys' tech stack in clojure/script for a fullstack development(using pathom). 😈

wilkerlucio02:11:07

most of the times I write the servers from scratch, just pulling pathom, or depending on the kind of app, make it 100% client (Pathom can run there as well, in this model the client parser will process things and delegate to apis using the resolvers, using the async parser)

Vincent Cantin15:12:13

@U0NBGRGD6 I am writing a template-based framework similar to VueJS where you can use fragments of EQL queries in place of data. It uses Pathom under the hood.

tianshu15:12:12

@U8MJBRSR5 great! show me please!

Vincent Cantin15:12:55

I did not release its source code yet .. the poc was too primitive. I hope to have a first draft ready by the end of december.

tianshu15:12:49

do you mean something like fulcro but without react?

Vincent Cantin15:12:16

Something like Fulcro, but replace the render function with a template.

Vincent Cantin15:12:42

by template I mean a declarative form .. a data.

tianshu15:12:02

Do you have an API design at this moment?

Vincent Cantin15:12:06

Here is how it may look like:

(def todo-item
  {:id ::todo-item
   :name "Todo Item"
   :description "A todo item for the todo list."
   :props [^:eql 'item
           'color]
   :template `[:li
               (when color {:style {:color color}})
               (:todo-item/description item)
               (when (:todo-item/done? item)
                " (done)")]})

(def todo-list
  {:id ::todo-list
   :name "Todo List"
   :description "A todo list."
   :props [^:eql 'list]
   :env {'colors ["limeGreen" "chartreuse" "forestGreen"]
         'cycled-color (fn [colors index]
                         (get colors (mod index (count colors))))}
   :template `[:div
               [:h1 "Things to do"]
               [:div (:todo-list/title list)]
               (let [items (:todo-list/items list)]
                (if (empty? items) ; also can use if-not
                 [:div "No items in this list"]
                 [:ul
                  (for-indexed [[index item] items]
                   (let [item-color (cycled-color colors index)]
                    ^{:class :item} [::todo-item item item-color]))]))]})



(def my-components [todo-item todo-list])

Vincent Cantin15:12:13

That syntax will change, but that’s the idea

tianshu15:12:15

interesting! how you build the whole eql from root? I mean joined query, like [:x/a :a/b {:x/y [:y/c :y/d]}] .

Vincent Cantin15:12:51

.. just follow the data usage.

tianshu15:12:24

is that possible? I have been think for this for a while.

Vincent Cantin15:12:37

me too, and now I am implementing it.

tianshu15:12:51

may you share your idea?

Vincent Cantin15:12:04

the template is made of a DSL, not general Clojure functions.

Vincent Cantin15:12:32

I will talk more about it once I release the first draft.

Vincent Cantin15:12:38

The name is Vrac.

tianshu15:12:07

I see, use env to extract arbitrary clojure expression out of the template.

tianshu15:11:45

I want to try a new stack (for me) which use eql and get the query from UI, resolve the query from database. So is fulcro/pathom/walkable a good choice?

wilkerlucio01:11:46

hello man, sorry the delay, still doing the trip back home :)

wilkerlucio01:11:37

so, about walkable, one issue is that currently it doesnt integrate with connect (walkable was developed before that), so if you pull walkable you cant use the attribute connection thing on top of that

👍 4
wilkerlucio02:11:28

so, I suggest you can go without walkable, you can still implement the resolvers and run SQL queries (or anything else) in their body, not so automatic, but over time you really don't want to expose the whole SQL to the client

tianshu11:11:46

aha, make sense.

tianshu11:11:22

So I can provide something like CRUD to the each resolver

tianshu12:11:11

Is there a demo app for this? doesn't matter the database is datomic or sql.

adamfeldman22:11:08

If you don’t want to write the CRUD SQL yourself, I’ve looked into using https://hasura.io/ to get GraphQL CRUD over Postgres, and then using Pathom Connect’s GraphQL support to interact with the GraphQL API generated by Hasura

adamfeldman22:11:08

If you aren’t using Postgres, something similar may be possible with https://www.prisma.io/ (I am not sure, Prisma keeps pivoting their offerings…)

Chris O’Donnell23:11:51

Here's a demo app using fulcro, pathom, and hasura: https://github.com/codonnell/crudless-todomvc

❤️ 4
adamfeldman22:11:08

If you don’t want to write the CRUD SQL yourself, I’ve looked into using https://hasura.io/ to get GraphQL CRUD over Postgres, and then using Pathom Connect’s GraphQL support to interact with the GraphQL API generated by Hasura