Skip to content

Personal example pet-project chat application using Tagless Final

License

Notifications You must be signed in to change notification settings

igor-ramazanov/pet-project-chat

Repository files navigation

Personal chat pet-project

Build Status

Personal pet-project I am working on for self-education purposes.

The project is a simple real-time chat on websockets.

Technologies used:

  1. Cats - for writing abstract code and as a standardized interface between other libraries
  2. Cats Effect - for abstracting over concrete IO monad
  3. Monix - concrete implementation of IO monad
  4. Redis - storage and pub-sub mechanism
  5. ScalaJS, ScalaJS bindings for ReactJS, Bootstrap 4 and ScalaCSS - for web client
  6. OpenAPI - API documentation
  7. Testcontainers, ScalaTest and ScalaCheck - property-based integration tests

I've used the Tagless Final style of the functional programming, but unsure that everything is written in optimal and correct way and would be very grateful to hear any constructive critics!

Configuration

Usage: pet-project-chat [options]

   --help                   prints this help
   --redis-host <value>     (required) host of redis used as a storage
   --log-level <value>      (optional) log level, must be one of 'OFF','ERROR','WARN','INFO','DEBUG','TRACE','ALL', default is INFO
   --smtp-host <value>      (optional) SMTP host, if not provided then verification of emails be disabled
   --smtp-port <value>      (optional) SMTP port, if not provided then verification of emails be disabled
   --smtp-tls               (optional) Use TLS for SMTP
   --smtp-from <value>      (optional) 'from' field of verification emails, if not provided then verification of emails be disabled
   --smtp-user <value>      (optional) User for SMTP server
   --smtp-password <value>  (optional) Password for SMTP server
   --verification-link-prefix <value>
                            (optional) Prefix of email verification link, i.e. 'http://localhost:8080', if not provided then verification of emails be disabled
   --email-verification-timeout <value>
                            (optional) email verification timeout, examples are '1 second', '9 days', '3 hours', '1 hour', default is '1 day'

Building and running locally

Prerequisites

Without email verification on a new user registration

  1. Build the project Docker image sbt appJVM/docker:publishLocal
  2. Run the project and Redis Docker images by docker-compose -f docker-compose-without-email-verification.ym up
  3. Open http://localhost:8080 in your browser

With email verification on a new user registration

  1. You'll need an SMTP server, find information with your mail provider, examples: GMail, MailRu
  2. Build the project Docker image sbt appJVM/docker:publishLocal
  3. Edit the docker-compose-with-email-verification.ym replacing SMTP information you've got from the 1st step
  4. Run the project and Redis Docker images by docker-compose -f docker-compose-with-email-verification.ym up
  5. Open http://localhost:8080 in your browser

Building native executable (is not supported at the moment)

You'll need the installed GraalVM and Scala Built Tool.

Execute the script in the root project dir:

./graal-build-native-executable.sh

WebUI

Web UI

About

Personal example pet-project chat application using Tagless Final

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published