Monorepo for the glowjob project.
/
├── apps
│ ├── api # Spring boot api
│ └── web # React web app powered by vite
└── libs
├── ui # Common UI components, hooks and utils
├── theme # Centralized Chakra-UI theme for all components
└── openapi # OpenAPI schema for API and auto-generated client services and typescript models
The front-end http client is auto-generated from the API OpenAPI schema using openapi-codegen. The codegen is run in 3 different situations :
.java
file is modified and saved in the api
app source code.web
app is build.nx run openapi:generate
command.This ensures that the client is always up to date with the API.
The output of the codegen is located in libs/openapi/src/generated
and the openapi specification is located in libs/openapi/src/openapi.yaml
.
Concretly, the codegen generates :
apiSchemas.ts
: all the typescript models synced on the request input and response data output of the api controllers.apiComponents.ts
: @tanstack/query
(previously react-query
) hooks for each API endpoint their associated fetch functions for classic async/await calls.apiFetcher.ts
: the fetcher
function used by @tanstack/query
to make the actual http calls, which is completely customizable and won't be overwritten by the codegen.In addition to classic nx
generators commands, the project have additionnal commands to help with development by generating different type of files:
pnpm g:web
: Generate files for apps/web
. It can generate following types of files dynamically:
component
: Generate a component.page
: Generate a page.pnpm g:ui
: Generate files for libs/ui
. It can generate following types of files dynamically:
component
: Generate a component with a storybook story.npm install --legacy-peer-deps
nx
globally
npm install -g nx
mvn -f apps/api/pom.xml dependency:resolve
Launch the Docker Compose stack used by the API
docker compose -f infra/docker/compose.yml up -d
mvn -f apps/api/pom.xml spring-boot:run
Be sure to launch the API before generating the definitions
mvn -f apps/api/pom.xml springdoc-openapi:generate
nx run web:dev
nx run web:build
nx run web:preview
nx run openapi:generate