{"id":22472307,"url":"https://github.com/ckampfe/cork.g8","last_synced_at":"2025-08-01T21:10:29.842Z","repository":{"id":18715151,"uuid":"21925993","full_name":"ckampfe/cork.g8","owner":"ckampfe","description":"Simple API services, like Napa","archived":false,"fork":false,"pushed_at":"2014-10-05T04:53:00.000Z","size":1208,"stargazers_count":9,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-24T01:02:02.685Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ckampfe.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":"2014-07-17T02:40:09.000Z","updated_at":"2020-01-03T03:16:21.000Z","dependencies_parsed_at":"2022-08-28T15:46:12.974Z","dependency_job_id":null,"html_url":"https://github.com/ckampfe/cork.g8","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ckampfe/cork.g8","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fcork.g8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fcork.g8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fcork.g8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fcork.g8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckampfe","download_url":"https://codeload.github.com/ckampfe/cork.g8/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fcork.g8/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268297391,"owners_count":24228124,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-06T12:14:18.813Z","updated_at":"2025-08-01T21:10:29.812Z","avatar_url":"https://github.com/ckampfe.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cork #\n\nCork is a framework for easily building APIs in Scala, using [Scalatra](http://scalatra.org/), [ScalikeJDBC](http://scalikejdbc.org/), [HikariCP](http://brettwooldridge.github.io/HikariCP/), [Flyway](http://flywaydb.org/) and [Jetty](http://www.eclipse.org/jetty/).\n\n1. [Quickstart Guide](#quickstart-guide)\n2. [Deploying on Heroku](#deploying-on-heroku)\n3. [More](#more)\n\n# Quickstart Guide #\n\nThis is a short guide to help you get a service up and running with Cork as fast as possible.\n\n## Setup ##\n\nCork is a [giter8](https://github.com/n8han/giter8) template, so you need to have it installed:\n\n```\n$ brew update \u0026\u0026 brew install giter8\n```\n\nThen, create a new Cork project in your current directory with the `g8` command:\n```sh\n$ g8 ckampfe/cork\n```\n\nThis grabs the latest Cork template and applies it locally.\n\nYour new Cork project uses Scala's sbt. Before we do anything we have to give sbt the permissions it needs and build your project and start the sbt console:\n\n```sh\n$ chmod +ux sbt\n$ ./sbt\n```\n\n## Your first API ##\n\nInvoke the generator like so:\n```\n\u003e g8-scaffold api\n```\n\nFollow the prompts, and marvel at your new CRUD API router, model and database migration!\n\nMake your application aware of your API's top level route by adding  \n`context.mount(new BookApi(system), \"/books/*\")` in `ScalatraBootstrap.scala` and adjusting the API class and route to match the API name you provided. (Note that the route is plural, while the class is singular.)\n\n### Set up your database ###\n\nCork uses [Flyway](http://flywaydb.org/) to manage database migrations. Before running the generated migration to create your API's database table, make sure your database is properly set up. By default, Cork and Flyway expect to connect to a database with a name of the form `$SERVICE_NAME_development`. If you called your API `awesome service` in the earlier prompts, your database would be called `awesome_service_development`. In MySQL we could create it like so:\n```sh\n$ mysql -uroot\nmysql\u003e create database awesome_service_development;\n```\n\nMigrations will run when you start your application.\n\n\n### Start it up! ###\n\nCompile your project and start the servlet: \n\n```\n$ sbt compile stage\n$ foreman start\n```\n\nThat's it! Your service is now running and available on `http://localhost:5000`\n\n### Take it for a spin ###\n\nFor an API serving `Book` objects Cork will generate:\n\n- `GET /books`\n- `GET /books/:id`\n- `POST /books`\n- `PUT /books/:id`\n- `DELETE /books/:id`\n\nCurl to your heart's content.\n\n## Deploying on Heroku ##\n\nCreate and deploy a Cork app to Heroku like so:\n```sh\n$ cd your/cork/project\n$ heroku create --buildpack https://github.com/ckampfe/heroku-buildpack-scala\n$ git add .\n$ git commit\n$ git push heroku master\n```\n\nThe custom buildpack makes a minor tweak to the\ndefault Heroku slug compilation step, dropping unnecessary compilation\nartifacts to bring base slug size down from \u003e300MB to 200MB for OpenJDK 8,\nand from ~240MB to \u003c140MB for OpenJDK 7.\n\nTo build and run the application locally for development, run:\n\n```\n$ sbt compile stage\n$ foreman start\n```\n\nCork apps are served with an embedded Jetty servlet, but [sbt-native-packager](https://github.com/sbt/sbt-native-packager) is capable of generating `.war` and `.jar` objects for future flexibility.\n\nMore information about Scala on Heroku can be found [here](https://devcenter.heroku.com/articles/scala-support).\n\n## More ##\n\n### Why Cork? ###\n\nRead about the motivation for Cork [here](https://tech.bellycard.com/blog/rest-apis-in-scala/).\n\n### Creating your own database migrations ###\n\nCreating your own migrations is easy: they're just SQL. Create your migration in `src/main/resources/db/migration`, following the form of `VN+1__DoSomethingToSchema.sql`, where `N` is the number of your most recent migration.\n\nRestart your application to run the migrations.\n\nYou can access the Flyway documentation [here](http://flywaydb.org/documentation/).\n\n### Configuration ###\n\nCork uses [Typesafe's Config](https://github.com/typesafehub/config), so any\nenvironment configurations should live in `application.conf`. You should make\nthese available to your application in `Env.scala`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fcork.g8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckampfe%2Fcork.g8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fcork.g8/lists"}