Skip to content

The Shopping Cart application developed in the book "Practical FP in Scala: A hands-on approach"

Notifications You must be signed in to change notification settings

sagoez/practical-fp-in-scala-runthrough

Repository files navigation

Shopping Cart

Cats friendly

Components Overview

arch

  • Both Services and Authentication are algebras. The latter are mainly dependencies for some of the services.
  • Programs shows Checkout, the business logic that combines most of the services.
  • Effects show our custom interfaces required implicitly.
  • The lines connecting services to Redis and PostgreSQL show which ones access which storage.
  • The HTTP layer shows the client and the different routes.
  • At the very end, we have both the modules and the entry point to the application.

Run

To spin up locally (on Mac) run the following commands:

  docker-compose up -d &&

  export DEBUG=false &&
  export SC_ACCESS_TOKEN_SECRET_KEY=5h0pp1ng_k4rt &&
  export SC_JWT_SECRET_KEY=-*5h0pp1ng_k4rt*- &&
  export SC_JWT_CLAIM="{\"uuid\": \"004b4457-71c3-4439-a1b2-03820263b59c\"}" &&
  export SC_ADMIN_USER_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1dWlkIjogIjAwNGI0NDU3LTcxYzMtNDQzOS1hMWIyLTAzODIwMjYzYjU5YyJ9.L97BnPScSAKY-BLkYu8G_n8h1U4LDOURUen14O22hD4 &&
  export SC_PASSWORD_SALT=06grsnxXG0d*Pj496p6fuA*o &&
  export SC_APP_ENV=test &&
  export SC_POSTGRES_PASSWORD=my-password &&

  sbt reStart

Tests

To run Unit Tests:


sbt test

To run Integration Tests we need to run both PostgreSQL and Redis:


docker-compose up
sbt it:test
docker-compose down

For more information go to Gabriel's Volpe guide

About

The Shopping Cart application developed in the book "Practical FP in Scala: A hands-on approach"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages