Skip to content

Commit 25b491f

Browse files
committed
docs(ui): add developer readme
1 parent 9b7e30b commit 25b491f

File tree

4 files changed

+110
-26
lines changed

4 files changed

+110
-26
lines changed

README.md

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,9 @@ Keip Canvas is hosted at https://octoconsulting.github.io/keip-canvas/
2727

2828
## Development
2929

30-
To run the Keip Canvas UI locally, first make sure these prerequisites are installed:
30+
To get started with developing the Canvas UI, see the [dev docs](./ui/DEVELOPER.md).
3131

32-
- Node.js v20
33-
- npm v10
34-
35-
Clone the repository:
36-
37-
```shell
38-
git clone https://github.com/OctoConsulting/keip-canvas.git && cd keip-canvas/ui
39-
```
40-
41-
Install dependencies:
42-
43-
```shell
44-
npm install
45-
```
46-
47-
Run the development web server:
48-
49-
```shell
50-
npm run dev
51-
```
52-
53-
Check the `ui/package.json` for more useful commands
54-
55-
### Architecture
32+
## Architecture
5633

5734
For more details on how Keip Canvas is implemented, see the [architecture documentation](docs/ARCHITECTURE.md).
5835

docs/ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Fetches XML Schema Definitions (XSD) and parses them into a catalog of EIP Compo
3333
The resulting component definitions are then used by the Canvas UI to populate the draggable node menu and provide the
3434
user with a specific set of configuration options for each EIP component type.
3535

36-
### [Keip Canvas UI](../README.md)
36+
### [Keip Canvas UI](../ui/DEVELOPER.md)
3737

3838
A single-page web application that provides drag, drop, and link capabilities for creating integration flow diagrams.
3939

ui/DEVELOPER.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Keip Canvas UI Overview
2+
3+
The UI is built around a canvas that allows you to drag, drop, and
4+
connect [EIP](https://www.enterpriseintegrationpatterns.com/patterns/messaging/) nodes to create integration flows.
5+
In addition to being a design and documentation tool, the UI allows you to configure the behavior of the individual EIP
6+
nodes, thus providing the ability to generate deployable integration flow artifacts (e.g. XML).
7+
8+
## Requirements
9+
10+
For local development, the following must be installed:
11+
12+
- Node.js v20
13+
- npm v10 (other package managers should work as well)
14+
15+
[Volta](https://volta.sh/) is recommended for setting up your JS environment.
16+
17+
### Run the dev server
18+
19+
Clone the repository:
20+
21+
```shell
22+
git clone https://github.com/OctoConsulting/keip-canvas.git && cd keip-canvas/ui
23+
```
24+
25+
Install dependencies:
26+
27+
```shell
28+
npm install
29+
```
30+
31+
Run the development web server:
32+
33+
```shell
34+
npm run dev
35+
```
36+
37+
## Dependencies
38+
39+
The UI is mostly written in Typescript and relies heavily on the following libraries:
40+
41+
- [React](https://react.dev/): main UI library
42+
- [React Flow](https://reactflow.dev/): powers the interactive flow canvas
43+
- [Zustand](https://github.com/pmndrs/zustand): state-management
44+
- [Carbon Design System](https://carbondesignsystem.com/): React component library
45+
- [Vite](https://vite.dev/): build tooling
46+
47+
## Structure
48+
49+
The source code is spread across multiple modules, some important ones are highlighted below:
50+
51+
### api
52+
53+
Defines the types and interfaces used across the UI components. Notably, the `api/generated` subdirectory contains
54+
code generated from the [EIP Json schemas](../schemas/README.md). To use updated source schemas,
55+
the [code-generation script](./genApiFromSchema.js) must be updated to point to the desired schema versions.
56+
The API files can then be generated by running `npm run codegen`.
57+
In this specific case, the generated files should be checked into version control to avoid the need to constantly
58+
rebuild them.
59+
60+
### assets
61+
62+
Holds static assets such as the EIP icon SVGs.
63+
64+
### components
65+
66+
Contains all the UI's React components. Developers will likely spend the majority of their time working in here.
67+
68+
### json
69+
70+
Stores the [EIP Component Definition](../schemas/model/json/eipComponentDef.schema.json) JSON, which populates the
71+
catalog of EIP nodes that a user is able to drag and drop onto the canvas.
72+
73+
### singletons
74+
75+
Initializes singleton instances that are required across the application, most notable is the `store` module.
76+
The `store` module manages the React application's global state, through the use of a Zustand store.
77+
The module does not provide direct access to the app store, rather several use-case/event specific custom hooks are
78+
exported for use by components. This helps us keep stateful business logic encapsulated inside the store.
79+
80+
## Formatting and Linting
81+
82+
Formatting and linting is handled by [Prettier](https://prettier.io/) and [ESLint](https://eslint.org/) respectively.
83+
84+
Formatting commands:
85+
86+
```shell
87+
# check only
88+
npm run check-format
89+
90+
# apply formatting
91+
npm run format
92+
```
93+
94+
Run linter:
95+
96+
```shell
97+
npm run lint
98+
```
99+
100+
Rules are configured in:
101+
102+
- Prettier: [.prettierrc.json](./.prettierrc.json)
103+
- ESLint: [.eslintrc.cjs](./.eslintrc.cjs)
104+
105+
Consult your IDE's documentation on how to integrate these rules.

ui/genApiFromSchema.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import path from "node:path"
77
// TODO: Look into avoiding duplication of generated types when multiple top-level schemas
88
// reference the same common schemas.
99

10+
// TODO: Use git tags instead of commit hashes
11+
// To use an updated source schema, change this to point to the desired version.
1012
const COMMIT_HASH = "4fe59e1438fad31b79c87568686cf867fd14a41e"
1113

1214
const SCHEMAS = ["eipComponentDef.schema.json", "eipFlow.schema.json"]

0 commit comments

Comments
 (0)