Skip to content

Development

Jan Cizmar edited this page Mar 21, 2022 · 15 revisions

Running the backend

Prerequisites

The backend is written in Kotlin and in Spring Boot. To run it, you will need:

  • Java 11
  • Docker

How to run the backend

1. Clone this repo

./gradlew server-app:bootRun -Dspring.active.profile=dev

2. Run it

You can use

2a. Running with Gradle:

server-app:bootRun -Dspring.active.profile=dev

2b. Running with Idea CE (free and open-source)

  1. Open the root dir in Idea CE
  2. Click Edit configurations button in top right corner
  3. Add new configuration with plus button
  4. Select Gradle
  5. Set run command to
server-app:bootRun -Dspring.active.profile=dev
  1. Click run/debug button in top right corner with the newly created configuration

2c. Running with Idea Ultimate

  1. Open the root dir in Idea Ultimate
  2. Edit run configurations in top right corner
  3. Duplicate Spring Boot auto created configuration
  4. Rename to "Application Dev"
  5. Set Active profiles input to "dev"
  6. Save by click OK
  7. Select the "Application Dev" configuration in the dropdown.
  8. Run it with Run/Debug button

Running the frontend

Prerequisites

  • node.js v14 or newer

How to run it

  1. go to webapp folder cd webapp
  2. Install npm packages "npm ci"
  3. Run it npm run dev

Static analysis

For frontend there are npm tasks prettier and eslint, which you should run before every commit, otherwise "Frontend static check" workflow will fail. You can also use prettier plugins for VS Code, Idea or WebStorm.

To fix prettier issues and check everything is fine, run these commands in webapp dir:

npm run prettier
npm run tsc
npm run eslint

On backennd, there is gradle task ktlint format, which helps you to format Kotlin code.

./gradlew ktlintFormat

Testing

Backend of Tolgee is tested with unit and integration tests. UI and it's interaction with backend is tested using E2E cypress tests.

Backend testing

To run backend tests, you can run gradle test task

./gradlew test

Or you can select any integration test the code and run it via Idea CE or Idea Ultimate. It should just work out of box.

E2E testing

Running E2E tests can be a bit more complicated.

To just run it, you can execute runE2e Gradle task.

./gradlew runE2e

However, when developing you would probably also want to modify the frontend code or debug the backend. To do so, you have to run 4 different tasks at the same time.

  1. Run the web app with E2e settings
./gradlew runWebAppNpmStartE2eDev
  1. Run the E2e Docker services like fake smtp server
./gradlew runDockerE2eDev

To be continued...

  1. Run

Clone this wiki locally