All Projects → lloydmeta → Rhodddoobie

lloydmeta / Rhodddoobie

Licence: other
My little sandbox for playing around with the FP + OOP + DDD combination, in particular using Rho, doobie, Docker, testing, etc in a project.

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Rhodddoobie

Flama
🔥 Fire up your API with this flamethrower
Stars: ✭ 161 (+323.68%)
Mutual labels:  api, swagger, crud
Node Typescript Koa Rest
REST API boilerplate using NodeJS and KOA2, typescript. Logging and JWT as middlewares. TypeORM with class-validator, SQL CRUD. Docker included. Swagger docs, actions CI and valuable README
Stars: ✭ 739 (+1844.74%)
Mutual labels:  swagger, sql, crud
Fastapi Crudrouter
A dynamic FastAPI router that automatically creates CRUD routes for your models
Stars: ✭ 159 (+318.42%)
Mutual labels:  api, sql, crud
Rest Hapi
🚀 A RESTful API generator for Node.js
Stars: ✭ 1,102 (+2800%)
Mutual labels:  api, swagger, crud
Jianshu
仿简书nx+nodejs+nestjs6+express+mongodb+angular8+爬虫
Stars: ✭ 296 (+678.95%)
Mutual labels:  api, swagger, crud
Manticoresearch
Database for search
Stars: ✭ 610 (+1505.26%)
Mutual labels:  api, sql
Komga
Media server for comics/mangas/BDs with API and OPDS support
Stars: ✭ 647 (+1602.63%)
Mutual labels:  api, ddd
Kin Openapi
OpenAPI 3.0 implementation for Go (parsing, converting, validation, and more)
Stars: ✭ 776 (+1942.11%)
Mutual labels:  api, swagger
Play26 Swagger Reactivemongo
A fully featured CRUD app built with Play 2.6, Swagger and ReactiveMongo
Stars: ✭ 36 (-5.26%)
Mutual labels:  swagger, crud
Equinoxproject
Full ASP.NET Core 5 application with DDD, CQRS and Event Sourcing concepts
Stars: ✭ 5,120 (+13373.68%)
Mutual labels:  swagger, ddd
Ezsql
PHP class to make interacting with a database ridiculusly easy
Stars: ✭ 804 (+2015.79%)
Mutual labels:  sql, crud
Go Book Store Api
Go Sample project to understand Mysql CRUD operation with best practises Includes logging, JWT, Swagger and Transactions
Stars: ✭ 18 (-52.63%)
Mutual labels:  api, swagger
Snake
🐍 一款小巧的基于Go构建的开发框架,可以快速构建API服务或者Web网站进行业务开发,遵循SOLID设计原则
Stars: ✭ 615 (+1518.42%)
Mutual labels:  api, swagger
Swagger Stats
API Observability. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices.
Stars: ✭ 559 (+1371.05%)
Mutual labels:  api, swagger
Oas Kit
Convert Swagger 2.0 definitions to OpenAPI 3.0 and resolve/validate/lint
Stars: ✭ 516 (+1257.89%)
Mutual labels:  api, swagger
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+2086.84%)
Mutual labels:  api, swagger
Go Starter
An opinionated production-ready SQL-/Swagger-first RESTful JSON API written in Go, highly integrated with VSCode DevContainers by allaboutapps.
Stars: ✭ 37 (-2.63%)
Mutual labels:  swagger, sql
Swagger Codegen Play Scala
Swagger client generator which is based on the PlayWS library
Stars: ✭ 9 (-76.32%)
Mutual labels:  swagger, sbt
Widdershins
OpenAPI / Swagger, AsyncAPI & Semoasa definitions to (re)Slate compatible markdown
Stars: ✭ 856 (+2152.63%)
Mutual labels:  api, swagger
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+104078.95%)
Mutual labels:  api, swagger

Rho + DDD + doobie + Docker scratchpad

Build Status

My little sandbox for playing around with the FP + OOP + DDD combination, in particular using Rho, doobie, Docker, integration testing, etc in a project. In the future, this might be spun out into a G8 template.

