Skip to content

Commit f57b277

Browse files
psychedelicioushipsterusername
authored andcommitted
feat(ui/docs): clean up frontend readme
Updated info and consolidated into single file
1 parent e62991c commit f57b277

5 files changed

Lines changed: 79 additions & 156 deletions

File tree

invokeai/frontend/web/docs/API_CLIENT.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

invokeai/frontend/web/docs/EVENTS.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

invokeai/frontend/web/docs/NODE_EDITOR.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

invokeai/frontend/web/docs/PACKAGE_SCRIPTS.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

invokeai/frontend/web/docs/README.md

Lines changed: 79 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,98 @@
11
# InvokeAI Web UI
22

3+
<!-- @import "[TOC]" {cmd="toc" depthFrom=1 depthTo=6 orderedList=false} -->
4+
5+
<!-- code_chunk_output -->
6+
37
- [InvokeAI Web UI](#invokeai-web-ui)
4-
- [Stack](#stack)
8+
- [Core Libraries](#core-libraries)
9+
- [Redux Toolkit](#redux-toolkit)
10+
- [Socket\.IO](#socketio)
11+
- [Chakra UI](#chakra-ui)
12+
- [KonvaJS](#konvajs)
13+
- [Vite](#vite)
14+
- [i18next & Weblate](#i18next--weblate)
15+
- [openapi-typescript](#openapi-typescript)
16+
- [Client Types Generation](#client-types-generation)
17+
- [Package Scripts](#package-scripts)
518
- [Contributing](#contributing)
619
- [Dev Environment](#dev-environment)
20+
- [VSCode Remote Dev](#vscode-remote-dev)
721
- [Production builds](#production-builds)
822

9-
The UI is a fairly straightforward Typescript React app. The only really fancy stuff is the Unified Canvas.
23+
<!-- /code_chunk_output -->
24+
25+
The UI is a fairly straightforward Typescript React app.
26+
27+
## Core Libraries
28+
29+
The app makes heavy use of a handful of libraries.
30+
31+
### Redux Toolkit
32+
33+
[Redux Toolkit](https://github.com/reduxjs/redux-toolkit) is used for state management and fetching/caching:
34+
35+
- `RTK-Query` for data fetching and caching
36+
- `createAsyncThunk` for a couple other HTTP requests
37+
- `createEntityAdapter` to normalize things like images and models
38+
- `createListenerMiddleware` for async workflows
39+
40+
We use [redux-remember](https://github.com/zewish/redux-remember) for persistence.
41+
42+
### Socket\.IO
43+
44+
[Socket\.IO](https://github.com/socketio/socket.io) is used for server-to-client events, like generation process and queue state changes.
45+
46+
### Chakra UI
47+
48+
[Chakra UI](https://github.com/chakra-ui/chakra-ui) is our primary UI library, but we also use a few components from [Mantine v6](https://v6.mantine.dev/).
49+
50+
### KonvaJS
51+
52+
[KonvaJS](https://github.com/konvajs/react-konva) powers the canvas. In the future, we'd like to explore [PixiJS](https://github.com/pixijs/pixijs) or WebGPU.
53+
54+
### Vite
55+
56+
[Vite](https://github.com/vitejs/vite) is our bundler.
57+
58+
### i18next & Weblate
59+
60+
We use [i18next](https://github.com/i18next/react-i18next) for localisation, but translation to languages other than English happens on our [Weblate](https://hosted.weblate.org/engage/invokeai/) project. **Only the English source strings should be changed on this repo.**
61+
62+
### openapi-typescript
63+
64+
[openapi-typescript](https://github.com/drwpow/openapi-typescript) is used to generate types from the server's OpenAPI schema. See TYPES_CODEGEN.md.
1065

11-
Code in `invokeai/frontend/web/` if you want to have a look.
66+
## Client Types Generation
1267

13-
## Stack
68+
We use [`openapi-typescript`](https://github.com/drwpow/openapi-typescript) to generate types from the app's OpenAPI schema.
1469

15-
State management is Redux via [Redux Toolkit](https://github.com/reduxjs/redux-toolkit). We lean heavily on RTK:
16-
- `createAsyncThunk` for HTTP requests
17-
- `createEntityAdapter` for fetching images and models
18-
- `createListenerMiddleware` for workflows
70+
The generated types are written to `invokeai/frontend/web/src/services/api/schema.d.ts`. This file is committed to the repo.
1971

20-
The API client and associated types are generated from the OpenAPI schema. See API_CLIENT.md.
72+
The server must be started and available at <http://127.0.0.1:9090>.
2173

22-
Communication with server is a mix of HTTP and [socket.io](https://github.com/socketio/socket.io-client) (with a simple socket.io redux middleware to help).
74+
```sh
75+
# from the repo root, start the server
76+
python scripts/invokeai-web.py
77+
# from invokeai/frontend/web/, run the script
78+
yarn typegen
79+
```
2380

24-
[Chakra-UI](https://github.com/chakra-ui/chakra-ui) for components and styling.
81+
## Package Scripts
2582

26-
[Konva](https://github.com/konvajs/react-konva) for the canvas, but we are pushing the limits of what is feasible with it (and HTML canvas in general). We plan to rebuild it with [PixiJS](https://github.com/pixijs/pixijs) to take advantage of WebGL's improved raster handling.
83+
See `package.json` for all scripts.
2784

28-
[Vite](https://vitejs.dev/) for bundling.
85+
Run with `yarn <script name>`.
2986

30-
Localisation is via [i18next](https://github.com/i18next/react-i18next), but translation happens on our [Weblate](https://hosted.weblate.org/engage/invokeai/) project. Only the English source strings should be changed on this repo.
87+
- `dev`: run the frontend in dev mode, enabling hot reloading
88+
- `build`: run all checks (madge, eslint, prettier, tsc) and then build the frontend
89+
- `typegen`: generate types from the OpenAPI schema (see [Client Types Generation](#client-types-generation))
90+
- `lint:madge`: check frontend for circular dependencies
91+
- `lint:eslint`: check frontend for code quality
92+
- `lint:prettier`: check frontend for code formatting
93+
- `lint:tsc`: check frontend for type issues
94+
- `lint`: run all checks concurrently
95+
- `fix`: run `eslint` and `prettier`, fixing fixable issues
3196

3297
## Contributing
3398

0 commit comments

Comments
 (0)