{"id":26474312,"url":"https://github.com/conduktor/scala-api-template","last_synced_at":"2025-10-15T08:23:10.530Z","repository":{"id":37012123,"uuid":"348702216","full_name":"conduktor/scala-api-template","owner":"conduktor","description":"Example Scala API to bootstrap new projects","archived":false,"fork":false,"pushed_at":"2023-03-04T00:12:57.000Z","size":356,"stargazers_count":47,"open_issues_count":17,"forks_count":11,"subscribers_count":12,"default_branch":"main","last_synced_at":"2023-03-05T15:47:17.023Z","etag":null,"topics":["best-practices","kafka","scala","template","zio"],"latest_commit_sha":null,"homepage":"https://www.conduktor.io","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/conduktor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-17T12:31:31.000Z","updated_at":"2023-02-16T19:35:07.000Z","dependencies_parsed_at":"2023-02-15T04:01:19.126Z","dependency_job_id":null,"html_url":"https://github.com/conduktor/scala-api-template","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduktor%2Fscala-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduktor%2Fscala-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduktor%2Fscala-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduktor%2Fscala-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conduktor","download_url":"https://codeload.github.com/conduktor/scala-api-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244520144,"owners_count":20465627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["best-practices","kafka","scala","template","zio"],"created_at":"2025-03-19T22:52:12.683Z","updated_at":"2025-10-15T08:23:10.447Z","avatar_url":"https://github.com/conduktor.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://www.conduktor.io/uploads/conduktor.svg\" width=\"256\"\u003e\n\n# Conduktor's Scala API template\n\nA template for writing Restful APIs we use at Conduktor.\n\n## Requirements \n\nThe requirements are:\n\n- store data into Postgres\n- handle Postgres schema and schema migration programmatically\n- expose domain logic via a RESTful API\n- describe the RESTful API using OpenAPI standard\n- secure the RESTful API with JWT using auth0 service (https://auth0.com) but avoid vendor lock-in\n- use only non-blocking technologies and implement only stateless services to handle high-scale workload\n- leverage Scala type-system and hexagonal architecture to minimize the testing requirements\n- enable testing at every layer: domain logic, end-to-end, data-access, RESTful API, integration of various layer combinations\n- enforce green tests and style conformance using Github actions\n- generate a docker image using Github actions and push it to a repository\n- allows developing proprietary software\n\n## Tech\n\nThis is the list of technologies we chose to implement our requirements:\n\n- http4s (https://http4s.org/) for HTTP implementation, APL v2 license\n- circe (https://circe.github.io/circe/) for JSON serialization, APL v2 license\n- tapir (https://tapir.softwaremill.com) for RESTful API description, APL v2 license\n- skunk (https://tpolecat.github.io/skunk/) for async (non-jdbc) Postgres access, MIT license\n- flyway (https://flywaydb.org/) for database schema handling, APL v2 license\n- zio (https://zio.dev/) for effect, streaming, logging, config and tests, APL v2 license\n- JWT validation using auth0-provided Java library, MIT license\n- refined (https://github.com/fthomas/refined) for defining value objects constraints, MIT license\n- newtype (https://github.com/estatico/scala-newtype) for generating value objects with no runtime cost, APL v2 license\n- sbt-native-packager (https://sbt-native-packager.readthedocs.io) for docker image generation, BSD-2-Clause License\n\n## Development flow\n\n- create branches from main\n- merge into main to release Staging via Github action\n- tag main to release Prod via Github action\n\nThe stack is deployed on Google Cloud (Cloud Run + Cloud SQL)\n\n\n## Migration\nDatabase provisioning / migration is done via [flyway](https://flywaydb.org/)\n\nThe migrations are applied at application start to ensure the database is up-to-date with current running code.\n\n\n## Auth\n\nAuth is a JWT validation + data extraction, against an auth0 tenant.\n\nWe retrieve the exposed public key from auth0, and use it to validate and decode the bearer token provided in the authorization header \n\n\n## ISSUES\n\n - Intellij can't type properly skunk's \"sql\" StringOps macro,\nusing Metals is therefore recommended when dealing with repositories\n\n## TODOS\n- use domain-specific errors\n- add streaming endpoints examples (paginated, websocket)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduktor%2Fscala-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconduktor%2Fscala-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduktor%2Fscala-api-template/lists"}