> ## Content Index
> Fetch the complete content index at: https://honstain.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Scalatra Scala Service giter8 Template
- URL: https://honstain.com/scalatra-giter8/
- Published: 2018-12-31T20:58:05.000Z
- Updated: 2026-06-21T00:33:31.000Z
- Description: Walk-through of creating a basic Scalatra service and using IntelliJ
- Author: Anthony Honstain
- Tags: Scala, Scalatra, #Import 2024-01-27 15:52

Lets stand up a new Scala service from scratch. For this walk-through, I used Ubuntu 18.10.

Basic requirements:

- JDK8 `sudo apt install openjdk-8-jdk` Using version "1.8.0\_191"
- Scala Build Tool [https://www.scala-sbt.org/](https://www.scala-sbt.org/?ref=honstain.com) (I chose to download and manually add to my path - but the SBT docs recommend getting it via apt). Using version 1.2.1

## What we will get from this guide:

A basic Scalatra service that renders a basic html page using Twirl for server-side templating (Twirl is from Play 2) – [http://scalatra.org/guides/2.6/views/twirl.html](http://scalatra.org/guides/2.6/views/twirl.html?ref=honstain.com) It wont have much out of the gate other than the ability to define a route, render some html, and do logging (its default test verifies we can get a 200)

## Create a Scalatra project using giter8 Template

Following the tutorial - [http://scalatra.org/getting-started/first-project.html](http://scalatra.org/getting-started/first-project.html?ref=honstain.com)

```
organization [com.example]: org.bitbucket.honstain
name [My Scalatra Web App]: ToyInventoryApp
version [0.1.0-SNAPSHOT]: 
servlet_name [MyScalatraServlet]: ToyInventory
package [com.example.app]: org.bitbucket.honstain.app
scala_version [2.12.6]: 
sbt_version [1.2.1]: 
scalatra_version [2.6.4]: 

Template applied in /home/dev/Desktop/scalatra-blog/./toyinventoryapp
```

Sanity check that we can build:

```
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Loading settings for project toyinventoryapp from build.sbt ...
[info] Set current project to ToyInventoryApp (in build file:/home/dev/Desktop/scalatra-blog/toyinventoryapp/)
[info] sbt server started at local:///home/dev/.sbt/1.0/server/a4b28a03b2c11993f519/sock
```

I want to use IntelliJ (so I will demonstrate that, but other options are reasonable), so lets load that now:

![](https://honstain.com/content/images/2018/12/image-10.png)

![](https://honstain.com/content/images/2018/12/image-11.png)

![](https://honstain.com/content/images/2018/12/image-12.png)

It can take a bit for IntelliJ to finish indexing. When you're done you should hopefully see the basic project:

![](https://honstain.com/content/images/2018/12/image-13.png)

As described in [the Scalatra guide](http://scalatra.org/getting-started/first-project.html?ref=honstain.com), you can now start the app, I showed the IntelliJ example, but you should also try using SBT via the command line.

```
# Basic start
jetty:start

# Run the application with hot reload
~;jetty:stop;jetty:start
```

At this stage, we should hopefully have a basic Scalatra app running.

![](https://honstain.com/content/images/2018/12/image-14.png)

I have shared the public repo with this project on bitbucket [https://bitbucket.org/honstain/scalatra-example-blog/commits/9fe71828eee4e5942b8f48a8add691a26dfd9333](https://bitbucket.org/honstain/scalatra-example-blog/commits/9fe71828eee4e5942b8f48a8add691a26dfd9333?ref=honstain.com)