The server subproject is responsible for authentication, persistence, and the handling of game sessions.
boards-server uses the following libraries, which will be installed automatically by sbt:
- The Play Framework for handling web requests on the server.
- Slick for database access by functional relational mapping.
- H2 for running an embedded database.
- Apache Pekko, an actor framework, used here for managing server-side state in relation to web socket sessions.
- Circe for automatic serialisation/deserialisation to/from JSON.
- scala/controllers/ handlers for HTTP and websocket requests.
- scala/models/ database actions for querying or updating persistent state.
- scala/schema/ database table schema, used to represent database tables and rows therein directly in the language.
- public/ contains all assets (audio and textures) used by the website and games.
- resources/ contains configuration/routes for the Play framework, as well as database migration scripts.
- twirl/ contains webpage templates for server-side rendering.
This subproject is compiled exclusively to JVM bytecode and only runs on the server.
For most parts of the application, we use standard HTTP GET/POST requests to communicate with the client. The major exception is for the game view itself, where a websocket is the more natural choice. In the controllers directory, classes ending with "___Controller.scala" are for handling GET/POST requests, whereas classes ending with "___Actor.scala" are for handling websocket messages.
We use an embdedded H2 database. No special setup is required. All data is stored locally in the repository for testing.
Boards only uses client-side rendering. Thus, the twirl directory is almost empty - we need only a single template.