Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.

msimon/Scala-graphql-bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scala-graphql-bootstrap

Scala-graphql-bootstrap setup the groundwork for a scala/reactjs project using graphql.

It brings an akka server, structure for graphql class, setup link to mysql, handle migration using slick and a frontend client using reactjs/apollo. All in a mono-repo and launched with docker-compose.

The only dependency you need is docker. If you decide to not use docker you will have to install each project independently.

How to start

Run the test project

A simple make first will build the containers, install dependency for scala & react, and run the db migrations.

After that, you will be able to run the project with make run. Once everything is installed and the server is running you can go on localhost:8080 to play with it.

Step to fork it for your own project

  • NAME="yourproject"; find . -type f -not -path "./.git/*" -exec sed -i 's/bootstrap/'"$NAME"'/g' {} ;
  • NAME="yourproject"; mv ./backend/app/src/main/scala/com/bootstrap ./backend/app/src/main/scala/com/$NAME
  • Update backend/app.json file with your application description.
  • Update initial migration
  • Run make first
  • git remote rm origin
  • git remote add origin $your_project_repository

Note on Updating the inital migration

A migration for User & Token already exists. These 2 tables are used for the authentification in graphql. If you decide to modify them, you will have to modify the AuthMiddleware.scala file.

You can find the migration here: backend/migrations/src_migrations/main/scala/1.scala

If you modify this class after running the test project, run make clean_local_db clean_generated_code migrate to reset your local db & update your generated code.

For new migration run make new_migration, update the newly created file and add any new table to backend/migrations/src/main/scala/Codegen.scala. Then run make migrate.

Structure of the project

Backend

The akka server, the migration script, generated class. Anything needed to run a grapqhl server

  • backend/app: The actual application. Where you will spend most of your time
  • backend/generated_code: data classes generated by scala-forklift when running the migration
  • backend/migration_manager & backend/migrations: reserved for scala-forklift.

Frontend

A create-react-app application with apollo

Stack

Backend

  • Scala
  • Akka server
  • Slick
  • Graphql & Sangria

Frontend

  • ReactJs
  • Graphql & Apollo

Database

This project uses slick the data mapping between class and MySQL (http://slick.lightbend.com/).

The data classes are automatically generated using scala-forklift (https://github.com/lastland/scala-forklift).

Check how to add new migration here: https://github.com/lastland/scala-forklift/tree/develop/example

About

A simple project to easily bootstrap a graphql project using scala/reactjs

Topics

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors