Hey everyone! I'd love to hear feedback about my p...
# compose-web
d
Hey everyone! I'd love to hear feedback about my project: https://github.com/varabyte/kobweb I'll go into a bit more detail in the 🧵 but quick take: it's an opinionated layer on top of Web Compose to make it fast and easy to set up full stack applications built around a live reloading experience (similar to Next.js if you're familiar with it).
K 11
🎉 11
👍 12
🙌 8
I've been working on this for the last three months initially to satisfy my curiosity if it was technically possible. Now, I have a framework which: • can set up a new project in seconds • generates site routing for you • allows trivially defining server API routes • can export static pages • includes a UI layer that supports light and dark modes and will serve as the foundation for a large suite of UI widgets (similar to Chakra-UI if you're familiar with it) • supports markdown out of the box • generates a multiplatform setup for you so it's easy to share types between client and server At this point, I think I've gone far enough without involving the community. Before, it just felt too experimental to mention. But now, while still rough and early, I think it's serviceable enough to announce an initial release. I'd like to learn: • how much potential community interest there is in using this • if I've been making valid assumptions with my API design • what people's real pain points are (instead of trying to guess) • if there is anyone interested in contributing to the project If you want to play with it yourself, just download / build the Kobweb binary (instructions in the README) and type
kobweb create site
or
kobweb create examples/todo
. The next steps I take will be shaped by the signal and feedback I receive from you all and the wider community. You can of course reply in this thread, but the README also has a section on other ways to contact us as well. Thanks in advance!
g
This looks really interesting! So "kobweb run" will run the hot reloading local server environment, but how do you produce a production distribution I can put on a web server? Would it be possible to not have a separate kobweb binary and instead move all the functionality into a gradle plugin?
d
Thank you! You run "kobweb export" to generate a site and then use "kobweb run --env prod" to run it
By the way there is a gradle plugin, and the kobweb binary is just calling gradle with all the right arguments for you
You can just copy the exported site and the kobweb binary to your production environment and that will be enough to run the server, but the setup I plan to run myself is to just git pull the project and kobweb export / run it there, because I'm lazy 😛
c
This is pretty cool! I'm trying to understand the relation between the kobweb binary and the static site exports. For the blog use case for example is the binary still needed?
d
Thanks for checking it out!
If you have already created the project, you can do everything without the binary
but my hope is if you use it, you'll realize you kind of like it...
But after you create a Kobweb project and look at the Gradle tasks, you'll realize there are a handful under the "Kobweb" category, and you can run them directly.
That said, one thing that might be kind of surprising at first is that "kobwebRun", unlike "jsRun", doesn't block. It just runs the server and then finishes. Also, you want to pass "-t" (or "--continuous") into your tasks for live reloading, and then remember to run "kobwebStop" when you're done. The binary just does this for you.
c
Actually my question was more along the lines of: is the kobweb binary (which I assume uses the compose runtime under the hood) required for running the production site? Does it therefore require Kotlin runtime on the production server?
d
Ah no, it's not required
You can absolutely run the Gradle commands directly
But that still requires a running JVM, yeah?
Oh, kobweb (the binary) does not use Compose under the hood
c
Got it. Thanks.
d
No problem, glad to have people asking questions and poking around.
b
Is this somehow doing SSR with compose? If so, is it still serving full js bundle on each page?
Also, is silk documented somewhere?
d
It's not really SSR at this point.
I'm just taking static snapshots of all pages (using headless chrome) when you export your site, but when you fetch it, it still includes a full JS payload with it, which, when it runs, rebuilds the DOM from scratch.
Silk is not yet documented. It barely even exists at this point. The plan is to start creating a website built with Kobweb that showcases Silk components.
Basically you have Box, Column, Row, Surface, Text, and Link right now.
Surface, Text, and Link are stylable and color mode aware.
d
I think you can use this library for your CLI: https://github.com/ajalt/clikt It supports native as well so you can create executables
d
Thanks! But kotlinx-cli is also multiplatform? What are advantages of clikt?
(As an aside, I made the intentional decision to target the JVM for now with Kobweb and not native, because I'm not worried about it being performance critical, it's not the interesting work I want to focus on anyway, and you have to have a JVM on your machine because it just delegates to Gradle anyway. Keep in mind until recently I wasn't even sure if kobweb would work or if anyone would be interested!)
d
They are similar, I haven't tried
kotlinx-cli
, I like how you organize your code in clikt and how you can create subcommands
d
Yeah I'm creating subcommands with kotlinx-cli, although I think they introduced that feature later
a
Great job @David Herman, this is so Cool!!!
d
Thanks @Alex! Happy to say I'm still plugging away at it so let me know if you have any questions