Goals:

  • Finding that sweet spot between FP, OOP and light DDD
  • Get feet wet with using Rho as a routing + API spec layer on http4s through building not-completely-trivial CRUD API endpoings with one-to-many parent-child modeling
  • Docker
    • For booting up app w/ Psql db
    • For integration tests
    • Migrations tests
  • Doobie for interfacing with Postgres
  • H2 for simple repository tests

Explores:

  • Using http4s with cats-effect
    • Using rho for Swagger support
  • Chimney for assisting in DDD model transforms between layers
  • Using doobie with cats-effect
  • Pureconfig for loading configuration
  • Flyway for handling migrations
  • Docker testkit for bringing up Docker containers on a per-test-suite basis
  • sbt-native-packager for bundling the app into a Docker image
  • sbt-docker-compose for bringing up a docker-compose environment based on the main project and a docker-compose.yml file
    • Can run the whole project from sbt via sbt dockerComposeUp (stopped via dockerComposeStop)
    • Also used for running Integration tests from a separate subproject
  • Swagger API spec w/ UI via Webjar

Usage

Docker is essential to having fun here, so go download it if you don't have it installed.

Browse the API Spec (Swagger)

sbt dockerComposeUp and go to the root in your browser (e.g. localhost). It will start a docker-compose environment that includes the web-server and dependencies.

Tests

  • sbt test will run normal tests
  • sbt dockerComposeTest will run integration tests

Notes

On Rho

  • Tying route definition + doc generation together with route implementation is genius. It means the spec is always up to date
    • The type-level mechanism (e.g. that huge HList for capturing status + response types) is amazing. A lot of things just work
      • Multiple branches in your code that respond with different statuses and types get reflected in the generated docs.
      • AnyVal wrappers are exposed in the documentation as their underlying type.
    • Composing routes + documentation is just by value
  • At the "end of the world", you can combine all your Rho service into a single http4s service (currently by calling .toService and passing in a Rho middle ware). This causes the routes and specs to get compiled.
    • This means it's entirely possible to have Rho work along side APIs defined as vanilla http4s endpoints.
  • Areas for improvement
    • Support for more areas of spec generation
      • On models themselves; completely lacking, save for withCustomSerializer usage (see docs), which is not optimal (far away from actual models). Would be awesome if it:
        • It could be extended (or default to) using Swagger API annotations is they are there.
        • Allowed defining the case-ness (e.g. snake or camel)of outputted JSON schema annotations, for example
      • Support more things like endpoint tags and summary (maybe these exist, not sure)
    • Documentation is a bit sparse; there's a wiki and some examples ... but that's it.

On http4s

  • Integration with Cats standard libs is amazing

    • Not being tied to a specific Effect is very liberating (ie working with F[_] throughout is very clean, no need for implicit eCtx: ExecutionContext boilerplate everywhere)
  • Comes out of the box with support for various middlewares (auth and there is also tsec, a crypto lib with an http4s integration module.

  • Used in production at a number of places, including Verizon, Jack Henry, etc.

  • Various integrations exist, like

    • kamon-http4s
    • typedapi
    • Various JSON libs like circe, json4s (powered by Jackson or Native), Play-JSON, etc.
  • http4s itself supports running on various servers other than Blaze (default), including as a Servlet, enabling usage in:

    This is interesting because it makes migration easy (mount old Servlets with new ones.)

On Chimney

  • This is the real deal for DDD in Scala. Makes DDD so easy and painless.

On Doobie

  • Integrates well with the rest of the system due to Cats as lingua franca
  • What-you-write-is-what-you-get SQL usage
  • JDBC-based so it still blocks a thread somewhere; there is an issue for a way of emulating Slick3-style asynchronicity
  • Safe: type-checked of course, but there are also query soundness checks (see QuerySoundnessSpec) to check your queries against a real DB.

Docker usage

  • Using docker through the sbt plugin system smooths out integration testing and local manual testing. A boon for lowering the barrier of entry for devs getting started.

Feedback

Help me learn ! Ask questions, submit issues and PRs :)

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