All Projects → pandaforme → Ultron.g8

pandaforme / Ultron.g8

A ZIO + http4s + Circe + Quill + Tapir giter8 template

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to Ultron.g8

quilljs-rails
Easy integration of Quill rich editor with most Rails forms.
Stars: ✭ 33 (-69.16%)
Mutual labels:  quill
Quill Mention
💬 @mentions for the Quill rich text editor
Stars: ✭ 349 (+226.17%)
Mutual labels:  quill
Scala Db Codegen
Scala code/boilerplate generator from a db schema
Stars: ✭ 49 (-54.21%)
Mutual labels:  quill
php-quill-renderer
Render quill insert deltas to HTML, Markdown and GitHub flavoured Markdown
Stars: ✭ 117 (+9.35%)
Mutual labels:  quill
podpodge
Convert YouTube playlists to audio-only RSS feeds for podcast apps to consume.
Stars: ✭ 32 (-70.09%)
Mutual labels:  quill
Ruoyi Vue
(RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue & Element 的前后端分离权限管理系统
Stars: ✭ 596 (+457.01%)
Mutual labels:  quill
angular quill
Angular dart component for the Quill rich text editor
Stars: ✭ 22 (-79.44%)
Mutual labels:  quill
Quill Delta Parser
A PHP library to parse and render Quill WYSIWYG Deltas into HTML - Flexibel and extendible for custom elements.
Stars: ✭ 63 (-41.12%)
Mutual labels:  quill
quill-placeholder-module
A quill module for adding placeholders
Stars: ✭ 27 (-74.77%)
Mutual labels:  quill
Quill
Quill is a modern WYSIWYG editor built for compatibility and extensibility.
Stars: ✭ 31,554 (+29389.72%)
Mutual labels:  quill
quill-magic-url
Automatically convert URLs to links in Quill
Stars: ✭ 86 (-19.63%)
Mutual labels:  quill
collaborative-editor
A collaborative editor that supports authorship display, image uploading placeholder and CJK characters composition based on Quill and ShareDB.
Stars: ✭ 78 (-27.1%)
Mutual labels:  quill
Vue Quill Editor
🍡@quilljs editor component for @vuejs
Stars: ✭ 6,874 (+6324.3%)
Mutual labels:  quill
bayou
Collaborative document editing, with Quill-based front end
Stars: ✭ 21 (-80.37%)
Mutual labels:  quill
Yii2 Quill
Yii 2 implementation of Quill, modern WYSIWYG editor
Stars: ✭ 52 (-51.4%)
Mutual labels:  quill
quill-html-edit-button
Quill.js Module which allows you to quickly view/edit the HTML in the editor
Stars: ✭ 108 (+0.93%)
Mutual labels:  quill
React Quill
A Quill component for React.
Stars: ✭ 4,739 (+4328.97%)
Mutual labels:  quill
Ngx Quill
Angular (>=2) components for the Quill Rich Text Editor
Stars: ✭ 1,382 (+1191.59%)
Mutual labels:  quill
Node Quill Converter
Convert HTML to a Quill Delta or a Quill Delta to HTML
Stars: ✭ 61 (-42.99%)
Mutual labels:  quill
Rating Stars
⭐️⭐️⭐️⭐️⭐️ A 5-star rating widget implemented in JS and CSS
Stars: ✭ 18 (-83.18%)
Mutual labels:  quill

A ZIO + http4s + Circe + Quill + Tapir giter8 template

Prerequisites

  1. Lanuch H2 database at your local machine For example: using H2 docker image
docker pull oscarfonts/h2
docker run -d -p 1521:1521 -p 81:81 -v /path/to/local/data_dir:/opt/h2-data --name=MyH2Instance oscarfonts/h2
  1. Import SQL to H2 database
CREATE TABLE IF NOT EXISTS user
(
    id INT NOT NULL,
    name VARCHAR(255) NOT NULL,
    age INT NOT NULL,
    PRIMARY KEY(id)
);

How to install

brew update && brew install giter8
g8 pandaforme/ultron.g8

How to add a new API

  1. Create a package in module for example: xyz

  2. Create an interface in module.xyz

trait XYZ {

  val service: XYZ.Service
}

object XYZ {

  trait Service {

    def doXYZ(): ZIO[Any, Error, Unit]
  }
}
  1. Create a package object in module.xyz
package object xyz {

  def doXYZ(id: Long): ZIO[XYZ, Error, Unit] =
    ZIO.accessM(_.service.doXYZ())
}
  1. Create an instance for test/live in module.xyz
trait LiveXYZ extends XYZ {
    override val service: XYZ.Service = new XYZ.Service {
        def doXYZ(): ZIO[Any, Error, Unit] = ???
    }
}
  1. Create your own route in route and pass your interface into enviroment type
class XyzRoute[R <: XYZ] extends Http4sDsl[TaskR[R, ?]] {
  private val xyzEndPoint = endpoint.get
    .in("xyz" / path[Long]("user id"))
    .errorOut(emptyOutput)
    .out(emptyOutput)    

  val getRoutes: HttpRoutes[TaskR[R, ?]] = ???
  val getEndPoints = List(xyzEndPoint)   
}
  1. Write unit test

  2. Add your interfaces to AppEnvironment, routes to httpApp and provide Live instances in Main.scala

object Main extends App {
  type AppEnvironment = Clock with Console with UserRepository with MyLogger with XYZ
  private val userRoute = new UserRoute[AppEnvironment]
  private val xyzRoute = new XyzRoute[AppEnvironment]
  private val yaml = userRoute.getEndPoints.toOpenAPI("User", "1.0").toYaml

  override def run(args: List[String]): ZIO[Main.Environment, Nothing, Int] = {
    val result = for {
      application <- ZIO.fromTry(Try(Application.getConfig))

      httpApp = Router(
          "/" -> userRoute.getRoutes,
          "/" -> xyzRoute.getRoutes, 
          "/docs" -> new SwaggerHttp4s(yaml).routes[TaskR[AppEnvironment, ?]]).orNotFound
      finalHttpApp = Logger.httpApp[ZIO[AppEnvironment, Throwable, ?]](true, true)(httpApp)

      server = ZIO.runtime[AppEnvironment].flatMap { implicit rts =>
        BlazeServerBuilder[ZIO[AppEnvironment, Throwable, ?]]
          .bindHttp(application.server.port, application.server.host.getHostAddress)
          .withHttpApp(finalHttpApp)
          .serve
          .compile[ZIO[AppEnvironment, Throwable, ?], ZIO[AppEnvironment, Throwable, ?], ExitCode]
          .drain
      }
      program <- server.provideSome[Environment] { base =>
        new Clock with Console with LiveUserRepository with LiveLogger with LiveXyz{
          val clock: Clock.Service[Any] = base.clock
          val console: Console.Service[Any] = base.console
          val config: Config = ConfigFactory.parseMap(
            Map(
              "dataSourceClassName" -> application.database.className.value,
              "dataSource.url" -> application.database.url.value,
              "dataSource.user" -> application.database.user.value,
              "dataSource.password" -> application.database.password.value
            ).asJava)
        }
      }
    } yield program

    result
      .foldM(failure = err => putStrLn(s"Execution failed with: $err") *> ZIO.succeed(1), success = _ => ZIO.succeed(0))
  }
}

API Endpoints

Swagger: http://localhost:5566/docs
User API: http://localhost:5566/user

Challenges

  1. Try to implement LiveLogger
  2. Because quill driver of H2 database is not Asynced, we need to push blocking IO to another thread pool. How to achieve it via ZIO?

Referneces

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].