- Please be aware of our Code of Conduct ❤️
- 🪸 Klaw's new frontend app
/coral
contains a React app. It's the rewrite of the existing Klaw frontend.
This is the setup you every time. You can find the different ways how to run the local development process below.
** ℹRequirements**
- node needs to be installed
-> see nvmrc or theengines
definition in package.json for version). - Coral uses pnpm (version 8) as a package manager. Read their official documentation how to install pnpm.
- navigate to this directory
- run
pnpm install
- run
pnpm add-precommit
the first time you install the repository to set the custom directory for our pre commit hooks.
You have different ways of working on Coral in the development process:
Note: We don't recommend using this way, except in a few cases. Development against a real Klaw API will yield in better developer confidence of the functionality and developer experience compared to using a mocked API.
This will run the Vite development server. Coral will run, but there is no API that it can consume. You will have to add a mocked response for authentication to be able to see the UI. In case you need data to work with, you'll have to mock API responses.
- You want to do small changes on areas that are not dealing with data from the API.
- You're want to do a small task first without having to set up a remote-api or docker.
- Please follow our Development without API guide
This will run the Vite development. It will use an external address as API source. For this, you need to have Klaw deployed to be able to connect to its API. The remote API can be a shared staging server, or even a production system.
- You have access to a deployed instance of Klaw and only want to do Frontend changes.
- You don't want to deal with setting up docker and running Klaw locally.
- Please follow our Development with remote API guide
This will run a small node proxy server. It will serve Coral via Vite development server locally and Klaw from a docker container, which will act as the remote API. With this, we want to enable contributors to have the better developer experience and confidence without the need to have a deployed instance of Klaw running and use this as remote API.
- You have don't have access to a deployed instance of Klaw or don't want to use that.
- You want a local environment for Klaw while also benefiting from the Vite development server (with hot module replacement)
- Please follow our Development with local API guide
Builds the Klaw application locally, bundling the Coral frontend with it.
You can see how your local state of Coral will look and behave like in the production-ready build. This can be useful for manual testing and exploring.
- navigate to this directory
- run
pnpm install
- go to the root directory and follow the instructions on how to run Klaw
➡️ Based on Springboot application properties configuration:
- Klaw will run in
https://localhost:9097
if TLS is enabled - Klaw will run in
http://localhost:9097
if TLS is not enabled
ℹ️ You can see all our scripts in the package.json
.
You can also run pnpm
in your console to get a list of all available scripts.
build
: builds the frontend app for productiondev
: starts the frontend app for development in development mode with remote APIdev-without-api
starts the frontend app in development mode without apilint
: runs a code format check and if no error is found, lints the code.- the linting script does not mutate your code. See Linting and code formatting for more info.
preview
: builds a preview production build locallyreformat
: runs the code formatter (prettier) and reformat all codetest-dev
: runs all test tests related to changed files in a watch modetest
: runs all tests one timetsc
: runs the TypeScript compilergenerate-toc
: generates Table of Contents for markdown files when they have this placeholder:<!-- auto-generated-toc-start --> <!-- auto-generated-toc-end -->
generate-toc -f path/to/your/file.md
: generates Table of Contents for one given markdown file when is has this placeholder:<!-- auto-generated-toc-start --> <!-- auto-generated-toc-end -->
ℹ️ We are using a custom hook path for enabling pre-commit hooks. This path is set in the local git config when running pnpm install
. See script pnpm:devPreinstall
.
- TypeScript - 📃 documentation | 🐙 repository
- React - 📃 documentation | 🐙 repository
- Vite - 📃 documentation | 🐙 repository
- Jest - 📃 documentation | 🐙 repository
- React Testing Library - 📃 documentation | 🐙 repository
📃 You can find more detailed information about testing in our docs for Frontend Testing.
How we keep our app's codebase looking consistent and nice 💅🏼
The script lint
runs a prettier check and eslint after. It does not mutate your code in any way. If you want to format your code or let eslint fix it for you, you can run:
- First:
pnpm reformat
(prettier formatting) - After that:
pnpm eslint --fix
(eslint in fix mode)
ℹ️ It's convenient to let prettier and eslint auto-format your code "on save" by your IDE or editor.
Coral uses the component library of Aiven's Aquarium design system:
- 📃 documentation component library
- 📙 more information about Aquarium DS
- the repository is open source, but
private
at the moment
As a rule, please don't use css classes from the design system. All styles should be created by using the existing components and their properties.
When we need custom styles - which should not be the case very often - we use css modules. This enables us to add scoped css rules. Class names should be written in camelCase.
- We use styles in
accessibility.modules.css
to add css rules in order to improve accessibility. Add these styles with caution, since they are globally available. - In
main.modules.css
are global styles that are needed as fundamentals.
🔄 Work in progress related to styles
- We plan to add css variables based on the design system's tokens.
- We plan to have a custom theme for Klaw. This will be used instead of the Aiven theme.
More detailed documentation about coral
can be found in the docs
folder.