akanjs 3.3.0-rc.2 → 3.3.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,44 @@
4
4
 
5
5
  ### Minor Changes
6
6
 
7
+ - 90d740f: `native.ios.hideFormAccessoryBar: true` (or a target's `ios.hideFormAccessoryBar`) leaves out the bar WebKit shows above the keyboard while a page field is focused. The iOS shell already had the switch, but `akan.config.ts` refused the key and the native config never carried it, so every iOS app showed the bar.
8
+
9
+ The key defaults to false, so existing apps are unchanged. The api report lists one new optional `AkanNativeIosConfig` property; no upgrade step is needed.
10
+
11
+ - 3032627: An iOS app's page now meets the keyboard the way a native screen does: its content ends at the keys and moves with them, and a header stays where it is. In keyboard mode "none" (what akan apps ship) WKWebView still met the keyboard on its own, insetting its scroll view and panning the whole page until the focused field cleared the keys, so the header went off screen, the page showed under the status bar, and whatever the frame did for the keyboard came on top of the pan. The iOS shell now takes the keyboard notifications away from WKWebView in "none", as Capacitor's Keyboard plugin does, and tells the page through `__AKAN_NATIVE__.keyboardAvoidance = "page"`. Under such a shell the frame ends every page's content at the keys (not only a page with a keyboard accessory), drops the bottom safe area and inset the keys cover, animates on the duration the shell reports with UIKit's keyboard curve (`IOS_KEYBOARD_ANIMATION_EASING`), and scrolls a field the keys cover back into view; a dialog ends at the keys too, `useVisualViewportFrame` reports the keys from the shell, `KeyboardAvoiding` steps aside, and `--akan-keyboard-duration` / `--akan-keyboard-easing` plus `data-akan-keyboard` (while the keys are up) on the root let a page move its own parts with the keys. A page under an older shell, which still pans, keeps today's behavior.
12
+
13
+ The api report lists additions only: `Device.keyboardAnimationMs`, `Device.keyboardHeight` and `Device.subscribeKeyboard`, the optional `KeyboardFrameState.avoidsContent` and `isPageKeyboardAvoidance` from `akanjs/webkit`; no upgrade step is needed. An iOS app gets the new behavior once it is built with this shell; a page that lifted its own composer by the keyboard's height under the old pan should drop that lift.
14
+
15
+ ### Patch Changes
16
+
17
+ - c44d068: A coding agent reads less to build its first app: the `akanjs` README keeps the path to a first app and links the rest on akanjs.com (17 KB to 7 KB), the `akan-page` and `akan-service` skills ship the API reference one section at a time with every entry named in the skill's index (`Link` now lists the anchor attributes it takes and `Link.Back`, `Link.Close` and `Link.Lang`), the `akan-page` skill holds what a first page looks up while `pageRule` keeps the deeper contract, and each rule is stated once across AGENTS.md, the path rules and the skills. Run `akan agent install` in a workspace to pick up the new files.
18
+ - 24315d1: A page asks for its stylesheet before its client chunks. The preload tags for the chunks a page's first screen imports are written at the end of `<head>` instead of at its top, so the stylesheet link comes first; the bootstrap module, the dictionary and the import map stay at the top. On a throttled mobile connection (Lighthouse's slow 4G applied in the browser, over HTTP/2) a 56-chunk page first paints about 160 ms sooner (1.83 s to 1.67 s), and a page whose largest element is a small image shows it about 140 ms sooner; a large image still shares the connection with the chunks and arrives when it did. Every chunk still starts loading with the document, so the page hydrates when it did.
19
+ - bf582c1: A page stored in the HTML cache is kept as the bytes it streamed, instead of being decoded to text and encoded again before compression. Storing a 600 KB page takes about a fifth of the main-thread time it did, and the stored page and every response from it are unchanged.
20
+ - c10f7cf: A loader sends its store at most 500 distinct keys per query and splits a larger batch into several queries that run together. A `load<Model>Many` or a nested list with more ids than a database takes in one statement now loads instead of failing: Postgres refused more than 65,534 values, and SQLite refused a `byQuery` batch of about 1,000 keys.
21
+ - c10f7cf: A loader asks its store for each key once per batch: loads of the same key in one batch share one lookup, and each caller still gets its own document wherever the loader has `copy`, as every model and declared loader does. A `new DataLoader(...)` without `copy` now hands the callers of a repeated key one result object, where a batch function that built a fresh object per position gave each its own: pass `copy` to keep them apart. A batch function that throws, or resolves to something that is not an array, now rejects its callers instead of leaving them waiting.
22
+ - 045699c: The `create-akan-workspace` README shows how to run it on a host with only Node and npm (`npx -y bun@1.4.4 x create-akan-workspace@latest`) and the `npm run build` / `npm start` scripts it then writes, and `akanjs`, `@akanjs/cli` and `create-akan-workspace` each carry a one-line `description`, so `npm view` says what the package is and how to start.
23
+ - 5c7e083: Every page of a list is read with one SQL text: the page offset is a bound parameter, so paging no longer adds a prepared statement per page to the SQLite statement cache or to each Postgres connection. On Postgres a list of two or more values (`q.oneOf`, `q.notOneOf`, a raw table's `$in` and `$nin`) is bound as one array, so its length adds no prepared statement either, and a list past the 65,534 parameters one statement may bind is now read. An insight is read in one statement instead of one per field, so its counts and sums come from one snapshot and, with six fields, in about a third of the time.
24
+ - aead1aa: A page render no longer sends the whole client manifest to the RSC worker with every request. The worker process receives a manifest once and each render names it by revision, which takes a burst of cached pages from about 38 ms to about 7 ms at the median on the docs app.
25
+
26
+ A page the RSC worker has cached replays as one message instead of one message and one timer wait per chunk: a cached page of the docs app answers in about 0.3 ms instead of 4.7 ms.
27
+
28
+ A render that produces many small chunks at once sends them as a few messages of up to 32 KB. A page still waiting on data sends what it has rendered at once, as before.
29
+
30
+ The server still fails a render whose stream it has 256 messages of undrained, and since a message now holds up to 32 KB that is about 8 MB of a streamed page where it was about 1 MB; a cached page arrives as one message, so it is never counted.
31
+
32
+ - 5c6d039: A precompressed `.br` or `.gz` asset is now streamed from disk instead of being read whole and copied on every request, which cuts the server CPU per asset request to about a quarter. In production the answer of whether a sidecar exists is remembered per path.
33
+ An existing zero-byte `.br` or `.gz` sibling is skipped, because an empty body is not valid brotli or gzip.
34
+ - 0492e0b: The SQLite cache sweeps expired entries through an index on their expiry, a thousand at a time with a pause between, so a large backlog no longer stalls the server for hundreds of milliseconds, and `hkeys` and `hentries` no longer run a sweep on every call. They skip expired fields themselves, so they return the same fields as before. The index is built once, at the first start after upgrading.
35
+ - 0492e0b: On the SQLite cache, a value or hash field written by another process is no longer removed by a `get` or `hget` that saw the key's previous, expired entry.
36
+ - 5c7e083: On SQLite a read, count or write by a list of ids (`q.oneOf` on `id`, which is how a batched load by id reads) goes through the primary key. A model with an index that leads with `removedAt` had a list of five or more ids read every live row instead: at 20,000 rows a load of five ids took about 6 ms and now takes about 0.03 ms.
37
+ - 98931e4: `akan start` boots the backend while the first base build runs: the backend loads its server graph beside the build and mounts the web surface as soon as the build's artifact is on disk, so the dev server is ready sooner.
38
+
39
+ The port now answers from the start of the build. A request to `localhost` or an IP address, page or API, waits for the first artifact; a build longer than the 15 s the gateway holds a request ends the wait with a 503 "Backend is starting" page that reloads itself. A request to one of the app's own domains (a custom local domain) gets that 503 at once until the backend is ready, because the build has not written the app's hosts yet; after that it is served as before, and any other Host is refused as before.
40
+
41
+ ## 3.2.0
42
+
43
+ ### Minor Changes
44
+
7
45
  - 038d918: Akan.js 3.2.0. Read **Upgrade notes** before deploying an app that runs 3.1.1: unguarded endpoints, log levels, the `Err` class, loaders, SQLite transactions, exit codes and a CLI version check change behaviour.
8
46
 
9
47
  **Highlights**
@@ -64,29 +102,6 @@
64
102
  - The build lock records its host and survives a dead remover, a Windows antivirus hold and a devcontainer; `akan` no longer rebuilds the dev CLI from a command it runs; the typecheck behind `akan verify` and `akan build` uses its incremental cache.
65
103
  - Internal: the largest classes and methods in `akanjs`, `@akanjs/devkit` and `@akanjs/cli` are split by concern with unchanged public members, and the `akanjs` facets import sibling files instead of their own barrel and list every export by name.
66
104
 
67
- ### Patch Changes
68
-
69
- - bf582c1: A page stored in the HTML cache is kept as the bytes it streamed, instead of being decoded to text and encoded again before compression. Storing a 600 KB page takes about a fifth of the main-thread time it did, and the stored page and every response from it are unchanged.
70
- - c10f7cf: A loader sends its store at most 500 distinct keys per query and splits a larger batch into several queries that run together. A `load<Model>Many` or a nested list with more ids than a database takes in one statement now loads instead of failing: Postgres refused more than 65,534 values, and SQLite refused a `byQuery` batch of about 1,000 keys.
71
- - c10f7cf: A loader asks its store for each key once per batch: loads of the same key in one batch share one lookup, and each caller still gets its own document wherever the loader has `copy`, as every model and declared loader does. A `new DataLoader(...)` without `copy` now hands the callers of a repeated key one result object, where a batch function that built a fresh object per position gave each its own: pass `copy` to keep them apart. A batch function that throws, or resolves to something that is not an array, now rejects its callers instead of leaving them waiting.
72
- - 5c7e083: Every page of a list is read with one SQL text: the page offset is a bound parameter, so paging no longer adds a prepared statement per page to the SQLite statement cache or to each Postgres connection. On Postgres a list of two or more values (`q.oneOf`, `q.notOneOf`, a raw table's `$in` and `$nin`) is bound as one array, so its length adds no prepared statement either, and a list past the 65,534 parameters one statement may bind is now read. An insight is read in one statement instead of one per field, so its counts and sums come from one snapshot and, with six fields, in about a third of the time.
73
- - aead1aa: A page render no longer sends the whole client manifest to the RSC worker with every request. The worker process receives a manifest once and each render names it by revision, which takes a burst of cached pages from about 38 ms to about 7 ms at the median on the docs app.
74
-
75
- A page the RSC worker has cached replays as one message instead of one message and one timer wait per chunk: a cached page of the docs app answers in about 0.3 ms instead of 4.7 ms.
76
-
77
- A render that produces many small chunks at once sends them as a few messages of up to 32 KB. A page still waiting on data sends what it has rendered at once, as before.
78
-
79
- The server still fails a render whose stream it has 256 messages of undrained, and since a message now holds up to 32 KB that is about 8 MB of a streamed page where it was about 1 MB; a cached page arrives as one message, so it is never counted.
80
-
81
- - 5c6d039: A precompressed `.br` or `.gz` asset is now streamed from disk instead of being read whole and copied on every request, which cuts the server CPU per asset request to about a quarter. In production the answer of whether a sidecar exists is remembered per path.
82
- An existing zero-byte `.br` or `.gz` sibling is skipped, because an empty body is not valid brotli or gzip.
83
- - 0492e0b: The SQLite cache sweeps expired entries through an index on their expiry, a thousand at a time with a pause between, so a large backlog no longer stalls the server for hundreds of milliseconds, and `hkeys` and `hentries` no longer run a sweep on every call. They skip expired fields themselves, so they return the same fields as before. The index is built once, at the first start after upgrading.
84
- - 0492e0b: On the SQLite cache, a value or hash field written by another process is no longer removed by a `get` or `hget` that saw the key's previous, expired entry.
85
- - 5c7e083: On SQLite a read, count or write by a list of ids (`q.oneOf` on `id`, which is how a batched load by id reads) goes through the primary key. A model with an index that leads with `removedAt` had a list of five or more ids read every live row instead: at 20,000 rows a load of five ids took about 6 ms and now takes about 0.03 ms.
86
- - 98931e4: `akan start` boots the backend while the first base build runs: the backend loads its server graph beside the build and mounts the web surface as soon as the build's artifact is on disk, so the dev server is ready sooner.
87
-
88
- The port now answers from the start of the build. A request to `localhost` or an IP address, page or API, waits for the first artifact; a build longer than the 15 s the gateway holds a request ends the wait with a 503 "Backend is starting" page that reloads itself. A request to one of the app's own domains (a custom local domain) gets that 503 at once until the backend is ready, because the build has not written the app's hosts yet; after that it is served as before, and any other Host is refused as before.
89
-
90
105
  ## 3.1.1
91
106
 
92
107
  ### Patch Changes
package/README.ko.md CHANGED
@@ -6,11 +6,9 @@
6
6
 
7
7
  **에이전트까지 들어 있는 TypeScript 프레임워크.** Bun으로 구동합니다.
8
8
 
9
- **화면을 만들면, 에이전트가 씁니다. 서버를 만들면, AI가 다룹니다.**
10
-
11
- 툴 스키마도, 따로 쓰는 MCP 서버도, 에이전트용 권한 모델도 없습니다. 사람을 위해 만든 앱이 그대로 AI가 쓰는 앱이
12
- 되고, 모델은 원하는 것을 고르면 됩니다. 비즈니스 코드 한 줄이 모든 레이어를 지나 여섯 플랫폼에 닿고, 쓰는 모두에게
13
- 이릅니다. 사람에게도, 에이전트에게도요.
9
+ Akan.js는 풀스택 TypeScript 프레임워크입니다. 필드 선언 한 줄이 스키마, 서비스, API, 클라이언트 상태, UI를 모두
10
+ 지나고, 같은 코드가 웹 앱, iOS·Android 앱, 데스크톱 앱으로 나갑니다. 가드를 단 엔드포인트는 그대로 MCP 툴이, 화면의
11
+ 컨트롤은 인페이지 에이전트 툴이 되고, 사람이 지나는 가드를 똑같이 지납니다.
14
12
 
15
13
  ## 빠른 시작
16
14
 
@@ -62,19 +60,10 @@ URL이라면, 코딩 에이전트는 묻지 않고 아래대로 진행하면 됩
62
60
  - **정해진 URL:** 페이지는 기본적으로 `/<locale>/…` 아래에 있습니다. 기본 로케일을 프리픽스 없는 경로
63
61
  (`/books/OL45804W`)로 내보내려면 `akan.config.ts`에 `i18n: { defaultLocale: "en", locales: ["en"], localePrefix:
64
62
  "as-needed" }`를 두세요. `<Link>`도 따라갑니다.
65
- - **Node와 npm만 있는 호스트:** 생성기를 npx로 실행하세요. 전역에 아무것도 쓰지 않습니다:
66
- `npx -y bun@1.4.4 x create-akan-workspace@latest . --app <app> --dir <folder> --sample false`. 그 Bun은 이후
67
- `PATH`에 없으므로 생성기가 워크스페이스의 `dependencies`에 `bun`을 넣고 아래 script를 씁니다. 다른 명령은
68
- `npx akan …`으로 실행하세요.
69
- - **Docker 없이 빌드하고 실행하기:** 아래 package script를 두고 `npm run build` 뒤 `PORT=3000 npm start`로 띄웁니다.
70
-
71
- ```json
72
- "build": "akan build <app>",
73
- "start": "cd dist/apps/<app> && bun main.js"
74
- ```
75
-
76
- 새로 clone한 사본도 그대로 빌드됩니다. env 파일은 gitignore된 채로 두면 `akan`이 없는 것을 만들어 주므로 커밋할
77
- 필요가 없습니다. 빌드에 필요한 env가 함께 들어 있고, 실행할 때 지정한 변수가 그 값을 덮어씁니다.
63
+ - **Node와 npm만 있는 호스트:** `npx -y bun@1.4.4 x create-akan-workspace@latest . --app <app> --dir <folder> --sample false`를
64
+ 실행한 뒤 `npm run build`, `PORT=3000 npm start`로 빌드하고 띄웁니다. 생성기가 쓰는 script와 새로 clone한 사본에
65
+ 필요한 것은 [`create-akan-workspace` README](https://github.com/akan-team/akanjs/blob/main/pkgs/create-akan-workspace/README.ko.md#node와-npm만-있을-때)에
66
+ 있습니다.
78
67
  - **실행할 곳에 맞게 빌드하기.** 셸이나 Bun이 읽는 `.env.local`에서 지정한 변수가 워크스페이스 `.env`보다 우선하고(빈
79
68
  값은 지정하지 않은 것으로 보며, 빌드는 그렇게 가져간 값을 하나씩 알려 줍니다), `AKAN_PUBLIC_ENV`는 `--env`가 둘보다
80
69
  우선합니다. 새 워크스페이스의 `.env`는 `local`이라 내 컴퓨터나 테스트 러너에서는 이대로 맞지만, 서버가
@@ -82,287 +71,42 @@ URL이라면, 코딩 에이전트는 묻지 않고 아래대로 진행하면 됩
82
71
  `AKAN_PUBLIC_REPO_NAME`과 `AKAN_PUBLIC_SERVE_DOMAIN`(서비스할 도메인)을 지정하고 `akan build <app> --env main`을
83
72
  실행하세요.
84
73
 
85
- ## 이 모든 게 한 줄입니다
86
-
87
- ```ts
88
- export class ProductInput extends via((field) => ({
89
- name: field(String),
90
- })) {}
91
- ```
92
-
93
- **한 줄 × 8 레이어 × 6 플랫폼 × 사람과 에이전트.**
94
-
95
- - **한 줄.** 필드를 더하는 일은 선언 한 줄, 이름과 타입이면 됩니다.
96
- - **× 8 레이어.** 그 한 줄이 스키마, 쿼리, 서비스, API, fetch, 클라이언트 타입, 상태, UI prop까지 뚫고 내려갑니다.
97
- 보통의 스택에서는 손으로 고쳐야 할 8곳이고, 하나라도 빠뜨리면 타입이 깨지거나 런타임에서 터집니다. 여기서는
98
- 함께 바뀝니다.
99
- - **× 6 플랫폼.** 같은 코드가 SEO 웹, iOS·Android 앱, macOS·Windows·Linux 데스크톱 앱으로 배포됩니다. 감싼
100
- 웹사이트가 아니라 네이티브 수준의 화면 전환까지 갖춘 채로요.
101
- - **× 사람과 에이전트.** 가드를 통과한 엔드포인트는 MCP 도구가, 화면의 컨트롤은 인페이지 에이전트 도구가 됩니다.
102
- 사람과 같은 가드를 거쳐서요.
103
-
104
- ## 당신이 만든 화면이 곧 에이전트의 인터페이스입니다
105
-
106
- ```tsx
107
- export const Order = () => {
108
- const { l } = usePage();
109
- const icecreamOrderForm = st.use.icecreamOrderForm();
110
- const order = st.tool("createIcecreamOrder", { confirm: true })
111
- .desc("Place the order in the form.")
112
- .exec(() => st.do.createIcecreamOrder());
113
- return (
114
- <>
115
- <Field.MultiToggleSelect
116
- label={l("icecreamOrder.toppings")}
117
- items={cnst.Topping}
118
- value={icecreamOrderForm.toppings}
119
- onChange={st.do.setToppingsOnIcecreamOrder}
120
- />
121
- <Button onClick={order}>{l("icecreamOrder.createIcecreamOrder")}</Button>
122
- </>
123
- );
124
- };
125
- ```
126
-
127
- - **원래 쓰려던 화면을 그대로 씁니다.** setter를 넘겨받은 필드는 그 setter를 공개합니다. 버튼 핸들러는 `st.tool`
128
- 한 줄로 툴이 되고, 버튼이 부르는 바로 그 함수가 됩니다.
129
- - **에이전트에게는 픽셀이 아니라 도구가 보입니다.** 연결한 컨트롤마다 자기 이름과 받는 인자로 공개됩니다. 화면에
130
- 없는 것은 목록에도 없습니다.
131
- - **사용자 자신의 탭에서, 그 사용자의 세션으로 화면을 다룹니다.** 클릭과 똑같습니다.
132
- - **중요한 일은 승인을 기다립니다.** `confirm`으로 선언한 툴은 승인 카드에서 멈춥니다.
133
-
134
- 설정은 레이아웃에 `<Agent.Chat />` 하나, 그리고 `option.ts`에 넣는 모델 키가 전부입니다. OpenAI 호환 호스트와
135
- Anthropic 모두 쓸 수 있습니다.
136
-
137
- ## 당신의 서버는 이미 MCP 서버입니다
138
-
139
- ```ts
140
- serveIcecreamOrder: mutation(cnst.IcecreamOrder, {
141
- guards: [Admin],
142
- })
143
- .param("icecreamOrderId", ID)
144
- .exec(async function (icecreamOrderId) {
145
- return await this.icecreamOrderService.serve(icecreamOrderId);
146
- }),
147
- refundIcecreamOrder: mutation(cnst.IcecreamOrder, {
148
- guards: [Every, Person],
149
- })
150
- .param("icecreamOrderId", ID)
151
- .with(Self)
152
- .exec(async function (icecreamOrderId, self) {
153
- return await this.icecreamOrderService.refund(icecreamOrderId, self.id);
154
- }),
155
- ```
156
-
157
- - **MCP 클라이언트에 앱 주소만 넣습니다.** `POST /mcp`는 기본으로 켜져 있습니다. 가드가 허용하는 엔드포인트는 모두
158
- 툴이 되고, 설명은 이미 쓰는 사전에서 옵니다.
159
- - **로그인과 동의는 당신의 앱에서 합니다.** OAuth 2.1은 `libs/shared`에 들어 있습니다. AI는 사용자 한 명의 토큰을
160
- 받고, 권한도 딱 그 사용자만큼이며, 언제든 해지할 수 있습니다.
161
- - **해서는 안 되는 일은 못 합니다.** `refundIcecreamOrder`에는 `Person` 가드가 걸려 있어 목록에 올라가지 않습니다.
162
- AI에게는 처음부터 없는 툴과 똑같아 보입니다.
163
- - **페이지가 프롬프트가 됩니다.** `page().prompt(name, description)`은 화면을 MCP 프롬프트로 공개합니다. 페이지의
164
- fetch가 호출자의 토큰으로 실행되고 에이전트는 그 데이터를 받습니다. 따로 맞춰 둘 두 번째 구현은 없습니다.
165
-
166
- ## 규칙은 하나, 사용자는 셋
167
-
168
- 가드는 엔드포인트마다 한 번 씁니다. 화면 앞의 사람, 그 사람 탭 안의 에이전트, MCP로 부르는 AI 모두를 같은 가드가
169
- 판단합니다.
170
-
171
- - **거절은 아무것도 드러내지 않습니다.** 에이전트가 쓸 수 없는 툴은 처음부터 없는 툴과 똑같이 답합니다.
172
- - **호출자마다 속도 제한.** MCP 호출은 호출자마다 분당 120번, 동시에 8개로 묶입니다.
173
- - **비밀은 밖으로 나가지 않습니다.** hidden·secret 필드는 모델에 닿기 전에 빠집니다.
174
- - **연결은 언제든 끝낼 수 있습니다.** 연결을 해지하면 다음 호출부터 거절됩니다. 채팅 릴레이는 세션도 대화도 남기지
175
- 않습니다.
176
-
177
- ## 만드는 일도 에이전트가
178
-
179
- AI 코딩은 일정 규모를 넘으면 스파게티가 됩니다. 에이전트가 코드를 빨리 뽑을수록 파일 위치, 이름, 구조, 선언 방식이
180
- 제각각이 되기 때문입니다. Akan은 엄격한 규칙으로 이 문제를 원천 차단합니다.
181
-
182
- - **config 파일 지옥은 그만.** `akan.config.ts` 하나로 모든 것을 설정하고, 비어 있어도 앱은 돌아갑니다.
183
- - **엄격한 규칙, 통일된 스타일.** 파일 위치, 이름, 구조, 선언 방식이 통일되고 lint가 이를 지킵니다. 누가 짰든 한
184
- 사람이 쓴 것처럼 읽힙니다.
185
- - **에이전트가 우회할 수 없는 규칙.** 모든 워크스페이스에 생성된 `AGENTS.md`, 번들 가이드라인, 계획 후 적용하는
186
- 워크플로 MCP, 그리고 이를 따라 일하는 터미널 코딩 에이전트 `akan code`가 들어 있습니다.
187
- - **정해진 블록.** 업로드, 로그인, 관리자, 채팅, 게시판, 알림이 미리 만들어진 블록이라, 에이전트는 그 위에서 일관된
188
- 코드만 생산합니다.
189
-
190
- ## 도메인 모듈
191
-
192
- 코드는 기술 계층보다 `user`, `product`, `ticket`, `project` 같은 비즈니스 도메인을 기준으로 묶입니다.
193
-
194
- ```text
195
- lib/product/
196
- ├── product.constant.ts # 모델, 스칼라, enum, 스키마 정의
197
- ├── product.dictionary.ts # i18n 라벨, 설명, 에러
198
- ├── product.signal.ts # 타입 안전한 엔드포인트 계약, 가드
199
- ├── product.document.ts # 영속성과 document 쿼리
200
- ├── product.service.ts # 비즈니스 로직
201
- ├── product.store.ts # 도메인 상태와 action
202
- ├── Product.Template.tsx # 폼 UI
203
- ├── Product.Unit.tsx # 목록 아이템 UI
204
- ├── Product.View.tsx # 상세 UI
205
- └── Product.Zone.tsx # 페이지 섹션 UI
206
- ```
207
-
208
- ```mermaid
209
- flowchart LR
210
- ConstantDictionarySignal["constant + dictionary + signal"] --> DocumentService["document + service"]
211
- ConstantDictionarySignal --> StoreComponents["store + UI components"]
212
- DocumentService --> ServerRuntime["server runtime + MCP"]
213
- StoreComponents --> ClientRuntime["client runtime + in-page agent"]
214
- ServerRuntime --> DeployArtifacts["deploy artifacts"]
215
- ClientRuntime --> DeployArtifacts
216
- ```
217
-
218
- ## v2보다 빠르게
219
-
220
- v3는 에이전트, MCP, 새 UI 시스템을 더하고도 측정한 모든 지표에서 v2보다 빠릅니다.
221
-
222
- | 지표 | v2 | v3 | 변화 |
223
- | --- | --- | --- | --- |
224
- | 초당 요청 수 | 112K | 123K | +10% |
225
- | 응답 시간 (p99) | 1.30 ms | 1.04 ms | −20% |
226
- | 시작 시간 | 204 ms | 102 ms | −50% |
227
- | 대기 메모리 | 84 MB | 57 MB | −32% |
228
- | 부하 중 메모리 | 105 MB | 85 MB | −19% |
74
+ ## 첫 앱 만들기
229
75
 
230
- - 클라이언트 빌드 결과물: 26MB → 8.1MB (청크 605개 → 258개).
231
- - 클라이언트에서 1,000행 하이드레이션: 3.5ms → 0.9ms.
232
- - 50행 목록 쿼리: 시간 −33%, 할당 85% 감소.
76
+ - **화면**은 `apps/<app>/page/` 아래 파일입니다. `<route>.tsx`나 `_index.tsx`, 그 바깥의 `_layout.tsx`, 경로
77
+ 세그먼트는 `[id]/`이고, `akanjs/client`의 `page()` 체인 하나를 export합니다. [라우팅](https://akanjs.com/docs/core/routing)
78
+ - **저장되는 모델**은 `lib/<model>/` 모듈이고 `akan create-module <model> <app>`으로 만듭니다. 외부 API처럼 저장할
79
+ 모델이 없는 서비스는 `akan create-service <service> <app>`으로 `lib/_<service>/`에 둡니다.
80
+ [파일 규칙](https://akanjs.com/docs/core/file-rule)
81
+ - 코딩 에이전트가 따르는 **규칙**은 워크스페이스 안에 있습니다. `AGENTS.md`, `.claude/rules/akan/`, 그리고
82
+ `.claude/skills/`와 `.agents/skills/`의 스킬입니다. `akan guideline show <name>`은 번들된 가이드라인을 출력합니다.
83
+ - **`akan.config.ts`**는 비워 둬도 됩니다. 라우트, 도메인, 로케일, 데이터베이스 모드, 네이티브 앱이 필요할 때만
84
+ 늘어납니다. [설정](https://akanjs.com/docs/core/config)
233
85
 
234
- Apple M4 Pro MacBook Pro에서 프로덕션 빌드, 동시 사용자 50명으로 측정했습니다. 측정 도구와 원본 데이터는
235
- [`benchmarks/api-benchmark`](https://github.com/akan-team/akanjs/tree/main/benchmarks/api-benchmark)에 있습니다.
236
-
237
- ## 빌드에서 라이브 URL까지
238
-
239
- [Akan Cloud](https://cloud.akanjs.com)는 Akan 앱을 위해 만든 배포 플랫폼입니다.
240
-
241
- ```bash
242
- akan login # 이 컴퓨터에서 Akan Cloud에 로그인
243
- akan tunnel <app> # 배포 전에 실행 중인 앱을 공개 URL로 공유
244
- akan build <app> # Akan Cloud가 돌릴 프로덕션 결과물 빌드
245
- ```
246
-
247
- ## 사람과 에이전트를 위한 문서
248
-
249
- - 문서는 [akanjs.com/docs](https://akanjs.com/docs)에 있습니다. 모든 문서 페이지에 인페이지 에이전트가 있어, 주제를
250
- 물으면 문서를 검색해 해당 페이지를 열어 줍니다.
251
- - Claude Code나 Cursor에 `https://akanjs.com/mcp`를 연결하면, AI가 코드를 쓰면서 이 문서를 읽습니다
252
- (`listDocPages`, `searchDocPages`, `readDocPage`).
253
- - [`llms.txt`](https://akanjs.com/llms.txt)는 어떤 모델이든 읽을 수 있는 문서 색인입니다.
254
-
255
- ## 하나의 패키지, 여러 경계
256
-
257
- Akan은 하나의 npm 패키지 `akanjs`로 배포됩니다. root import는 의도적으로 작게 두고, 서버 전용·클라이언트 전용·UI·
258
- 도구 표면은 subpath import로 나눕니다.
259
-
260
- ```ts
261
- import { Int, dayjs } from "akanjs/base";
262
- import { via } from "akanjs/constant";
263
- import { endpoint } from "akanjs/signal";
264
- import { Button, Layout } from "akanjs/ui";
265
- import { page } from "akanjs/client";
266
- import { AkanApp } from "akanjs/server/akanApp";
267
- ```
268
-
269
- ```css
270
- @import "akanjs/ui/styles.css";
271
- ```
272
-
273
- | Subpath | 역할 |
274
- | --- | --- |
275
- | `akanjs/base` | 핵심 primitive, 스칼라(`Int`, `Float`, `ID`, `Binary`, `enumOf`), `dayjs`, 환경 헬퍼. |
276
- | `akanjs/common` | 여러 런타임에서 함께 쓰는 헬퍼. |
277
- | `akanjs/constant` | 모델 선언, 스키마 구성, 직렬화, 기본값, `via` 빌더. |
278
- | `akanjs/dictionary` | 라벨, 설명, 에러를 위한 locale·번역·사전 헬퍼. |
279
- | `akanjs/document` | DB document, 필터, 쿼리 빌더, 전문 검색, 영속성 유틸리티. |
280
- | `akanjs/signal` | 엔드포인트, slice, 가드, 미들웨어, 타입 안전한 signal 계약. |
281
- | `akanjs/service` | 서비스, 어댑터, 의존성 주입, 비즈니스 로직 런타임. |
282
- | `akanjs/fetch` | 타입 안전한 fetch, HTTP, WebSocket 클라이언트. |
283
- | `akanjs/store` | 도메인 상태, action, 인페이지 에이전트의 `st.tool` / `st.use` 표면. |
284
- | `akanjs/ui` | React 컴포넌트, recipe, `_overrides.tsx` 슬롯: 레이아웃, 폼, 모달, 테이블, 로딩, 에이전트 채팅. |
285
- | `akanjs/client` | 라우트 체인(`page()`, `layout()`), 라우팅, 쿠키, 스토리지, locale, `cn`. |
286
- | `akanjs/client/native` | iOS·Android·데스크톱 앱을 위한 네이티브 브리지와 내장 플러그인. |
287
- | `akanjs/webkit` | `lazy`, SEO 페이지 같은 브라우저 쪽 헬퍼. |
288
- | `akanjs/server` | 서버 런타임, SSR/RSC, MCP, 로깅, 서버 타입. 엔트리포인트는 `akanjs/server/akanApp`입니다. |
289
- | `akanjs/native/desktop` | 네이티브 플러그인의 데스크톱 부분. |
290
- | `akanjs/test` | 테스트 헬퍼와 샘플 생성. |
291
-
292
- 도구는 별도 패키지로 배포됩니다. `@akanjs/cli`(`akan` 명령), `@akanjs/devkit`(빌드 러너, 코드 생성, lint 규칙),
293
- `create-akan-workspace`입니다.
294
-
295
- ## CLI 개요
86
+ ## 빌드와 실행
296
87
 
297
88
  ```bash
298
- akan create-workspace
299
- akan create-application <app>
300
- akan create-module
301
- akan start <app> --open # 여러 앱은 akan start a,b
302
- akan build <app>
303
- akan build-ios <app> # build-android, build-desktop도 있습니다
304
- akan lint <app>
305
- akan typecheck <app>
306
- akan test <app>
307
- akan logs <app>
308
- akan code
309
- akan update
89
+ akan start <app> # 개발 서버, http://localhost:8282
90
+ akan verify <app> # sync, lint, 타입체크, 빌드, SSR 검사
91
+ akan build <app> # dist/apps/<app>에 프로덕션 빌드
92
+ cd dist/apps/<app> && PORT=3000 bun main.js
310
93
  ```
311
94
 
312
- - **Workspace**: 워크스페이스 생성, lint, sync, `akan doctor`.
313
- - **Application**: 웹·모바일·데스크톱 앱의 start, build, typecheck, test, 패키징.
314
- - **Library**: 공유 라이브러리 생성, 설치, sync, push, pull.
315
- - **Module and scalar**: 도메인 모듈, 모델, view, unit, template, store 생성.
316
- - **Agents**: `akan code`, `akan mcp`, `akan mcp-install`, `akan workflow`, `akan guideline`.
317
- - **Cloud and release**: `akan login`, `akan tunnel`, 배포 자산, 패키지 업데이트.
318
-
319
- ## 애플리케이션 설정
320
-
321
- `akan.config.ts`는 앱 단위 설정을 모으는 단 하나의 파일입니다. 비워 둔 채 시작하고, routes, domains, base paths,
322
- database modes, native app settings가 필요해질 때만 늘려 가면 됩니다.
323
-
324
- ```ts
325
- import type { AppConfig } from "akanjs";
326
-
327
- const config: AppConfig = {
328
- routes: [
329
- { domains: { main: ["example.com", "www.example.com"] }, basePath: "web" },
330
- { domains: {}, basePath: "app" },
331
- ],
332
- database: { modes: ["single", "cluster"] },
333
- native: {
334
- basePath: "app",
335
- appName: "Example",
336
- appId: "com.example.app",
337
- version: "1.0.0",
338
- buildNum: 1,
339
- },
340
- };
341
-
342
- export default config;
343
- ```
344
-
345
- ## Contributor Notes
346
-
347
- 이 저장소는 Bun-first 모노레포입니다. 프레임워크 코드는 `pkgs/akanjs`, 도구는 `pkgs/@akanjs`, 애플리케이션은
348
- `apps`, 공유 라이브러리는 `libs`, 배포 자산은 `infra`에 있습니다. `apps/akan`이 [akanjs.com](https://akanjs.com)
349
- 그 자체입니다.
350
-
351
- 이 저장소 안에서는 `bun run akan`이 CLI를 소스에서 빌드해 실행합니다.
352
-
353
- ```bash
354
- bun run akan start <app>
355
- bun run akan lint <app>
356
- bun run akan typecheck <app>
357
- bun run akan test <app-or-lib-or-pkg>
358
- ```
359
-
360
- `AGENTS.md`는 코딩 에이전트와 기여자 모두를 위한 가이드입니다. 프레임워크 코드를 고칠 때는 기존 subpath를 우선
361
- 쓰고 root `akanjs` 엔트리포인트는 작게 유지하세요. 이 패키지 경계는 런타임 설계의 일부입니다.
362
-
363
- ## 오픈소스 메모
364
-
365
- - 라이선스: MIT. [`pkgs/akanjs/LICENSE`](https://github.com/akan-team/akanjs/blob/main/pkgs/akanjs/LICENSE)를 참고하세요.
366
- - 저장소: [akan-team/akanjs](https://github.com/akan-team/akanjs).
367
- - 기여 가이드: [`pkgs/akanjs/CONTRIBUTING.md`](https://github.com/akan-team/akanjs/blob/main/pkgs/akanjs/CONTRIBUTING.md).
368
- - 행동 강령: [`pkgs/akanjs/CODE_OF_CONDUCT.md`](https://github.com/akan-team/akanjs/blob/main/pkgs/akanjs/CODE_OF_CONDUCT.md).
95
+ [Akan Cloud](https://cloud.akanjs.com)는 Akan 앱을 실행하는 플랫폼입니다. `akan login`으로 로그인하고,
96
+ `akan tunnel <app>`으로 실행 중인 앱을 공개 URL로 공유합니다.
97
+
98
+ ## 더 보기
99
+
100
+ - [akanjs.com](https://akanjs.com): 코드 한 줄이 닿는 곳, 에이전트의 인터페이스가 되는 화면, MCP 서버가 되는 서버.
101
+ - [문서](https://akanjs.com/docs), [CLI 레퍼런스](https://akanjs.com/references/cli/overview),
102
+ [`llms.txt`](https://akanjs.com/llms.txt). 코딩 에이전트에 `https://akanjs.com/mcp`를 연결하면 코드를 쓰면서 문서를
103
+ 읽습니다.
104
+ - [MCP](https://akanjs.com/cheatsheet/interface/mcp)와 [인페이지 에이전트](https://akanjs.com/cheatsheet/interface/agent-chat):
105
+ 가드, 거절, rate limit, 모델 설정.
106
+ - [v3 성능](https://akanjs.com/blog/v3release#v3-performance): v2와 비교한 수치와 측정 방법.
107
+ - `akanjs`는 npm 패키지 하나입니다. subpath(`akanjs/base`, `akanjs/client`, `akanjs/signal`, `akanjs/ui`, …)가 서버
108
+ 전용, 클라이언트 전용, UI, 툴링 코드를 나누고([패키지 레퍼런스](https://akanjs.com/references/akanjs/base)), 툴링은
109
+ `@akanjs/cli`와 `@akanjs/devkit`으로 나옵니다.
110
+ - 기여: [`CONTRIBUTING.md`](https://github.com/akan-team/akanjs/blob/main/pkgs/akanjs/CONTRIBUTING.md)와
111
+ [행동 강령](https://github.com/akan-team/akanjs/blob/main/pkgs/akanjs/CODE_OF_CONDUCT.md). 라이선스: MIT
112
+ ([`LICENSE`](https://github.com/akan-team/akanjs/blob/main/pkgs/akanjs/LICENSE)).