All Projects → keynmol → http4s-laminar-stack

keynmol / http4s-laminar-stack

Licence: other
A complete example of a fullstack (I actually don't know what this means) Scala application, using http4s on the backend and Laminar and Scala.js on the frontend

Programming Languages

scala
5932 projects
HTML
75241 projects

Projects that are alternatives of or similar to http4s-laminar-stack

tradeio
A disciplined way to purely functional domain models in Scala
Stars: ✭ 19 (-55.81%)
Mutual labels:  http4s
idealingua-v1
IdeaLingua RPC for Scala, TypeScript, C#, Go
Stars: ✭ 13 (-69.77%)
Mutual labels:  http4s
typelevel-stack.g8
📚 Unofficial Giter8 template for the Typelevel Stack (Http4s / Doobie / Circe / Cats Effect / Fs2) based on Cats v1.x.x
Stars: ✭ 63 (+46.51%)
Mutual labels:  http4s
http4s-graal
An experiment running http4s as native image with Graal (+ Substrate)
Stars: ✭ 27 (-37.21%)
Mutual labels:  http4s
pfhais
Source code of the book Pure functional HTTP APIs in Scala including a chapter about upgrading to Scala 3.
Stars: ✭ 48 (+11.63%)
Mutual labels:  http4s
telegram-bot-fs2
Example telegram bot implementation using fs2 and http4s client (no akka)
Stars: ✭ 41 (-4.65%)
Mutual labels:  http4s
dokusho
Simple Japanese reading stats tracker
Stars: ✭ 12 (-72.09%)
Mutual labels:  http4s
http4s-finagle
Http4s on Finagle Server or Client
Stars: ✭ 12 (-72.09%)
Mutual labels:  http4s
event-driven-messenger
No description or website provided.
Stars: ✭ 43 (+0%)
Mutual labels:  http4s
influencer-stats
Playground for measuring performance of functional programming tools in Scala. Gathers statistics about videos.
Stars: ✭ 24 (-44.19%)
Mutual labels:  http4s
http4s-dom
http4s, in a browser near you
Stars: ✭ 13 (-69.77%)
Mutual labels:  http4s
http4s-munit
Integration between http4s & MUnit
Stars: ✭ 16 (-62.79%)
Mutual labels:  http4s
http4s-poc-api
POC: http4s http api on zio
Stars: ✭ 34 (-20.93%)
Mutual labels:  http4s
free-monads-functional-web-apps
Delving into Free Monads and using them to write pure functional web applications
Stars: ✭ 18 (-58.14%)
Mutual labels:  http4s
classy-optics
🔎 Source code shown at my talks at Scale by the Bay 2018 and Scalar 2019
Stars: ✭ 25 (-41.86%)
Mutual labels:  http4s
zorechka-bot
Github bot for keeping your Bazel dependencies up-to-date and clean
Stars: ✭ 25 (-41.86%)
Mutual labels:  http4s
spotify-next
Small CLI app for filtering out music on Spotify.
Stars: ✭ 45 (+4.65%)
Mutual labels:  http4s
frontroute
front-end router library for single-page applications built with Scala.js, with an API inspired by Akka HTTP
Stars: ✭ 22 (-48.84%)
Mutual labels:  laminar
bevy prototype networking laminar
This is a prototype of a networking crate for bevy. This create provides a low-level networking plugin built on top of laminar
Stars: ✭ 30 (-30.23%)
Mutual labels:  laminar
scala-http4s-realworld-example-app
Example of a RealWorld app backend powered by Scala + http4s
Stars: ✭ 35 (-18.6%)
Mutual labels:  http4s

http4s-laminar-stack build

This is an example of a full-stack application with the following features:

  • Scala 3 on both frontend and backend
  • Laminar as a frontend library
  • Http4s as a backend HTTP server library
  • Shared code with protocol definitions
  • Gzip compression on the server side
  • Docker packaging of the full application
  • Tests for the client with simulated DOM using jsdom

Note: this is a very basic setup, for a more complicated template (with Postgres, API spec using Smithy, etc.) please see Smithy4s Fullstack template

Additionally, you can check out my blog series about fullstack Scala 3:

  • Twotm8 - building and deploying a full-stack Scala application using Scala Native and Scala.js

  • Smithy4s - building and deploying a full-stack Scala app with Smithy4s and Scala.js

Note: this version of the template uses the latest and greatest from Cats Effect, http4s, Scala, etc. If you would like, please see the last commit that referenced old versions of the libraries. Apart from Scala 3 (which is still wonky around IntelliJ support), I highly recommend sticking with the latest versions of the libraries.

Development mode

Run in SBT (uses fast JS compilation, not optimized):

sbt> ~runDev

And open http://localhost:9000/frontend

This will restart the server on any changes: shared code, client/server, assets.

Tests

It is a prerequisite to have jsdom installed, in order for the frontend tests to run. Proposal:

yarn add jsdom

Then move into an sbt console and run tests as normal

Production mode

Run in SBT (uses full JS optimization):

sbt> ~runProd

Docker packaging

sbt> backend/docker:publishLocal

Will publish the docker image with fully optimised JS code, and you can run the container:

✗ docker run --rm -p 8080:8080 laminar-http4s-example:0.1.0-SNAPSHOT

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Running server on http://0.0.0.0:8080 (mode: prod)

The interface is fairly simple:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].