@@ -30,63 +30,103 @@ the feature you would like to see, why you need it, and how it should work.
3030
3131## How to set up your environment and run tests
3232
33- The project can be developed with Eclipse, needs a PostgreSQL database and a
34- Redis key/value store. For authorisation, the following options are available:
35- Google, GitHub, Facebook, Twitter, and Keycloak.
33+ The backend is a ** Quarkus** application (Java 21, Gradle). The frontend is an
34+ ** Angular 11** single-page app served by the
35+ [ Quinoa] ( https://quarkiverse.github.io/quarkiverse-docs/quarkus-quinoa/dev/ )
36+ extension. Authentication is handled by ** Keycloak** .
3637
3738### Prerequisites
3839
39- For development, you need the following dependencies.
40+ | Tool | Version | Notes |
41+ | ------| ---------| -------|
42+ | Java JDK | 21 | Temurin / Corretto both work |
43+ | Docker + Docker Compose | any recent | runs PostgreSQL + Keycloak |
44+ | Node.js | 20 LTS | only needed for UI hot-reload; not required for the default dev flow |
4045
41- 1 . Java 8 JDK (i.e. OpenJDK 8)
42- 1 . Docker
43- 1 . Docker Compose
44- 1 . Node.js
46+ ### Running it (standard — no Node required)
4547
46- ### Using IntelliJ IDEA
48+ The default workflow serves the pre-built Angular artefacts from ` public/ui `
49+ directly via Quinoa. No Angular dev server or local Node installation is needed.
4750
48- 1 . Run the compile SBT task
51+ 1 . ** Start the backing services ** (PostgreSQL + Keycloak):
4952
50- ```
51- bin/activator compile
53+ ``` bash
54+ docker-compose up -d
5255 ```
5356
54- 1 . Import project in IntelliJ IDEA as a _ Scala_ project
55- 1 . Run the run configuration named _ Start Database_
56- 1 . Run the run configuration named _ Start Server_
57- 1 . Go to [ localhost:4210/ui] ( http://localhost:4210/ui ) to see it running
57+ 2 . ** Copy your credentials into ` .env ` ** (create it if it doesn't exist yet):
5858
59- ### Running it Manually
59+ ```
60+ AUTH_PROVIDERS=keycloak
61+ KEYCLOAK_CLIENT_ID=translatr-localhost
62+ KEYCLOAK_CLIENT_SECRET=<your-secret>
63+ ```
6064
61- 1 . Run the compile SBT task
65+ 3 . ** Start Quarkus in dev mode** — the ` copyUiToBuild ` task runs automatically
66+ first, staging the pre-built UI into ` build/quinoa/ ` :
6267
68+ ``` bash
69+ export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
70+ ./gradlew quarkusDev
6371 ```
64- bin/activator compile
65- ```
6672
67- 1 . Run database container by using _ docker compose_
73+ 4 . Open [ http://localhost:9000 ] ( http://localhost:9000 ) .
74+
75+ ### Running it (UI hot-reload — requires Node 20 LTS)
6876
77+ Use this when you are actively working on the Angular frontend and want instant
78+ browser refresh on file save.
79+
80+ 1 . Complete steps 1–2 from the standard flow above.
81+
82+ 2 . Install UI dependencies (first time only):
83+
84+ ``` bash
85+ cd ui && npm install
6986 ```
70- export POSTGRES_PASSWORD=translatr
71- docker-compose up
87+
88+ 3 . ** Terminal A** — start the Angular dev server:
89+
90+ ``` bash
91+ cd ui && npm start # listens on port 4210
7292 ```
7393
74- 1 . Run development server
94+ 4 . ** Terminal B** — uncomment the two ` dev-server ` lines in
95+ ` src/main/resources/application-dev.properties ` :
7596
97+ ``` properties
98+ %dev.quarkus.quinoa.dev-server.port =4210
99+ %dev.quarkus.quinoa.dev-server.managed =false
76100 ```
77- export AUTH_PROVIDERS=keycloak
78- export KEYCLOAK_CLIENT_ID=translatr-localhost
79- export KEYCLOAK_CLIENT_SECRET=$YOUR_KEYCLOAK_CLIENT_SECRET
80- export REDIRECT_BASE=http://localhost:4210
81- bin/activator ~run -Dconfig.file=dev.conf
101+
102+ Then start Quarkus:
103+
104+ ``` bash
105+ ./gradlew quarkusDev
82106 ```
83107
84- 1 . Go to [ localhost:4210/ui] ( http://localhost:4210/ui ) to see it running
108+ 5 . Open [ http://localhost:9000 ] ( http://localhost:9000 ) .
109+
110+ > ** Note on Node versions**
111+ > Angular 11 uses webpack 4. Node 22+ dropped ` --openssl-legacy-provider ` ,
112+ > so ** Node 20 LTS** is required for ` npm start ` / ` npm run build ` .
113+ > The ` .node-version ` file in ` ui/ ` records the required version.
85114
86115### Authorisation
87116
88- To be able to use Translatr and create a user you need to authorise yourself.
89- This can be done in many ways, but you need at least one auth provider.
117+ At least one auth provider must be configured. The recommended choice for local
118+ development is Keycloak (started automatically by ` docker-compose up ` ).
119+
120+ #### Keycloak (recommended)
121+
122+ The ` docker-compose.yml ` starts a Keycloak instance on port ** 8088** and
123+ imports the ` docker/Translatr-realm.json ` realm automatically.
124+
125+ ```
126+ export AUTH_PROVIDERS=keycloak
127+ export KEYCLOAK_CLIENT_ID=translatr-localhost
128+ export KEYCLOAK_CLIENT_SECRET=<client-secret-from-realm>
129+ ```
90130
91131#### Google
92132
@@ -108,58 +148,27 @@ export GITHUB_CLIENT_ID=...
108148export GITHUB_CLIENT_SECRET=...
109149```
110150
111- #### Facebook
112-
113- Credentials can be retrieved from the [ Facebook for developers page] ( https://developers.facebook.com/apps ) .
114-
115- ```
116- export AUTH_PROVIDERS=facebook
117- export FACEBOOK_CLIENT_ID=...
118- export FACEBOOK_CLIENT_SECRET=...
119- ```
120-
121- #### Twitter
122-
123- Credentials can be retrieved from the [ Twitter Developer Documentation on OAuth] ( https://dev.twitter.com/docs/auth/oauth ) .
124-
125- ```
126- export AUTH_PROVIDERS=twitter
127- export TWITTER_CONSUMER_KEY=...
128- export TWITTER_CONSUMER_SECRET=...
129- ```
130-
131- #### Keycloak
132-
133- The realm needs to be named Translatr. This is a sample [ Keycloak app for Heroku] ( https://github.com/resamsel/keycloak-swarm-heroku ) .
134-
135- ```
136- export KEYCLOAK_HOST=http://localhost:8080
137- export KEYCLOAK_CLIENT_ID=...
138- export KEYCLOAK_CLIENT_SECRET=...
139- ```
140-
141151### Testing
142152
143- Unit and integration tests live in the ** test/** directory. In Eclipse, this
144- directory should be a source directory.
145-
146- Unit tests can be run by issuing the following command:
153+ Unit and integration tests use ** JUnit 5** and ** RestAssured** and run against
154+ the live PostgreSQL instance started by ` docker-compose ` .
147155
148- ```
149- bin/activator clean jacoco:cover -Dconfig.file= test.conf -J-Xmx1g
156+ ``` bash
157+ ./gradlew test
150158```
151159
152- Jacoco generates a coverage report in ** target/scala-2.11/jacoco/html /index.html**
160+ The test report is written to ` build/reports/tests/test /index.html` .
153161
154162### Debugging
155163
156- For debugging with your favorite IDE, just add the parameters ` -jvm-debug 9999 `
157- to the bin/activator command. Then connect your IDE to localhost with port 9999.
164+ Add the Quarkus debug flags to attach a remote debugger on port 5005:
158165
159- ```
160- bin/activator ~run -Dconfig.file=dev.conf -jvm-debug 9999
166+ ``` bash
167+ ./gradlew quarkusDev -Dsuspend=false -Ddebug=5005
161168```
162169
170+ Then connect your IDE to ` localhost:5005 ` .
171+
163172## How to add support for a new file format
164173
165174Adding support for new file formats is quite easy. The few steps necessary are defined in the following sections.
@@ -323,4 +332,3 @@ GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on
323332### Style Guide
324333
325334Use the [ Google style guide for Java] ( https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml ) .
326-
0 commit comments