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

📚 Unofficial Giter8 template for the Typelevel Stack (Http4s / Doobie / Circe / Cats Effect / Fs2) based on Cats v1.x.x

Notifications You must be signed in to change notification settings

profunktor/typelevel-stack.g8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unofficial Giter8 template for the Typelevel Stack (Http4s / Doobie / Circe / Cats Effect / Fs2) based on Cats v1.x.x

Typelevel Stack QuickStart

  1. Install sbt
  2. sbt new profunktor/typelevel-stack.g8
  3. cd quickstart
  4. Install PostgreSQL and configure access for user postgres and password postgres (or change it in Module)
  5. Create database users and table api_user (see src/main/resources/users.sql or use Flyway as in the tests).
  6. sbt test (optional)
  7. sbt run
  8. curl http://localhost:8080/users/$USERNAME

About Template

It contains the minimal code to get you started:

  • UserRepository: Defines a method to find a user without commiting to a Monad (kind of tagless-final).
    • PostgresUserRepository: Implementation of the UserRepository interface using Doobie and PostgreSQL abstracting over the Effect F[_].
  • UserService: Business logic on top of the UserRepository again abstracting over the Effect F[_].
  • UserHttpEndpoint: Defines the http endpoints of the REST API making use of the UserService.
  • HttpErrorHandler: Mapping business errors to http responses in a single place.
  • http package: Includes custom Circe Json Encoders for value classes.
  • validation object: Includes fields validation using cats.data.ValidatedNel.
  • Module: Dependencies module.
  • Server: The main application that wires all the components and starts the web server.

Template License

Written in <2017> by @gvolpe

To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this template to the public domain worldwide. This template is distributed without any warranty. See http://creativecommons.org/publicdomain/zero/1.0/.

About

📚 Unofficial Giter8 template for the Typelevel Stack (Http4s / Doobie / Circe / Cats Effect / Fs2) based on Cats v1.x.x

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages