clovellytech / http4s-modules   0.1.0

MIT License GitHub

Web modules built on Http4s

Scala versions: 2.13 2.12
Scala.js versions: 1.x 0.6

h4sm - Scala Http4s Modules Join the chat Build Status Sonatype Release

Create composable server modules with ease using Http4s, cats, Flyway, and PostgreSQL. Built for scala 2.12 and 2.13 and scalajs 1.0.

Basic Idea

To provide a library of production ready modules, complete with database schema, that can be composed and mounted as HttpServices. Modules included so far:

  • auth - A complete user authentication implementation using tsec. Bearer and stateless cookie authentication schemes are available.
  • features - An example library that allows users to submit feature requests and vote on features.
  • files - A complete file upload and retrieval module. Only local file storage is implemented so far. AWS or other backends can be added by providing a typeclass instance.
  • invitations - Add the ability for users to invite new users.
  • messages - Allow authenticated users to pass messages to each other if they know the other's user id.
  • permissions - Built on top of tsec-http4s, an easy way to create routes that are guarded by a user having certain permissions.
  • petstore - As a learning example, the scala-pet-store implemented with h4sm modules (not released)
  • store - A store with items and orders.
  • more to come! Something you would like to see here? Submit an issue!

See documentation here

Creating a module: See a start to finish implementation example

Contributors and Recognition

PRs and issues are so welcome on this project. Generally contributors don't have to be people that commit code or even write issues. Thanks especially to:

Try it out

An example project exists in /example-server, which aggregates all the modules into a single server. To run, execute exampleServerJVM/reStart in sbt.

Get Started

Add any of the following dependencies to your build.sbt. There are interdependencies too, so you may consult build.sbt to see which modules depend on which, and thus may not need to be declared in your build.sbt.

libraryDependencies ++= Seq(
).map("com.clovellytech" %% _ % h4smVersion)

Scalajs Clients

Clients are prebuilt for several modules. You can include them in your scalajs projects as:

libraryDependencies ++= Seq(
).map("com.clovellytech" %%% _ % h4smVersion)