From 8a0e812e4aaa95ea6f7d30ea05deffe3ec1964bf Mon Sep 17 00:00:00 2001 From: Gianpaolo Date: Tue, 17 Feb 2026 16:09:41 +0100 Subject: [PATCH 1/6] chore: add missing environment files to .dockerignore --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.dockerignore b/.dockerignore index 92a83a582..949ca3e31 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,8 +3,10 @@ node_modules .git .husky generate-devel-token.json +generate-local-token.json build Dockerfile .env.production.local .env.development.local +.env.development .env.local \ No newline at end of file From 6cc4f224bc7b6672434bc8604da93bd01e58b827 Mon Sep 17 00:00:00 2001 From: Gianpaolo Date: Tue, 17 Feb 2026 16:41:21 +0100 Subject: [PATCH 2/6] chore: update .env.template with all required variables --- .env.template | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.env.template b/.env.template index de4cdbd7a..adcbbd4f9 100644 --- a/.env.template +++ b/.env.template @@ -1,2 +1,16 @@ -REACT_APP_API_URL=https://dev.unguess.io/api -REACT_APP_CROWD_WP_URL=https://dev.unguess.io \ No newline at end of file +# API +REACT_APP_API_URL=https://dev.unguess.io/api # Comment this line to use local API and uncomment on testing staging or production API +REACT_APP_CROWD_WP_URL=https://dev.unguess.io +REACT_APP_TRYBER_URL=https://dev.tryber.me + +# Analytics +REACT_APP_GTM_ID= +REACT_APP_GA4_ID= + +# Strapi CMS +REACT_APP_STRAPI_URL=https://admin.unguess.io +REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api +REACT_APP_STRAPI_API_TOKEN= + +# Auth (development only - bypass login with a JWT token) +REACT_APP_DEFAULT_TOKEN= From d7141663d9ed1087a4482e2e97f98a2119006e64 Mon Sep 17 00:00:00 2001 From: Gianpaolo Date: Tue, 17 Feb 2026 16:59:46 +0100 Subject: [PATCH 3/6] docs: replace CRA boilerplate README with project-specific documentation --- README.md | 83 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index b87cb0044..8b5b965ad 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,77 @@ -# Getting Started with Create React App +# UNGUESS React -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +Frontend web app della piattaforma UNGUESS. -## Available Scripts +## Tech Stack -In the project directory, you can run: +React, TypeScript, Vite, Redux Toolkit, styled-components -### `npm start` +## Setup locale -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +### Prerequisiti -The page will reload if you make edits.\ -You will also see any lint errors in the console. +- Node.js >= 20 +- npm -### `npm test` +### Installazione -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. +```bash +npm ci +``` -### `npm run build` +### Configurazione environment -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. +Copia il template e personalizza i valori: -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! +```bash +cp .env.template .env.local +``` -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. +Le variabili principali da configurare in `.env.local`: -### `npm run eject` +| Variabile | Descrizione | +| ---------------------------- | ---------------------------------------------------------------------------------- | +| `REACT_APP_API_URL` | URL delle API (locale: `http://localhost:3002`, dev: `https://dev.unguess.io/api`) | +| `REACT_APP_DEFAULT_TOKEN` | JWT token per bypassare il login in sviluppo | +| `REACT_APP_STRAPI_API_TOKEN` | Token di autenticazione per le API Strapi | -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** +Le altre variabili nel template hanno gia' valori di default adatti allo sviluppo. -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. +### Avvio -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. +```bash +npm start +``` -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. +Apri [http://localhost:3000](http://localhost:3000). -## Learn More +## Script principali -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). +| Comando | Descrizione | +| ------------------------- | ------------------------------------------- | +| `npm start` | Avvia il dev server Vite | +| `npm run build` | Build di produzione nella cartella `build/` | +| `npm run generate-api` | Genera i tipi TypeScript dall'OpenAPI spec | +| `npm run generate-schema` | Genera lo schema TypeScript dall'API | +| `npm run lint` | Esegue ESLint | +| `npm run format:check` | Verifica la formattazione con Prettier | +| `npm run type:check` | Verifica i tipi TypeScript | +| `npm run validate` | Esegue lint + type check + format check | -To learn React, check out the [React documentation](https://reactjs.org/). +## Environment: build-time vs runtime + +L'app usa due meccanismi diversi per le variabili d'ambiente: + +### Build-time (Vite) + +Le variabili `REACT_APP_*` definite nei file `.env.*` vengono iniettate al momento del build da Vite come `process.env.REACT_APP_*`. Sono fissate nel bundle JavaScript e non modificabili dopo il build. + +File coinvolti: `.env.development`, `.env.production`, `.env.local` + +### Runtime (Docker) + +Le variabili `REACT_APP_ENVIRONMENT` e `REACT_APP_VERSION` vengono iniettate a runtime dal container Docker tramite `docker-entrypoint.sh`, che genera il file `public/static/env-config.js` con l'oggetto `window.react_env`. + +Questo permette di usare la stessa immagine Docker in ambienti diversi (staging, production) cambiando solo le variabili d'ambiente del container. + +File coinvolti: `docker-entrypoint.sh`, `public/static/env-config.js`, `src/types.d.ts` From 71a4edaa766a1db73cbd36eced3c60ccfdf9036e Mon Sep 17 00:00:00 2001 From: Gianpaolo Date: Tue, 17 Feb 2026 17:12:00 +0100 Subject: [PATCH 4/6] chore: remove unused .env.test and clean up dead variables from .env files --- .env.development | 7 ++++--- .env.production | 2 -- .env.test | 9 --------- 3 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 .env.test diff --git a/.env.development b/.env.development index 3471bb65e..cb58c7002 100644 --- a/.env.development +++ b/.env.development @@ -1,8 +1,9 @@ REACT_APP_GTM_ID=GTM-WVXPS94 REACT_APP_GA4_ID=G-3G0Z44ZM07 -REACT_APP_API_URL=https://dev.unguess.io/api + REACT_APP_TRYBER_URL=https://dev.tryber.me -REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ REACT_APP_STRAPI_URL=https://admin.unguess.io REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api -REACT_APP_CROWD_WP_URL= \ No newline at end of file + +## Comment next line to use local API and uncomment on testing staging or production API +#REACT_APP_API_URL=https://dev.unguess.io/api diff --git a/.env.production b/.env.production index 77c2ae402..117116b3a 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,5 @@ REACT_APP_GTM_ID=GTM-WVXPS94 REACT_APP_GA4_ID=G-2M29YVTK78 REACT_APP_API_URL=/api REACT_APP_TRYBER_URL=https://app.tryber.me -REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ REACT_APP_STRAPI_URL=https://admin.unguess.io REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api -REACT_APP_CROWD_WP_URL= \ No newline at end of file diff --git a/.env.test b/.env.test deleted file mode 100644 index 6444bd325..000000000 --- a/.env.test +++ /dev/null @@ -1,9 +0,0 @@ -REACT_APP_GTM_ID= - -REACT_APP_API_URL=https://dev.unguess.io/api - -REACT_APP_DEFAULT_TOKEN= - -REACT_APP_CROWD_WP_URL=https://dev.tryber.me - -REACT_APP_DATADOG_CLIENT_TOKEN= From f52fad7f143abf2f982236561d1eda6ae9f6d340 Mon Sep 17 00:00:00 2001 From: Gianpaolo Date: Wed, 18 Feb 2026 09:12:36 +0100 Subject: [PATCH 5/6] chore: remove .env.test.local from .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 61f8a3e18..795e504a3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,6 @@ .env .env.local .env.development.local -.env.test.local .env.production.local npm-debug.log* From 2757a4e15334bc0dcc3f925a6f98f726cc3b2fd9 Mon Sep 17 00:00:00 2001 From: Gianpaolo Date: Wed, 18 Feb 2026 14:58:04 +0100 Subject: [PATCH 6/6] fix: restore REACT_APP_API_URL in .env.development for CI compatibility --- .env.development | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.development b/.env.development index cb58c7002..df8d7362d 100644 --- a/.env.development +++ b/.env.development @@ -6,4 +6,4 @@ REACT_APP_STRAPI_URL=https://admin.unguess.io REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api ## Comment next line to use local API and uncomment on testing staging or production API -#REACT_APP_API_URL=https://dev.unguess.io/api +REACT_APP_API_URL=https://dev.unguess.io/api