@kood/claude-code 0.5.3 → 0.5.5
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/dist/index.js +552 -340
- package/package.json +1 -1
- package/templates/.claude/agents/document-writer.md +73 -306
- package/templates/.claude/instructions/agent-patterns/index.md +7 -7
- package/templates/.claude/instructions/document-templates/ralph-templates.md +71 -0
- package/templates/.claude/instructions/index.md +14 -14
- package/templates/.claude/instructions/multi-agent/agent-roster.md +14 -14
- package/templates/.claude/instructions/multi-agent/index.md +4 -4
- package/templates/.claude/skills/docs-creator/AGENTS.md +54 -176
- package/templates/.claude/skills/docs-creator/SKILL.md +98 -464
- package/templates/.claude/skills/docs-refactor/AGENTS.md +61 -190
- package/templates/.claude/skills/docs-refactor/SKILL.md +67 -443
- package/templates/.claude/skills/execute/SKILL.md +540 -13
- package/templates/.claude/skills/plan/SKILL.md +84 -18
- package/templates/.claude/skills/ralph/SKILL.md +17 -14
- package/templates/.claude/skills/refactor/AGENTS.md +269 -0
- package/templates/.claude/skills/refactor/SKILL.md +424 -66
- package/templates/.claude/skills/stitch-design/README.md +34 -0
- package/templates/.claude/skills/stitch-design/SKILL.md +213 -0
- package/templates/.claude/skills/stitch-design/examples/DESIGN.md +154 -0
- package/templates/.claude/skills/stitch-loop/README.md +54 -0
- package/templates/.claude/skills/stitch-loop/SKILL.md +316 -0
- package/templates/.claude/skills/stitch-loop/examples/SITE.md +73 -0
- package/templates/.claude/skills/stitch-loop/examples/next-prompt.md +25 -0
- package/templates/.claude/skills/stitch-loop/resources/baton-schema.md +61 -0
- package/templates/.claude/skills/stitch-loop/resources/site-template.md +104 -0
- package/templates/.claude/skills/stitch-react/README.md +36 -0
- package/templates/.claude/skills/stitch-react/SKILL.md +323 -0
- package/templates/.claude/skills/stitch-react/examples/gold-standard-card.tsx +88 -0
- package/templates/.claude/skills/stitch-react/package-lock.json +231 -0
- package/templates/.claude/skills/stitch-react/package.json +16 -0
- package/templates/.claude/skills/stitch-react/resources/architecture-checklist.md +15 -0
- package/templates/.claude/skills/stitch-react/resources/component-template.tsx +37 -0
- package/templates/.claude/skills/stitch-react/resources/stitch-api-reference.md +14 -0
- package/templates/.claude/skills/stitch-react/resources/style-guide.json +24 -0
- package/templates/.claude/skills/stitch-react/scripts/fetch-stitch.sh +30 -0
- package/templates/.claude/skills/stitch-react/scripts/validate.js +77 -0
- package/templates/hono/CLAUDE.md +28 -28
- package/templates/hono/docs/architecture.md +24 -24
- package/templates/hono/docs/deployment/cloudflare.md +18 -18
- package/templates/hono/docs/deployment/docker.md +13 -13
- package/templates/hono/docs/deployment/index.md +19 -19
- package/templates/hono/docs/deployment/railway.md +32 -32
- package/templates/hono/docs/deployment/vercel.md +29 -29
- package/templates/hono/docs/guides/conventions.md +57 -57
- package/templates/hono/docs/guides/env-setup.md +47 -47
- package/templates/hono/docs/guides/getting-started.md +27 -27
- package/templates/hono/docs/library/hono/error-handling.md +11 -11
- package/templates/hono/docs/library/hono/index.md +4 -4
- package/templates/hono/docs/library/hono/middleware.md +18 -18
- package/templates/hono/docs/library/hono/rpc.md +7 -7
- package/templates/hono/docs/library/hono/validation.md +6 -6
- package/templates/hono/docs/library/prisma/cloudflare-d1.md +29 -29
- package/templates/hono/docs/library/prisma/config.md +16 -16
- package/templates/hono/docs/library/prisma/index.md +32 -32
- package/templates/hono/docs/library/t3-env/index.md +22 -22
- package/templates/hono/docs/library/zod/index.md +31 -31
- package/templates/nextjs/CLAUDE.md +54 -54
- package/templates/nextjs/docs/architecture.md +146 -146
- package/templates/nextjs/docs/design.md +183 -183
- package/templates/nextjs/docs/guides/conventions.md +86 -86
- package/templates/nextjs/docs/guides/getting-started.md +28 -28
- package/templates/nextjs/docs/guides/routes.md +32 -32
- package/templates/nextjs/docs/library/better-auth/index.md +70 -70
- package/templates/nextjs/docs/library/nextjs/app-router.md +43 -43
- package/templates/nextjs/docs/library/nextjs/caching.md +73 -73
- package/templates/nextjs/docs/library/nextjs/index.md +51 -51
- package/templates/nextjs/docs/library/nextjs/middleware.md +41 -41
- package/templates/nextjs/docs/library/nextjs/route-handlers.md +31 -31
- package/templates/nextjs/docs/library/nextjs/server-actions.md +34 -34
- package/templates/nextjs/docs/library/prisma/cloudflare-d1.md +20 -20
- package/templates/nextjs/docs/library/prisma/config.md +18 -18
- package/templates/nextjs/docs/library/prisma/crud.md +17 -17
- package/templates/nextjs/docs/library/prisma/index.md +18 -18
- package/templates/nextjs/docs/library/prisma/relations.md +16 -16
- package/templates/nextjs/docs/library/prisma/schema.md +23 -23
- package/templates/nextjs/docs/library/prisma/setup.md +6 -6
- package/templates/nextjs/docs/library/prisma/transactions.md +10 -10
- package/templates/nextjs/docs/library/tanstack-query/index.md +6 -6
- package/templates/nextjs/docs/library/tanstack-query/invalidation.md +20 -20
- package/templates/nextjs/docs/library/tanstack-query/optimistic-updates.md +4 -4
- package/templates/nextjs/docs/library/tanstack-query/use-mutation.md +15 -15
- package/templates/nextjs/docs/library/tanstack-query/use-query.md +22 -22
- package/templates/nextjs/docs/library/zod/complex-types.md +11 -11
- package/templates/nextjs/docs/library/zod/index.md +8 -8
- package/templates/nextjs/docs/library/zod/transforms.md +11 -11
- package/templates/nextjs/docs/library/zod/validation.md +9 -9
- package/templates/npx/CLAUDE.md +38 -38
- package/templates/npx/docs/library/commander/index.md +12 -12
- package/templates/npx/docs/library/fs-extra/index.md +9 -9
- package/templates/npx/docs/library/prompts/index.md +3 -3
- package/templates/npx/docs/references/patterns.md +12 -12
- package/templates/tanstack-start/CLAUDE.md +54 -54
- package/templates/tanstack-start/docs/architecture.md +128 -128
- package/templates/tanstack-start/docs/design.md +169 -169
- package/templates/tanstack-start/docs/guides/conventions.md +43 -43
- package/templates/tanstack-start/docs/guides/env-setup.md +35 -35
- package/templates/tanstack-start/docs/guides/getting-started.md +19 -19
- package/templates/tanstack-start/docs/guides/hooks.md +45 -45
- package/templates/tanstack-start/docs/guides/routes.md +54 -54
- package/templates/tanstack-start/docs/guides/services.md +45 -45
- package/templates/tanstack-start/docs/library/prisma/cloudflare-d1.md +19 -19
- package/templates/tanstack-start/docs/library/prisma/config.md +16 -16
- package/templates/tanstack-start/docs/library/prisma/crud.md +17 -17
- package/templates/tanstack-start/docs/library/prisma/relations.md +16 -16
- package/templates/tanstack-start/docs/library/prisma/schema.md +23 -23
- package/templates/tanstack-start/docs/library/prisma/setup.md +6 -6
- package/templates/tanstack-start/docs/library/prisma/transactions.md +10 -10
- package/templates/tanstack-start/docs/library/tanstack-query/invalidation.md +19 -19
- package/templates/tanstack-start/docs/library/tanstack-query/optimistic-updates.md +4 -4
- package/templates/tanstack-start/docs/library/tanstack-query/use-mutation.md +14 -14
- package/templates/tanstack-start/docs/library/tanstack-query/use-query.md +21 -21
- package/templates/tanstack-start/docs/library/tanstack-router/error-handling.md +9 -9
- package/templates/tanstack-start/docs/library/tanstack-router/hooks.md +11 -11
- package/templates/tanstack-start/docs/library/tanstack-router/navigation.md +17 -17
- package/templates/tanstack-start/docs/library/tanstack-router/route-context.md +5 -5
- package/templates/tanstack-start/docs/library/tanstack-router/search-params.md +10 -10
- package/templates/tanstack-start/docs/library/tanstack-start/auth-patterns.md +8 -8
- package/templates/tanstack-start/docs/library/tanstack-start/middleware.md +9 -9
- package/templates/tanstack-start/docs/library/tanstack-start/routing.md +6 -6
- package/templates/tanstack-start/docs/library/tanstack-start/server-functions.md +18 -18
- package/templates/tanstack-start/docs/library/tanstack-start/setup.md +4 -4
- package/templates/tanstack-start/docs/library/zod/complex-types.md +11 -11
- package/templates/tanstack-start/docs/library/zod/transforms.md +11 -11
- package/templates/tanstack-start/docs/library/zod/validation.md +9 -9
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
|
|
19
|
+
// Use a valid identifier like 'StitchComponent' as the placeholder
|
|
20
|
+
interface StitchComponentProps {
|
|
21
|
+
readonly children?: React.ReactNode;
|
|
22
|
+
readonly className?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const StitchComponent: React.FC<StitchComponentProps> = ({
|
|
26
|
+
children,
|
|
27
|
+
className = '',
|
|
28
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
return (
|
|
31
|
+
<div className={`relative ${className}`} {...props}>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default StitchComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Stitch API reference
|
|
2
|
+
|
|
3
|
+
This document describes the data structures returned by the Stitch MCP server to ensure accurate component mapping.
|
|
4
|
+
|
|
5
|
+
### Metadata schema
|
|
6
|
+
When calling `get_screen`, the server returns a JSON object with these key properties:
|
|
7
|
+
* **htmlCode**: Contains a `downloadUrl`. This is a signed URL that requires a system-level fetch (curl) to handle redirects and security handshakes.
|
|
8
|
+
* **screenshot**: Includes a `downloadUrl` for the visual design. Use this to verify layout intent that might not be obvious in the raw HTML.
|
|
9
|
+
* **deviceType**: Usually set to `DESKTOP`. All generated components should prioritize the corresponding viewport (2560px width) as the base layout.
|
|
10
|
+
|
|
11
|
+
### Technical mapping rules
|
|
12
|
+
1. **Element tracking**: Preserve `data-stitch-id` attributes as comments in the TSX to allow for future design synchronization.
|
|
13
|
+
2. **Asset handling**: Treat background images in the HTML as dynamic data. Extract the URLs into `mockData.ts` rather than hardcoding them into the component styles.
|
|
14
|
+
3. **Style extraction**: The HTML `<head>` contains a localized `tailwind.config`. This config must be merged with the local project theme to ensure colors like `primary` and `background-dark` render correctly.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"theme": {
|
|
3
|
+
"colors": {
|
|
4
|
+
"primary": "#19e66f",
|
|
5
|
+
"background": {
|
|
6
|
+
"light": "#f6f8f7",
|
|
7
|
+
"dark": "#112118",
|
|
8
|
+
"elevated": "#1A1A1A"
|
|
9
|
+
},
|
|
10
|
+
"accent": {
|
|
11
|
+
"purple": "#8A2BE2",
|
|
12
|
+
"lavender": "#D0A9F5"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"typography": {
|
|
16
|
+
"display": ["Space Grotesk", "sans-serif"],
|
|
17
|
+
"icons": "Material Symbols Outlined"
|
|
18
|
+
},
|
|
19
|
+
"spacing": {
|
|
20
|
+
"header-h": "72px",
|
|
21
|
+
"container-max": "960px"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Copyright 2026 Google LLC
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
URL=$1
|
|
17
|
+
OUTPUT=$2
|
|
18
|
+
if [ -z "$URL" ] || [ -z "$OUTPUT" ]; then
|
|
19
|
+
echo "Usage: $0 <url> <output_path>"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
echo "Initiating high-reliability fetch for Stitch HTML..."
|
|
23
|
+
curl -L -f -sS --connect-timeout 10 --compressed "$URL" -o "$OUTPUT"
|
|
24
|
+
if [ $? -eq 0 ]; then
|
|
25
|
+
echo "✅ Successfully retrieved HTML at: $OUTPUT"
|
|
26
|
+
exit 0
|
|
27
|
+
else
|
|
28
|
+
echo "❌ Error: Failed to retrieve content. Check TLS/SNI or URL expiration."
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import swc from '@swc/core';
|
|
18
|
+
import fs from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
|
|
21
|
+
async function validateComponent(filePath) {
|
|
22
|
+
const code = fs.readFileSync(filePath, 'utf-8');
|
|
23
|
+
const filename = path.basename(filePath);
|
|
24
|
+
try {
|
|
25
|
+
const ast = await swc.parse(code, { syntax: 'typescript', tsx: true });
|
|
26
|
+
let hasInterface = false;
|
|
27
|
+
let tailwindIssues = [];
|
|
28
|
+
|
|
29
|
+
console.log('🔍 Scanning AST...');
|
|
30
|
+
|
|
31
|
+
const walk = (node) => {
|
|
32
|
+
if (!node) return;
|
|
33
|
+
if (
|
|
34
|
+
node.type === 'TsInterfaceDeclaration' &&
|
|
35
|
+
node.id.value.endsWith('Props')
|
|
36
|
+
)
|
|
37
|
+
hasInterface = true;
|
|
38
|
+
if (node.type === 'JSXAttribute' && node.name.name === 'className') {
|
|
39
|
+
if (node.value?.value && /#[0-9A-Fa-f]{6}/.test(node.value.value))
|
|
40
|
+
tailwindIssues.push(node.value.value);
|
|
41
|
+
}
|
|
42
|
+
for (const key in node) {
|
|
43
|
+
if (node[key] && typeof node[key] === 'object') walk(node[key]);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
walk(ast);
|
|
47
|
+
|
|
48
|
+
console.log(`--- Validation for: ${filename} ---`);
|
|
49
|
+
if (hasInterface) {
|
|
50
|
+
console.log('✅ Props declaration found.');
|
|
51
|
+
} else {
|
|
52
|
+
console.error("❌ MISSING: Props interface (must end in 'Props').");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (tailwindIssues.length === 0) {
|
|
56
|
+
console.log('✅ No hardcoded hex values found.');
|
|
57
|
+
} else {
|
|
58
|
+
console.error(
|
|
59
|
+
`❌ STYLE: Found ${tailwindIssues.length} hardcoded hex codes.`,
|
|
60
|
+
);
|
|
61
|
+
tailwindIssues.forEach((hex) => console.error(` - ${hex}`));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (hasInterface && tailwindIssues.length === 0) {
|
|
65
|
+
console.log('\n✨ COMPONENT VALID.');
|
|
66
|
+
process.exit(0);
|
|
67
|
+
} else {
|
|
68
|
+
console.error('\n🚫 VALIDATION FAILED.');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
} catch (err) {
|
|
72
|
+
console.error('❌ PARSE ERROR:', err.message);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
validateComponent(process.argv[2]);
|
package/templates/hono/CLAUDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CLAUDE.md - Hono
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Web Standards 기반 초경량 프레임워크
|
|
4
4
|
|
|
5
5
|
<instructions>
|
|
6
6
|
@../../commands/git.md
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
|
|
16
16
|
<forbidden>
|
|
17
17
|
|
|
18
|
-
|
|
|
19
|
-
|
|
20
|
-
| **Git** | `Generated with Claude Code`, `🤖`, `Co-Authored-By:`,
|
|
21
|
-
| **Prisma** |
|
|
22
|
-
| **API** |
|
|
23
|
-
|
|
|
18
|
+
| 분류 | 금지 |
|
|
19
|
+
|------|------|
|
|
20
|
+
| **Git** | `Generated with Claude Code`, `🤖`, `Co-Authored-By:`, 여러 줄, 이모지 |
|
|
21
|
+
| **Prisma** | `db push/migrate/generate` 자동 실행, schema 임의 변경 |
|
|
22
|
+
| **API** | handler 내 수동 검증/인증, 일반 Error throw |
|
|
23
|
+
| **검색** | grep, rg, find |
|
|
24
24
|
|
|
25
25
|
</forbidden>
|
|
26
26
|
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
|
|
29
29
|
<required>
|
|
30
30
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
| 3+
|
|
38
|
-
| Validation | zValidator, HTTPException
|
|
39
|
-
|
|
|
31
|
+
| 작업 | 필수 |
|
|
32
|
+
|------|------|
|
|
33
|
+
| 작업 전 | 관련 docs 읽기 (API→hono, DB→prisma) |
|
|
34
|
+
| 문서 검색 | serena mcp (문서 인덱싱/검색, context 길이 최적화) |
|
|
35
|
+
| 코드 검색 | ast-grep |
|
|
36
|
+
| 복잡한 작업 | Sequential Thinking MCP |
|
|
37
|
+
| 3+ 파일 수정 | gemini-review |
|
|
38
|
+
| Validation | zValidator, HTTPException 에러 처리 |
|
|
39
|
+
| 코드 작성 | UTF-8, 코드 묶음별 한글 주석, Prisma Multi-File 모든 요소 주석 |
|
|
40
40
|
|
|
41
41
|
</required>
|
|
42
42
|
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
|
|
45
45
|
<tech_stack>
|
|
46
46
|
|
|
47
|
-
|
|
|
48
|
-
|
|
49
|
-
| Hono |
|
|
47
|
+
| 기술 | 버전 | 주의 |
|
|
48
|
+
|------|------|------|
|
|
49
|
+
| Hono | 최신 | - |
|
|
50
50
|
| TypeScript | 5.x | strict |
|
|
51
|
-
| Prisma | **7.x** | `prisma-client`, output
|
|
51
|
+
| Prisma | **7.x** | `prisma-client`, output 필수 |
|
|
52
52
|
| Zod | **4.x** | `z.email()`, `z.url()` |
|
|
53
53
|
|
|
54
54
|
</tech_stack>
|
|
@@ -70,23 +70,23 @@ src/
|
|
|
70
70
|
└── types/
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
공통 로직 → `src/services/`, 라우트별 로직 → 각 route 파일
|
|
74
74
|
</structure>
|
|
75
75
|
|
|
76
76
|
---
|
|
77
77
|
|
|
78
78
|
<conventions>
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
TypeScript: const
|
|
82
|
-
Import
|
|
80
|
+
파일명: kebab-case
|
|
81
|
+
TypeScript: const 선언, 명시적 return type, interface(객체)/type(유니온), any→unknown
|
|
82
|
+
Import 순서: 외부 → 내부 → 상대경로 → type
|
|
83
83
|
|
|
84
84
|
Prisma Multi-File:
|
|
85
85
|
```
|
|
86
86
|
prisma/schema/
|
|
87
87
|
├── +base.prisma # datasource, generator
|
|
88
|
-
├── +enum.prisma #
|
|
89
|
-
└── [model].prisma #
|
|
88
|
+
├── +enum.prisma # enum
|
|
89
|
+
└── [model].prisma # 모델별 (한글 주석!)
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
</conventions>
|
|
@@ -96,7 +96,7 @@ prisma/schema/
|
|
|
96
96
|
<quick_patterns>
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
|
-
// App +
|
|
99
|
+
// App + 에러 핸들러
|
|
100
100
|
import { Hono } from 'hono'
|
|
101
101
|
import { HTTPException } from 'hono/http-exception'
|
|
102
102
|
|
|
@@ -145,7 +145,7 @@ export const authMiddleware = createMiddleware(async (c, next) => {
|
|
|
145
145
|
await next()
|
|
146
146
|
})
|
|
147
147
|
|
|
148
|
-
//
|
|
148
|
+
// 사용
|
|
149
149
|
app.use('/api/*', authMiddleware)
|
|
150
150
|
```
|
|
151
151
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Hono
|
|
1
|
+
# Hono 서버 아키텍처
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 레이어 기반 아키텍처
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 시스템 개요
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
Client → Middleware → Routes → Validation → Services → Database
|
|
@@ -12,21 +12,21 @@ Client → Middleware → Routes → Validation → Services → Database
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## 프로젝트 구조
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
src/
|
|
19
19
|
├── index.ts # Entry point
|
|
20
|
-
├── routes/ #
|
|
21
|
-
├── middleware/ #
|
|
22
|
-
├── validators/ # Zod
|
|
23
|
-
├── services/ #
|
|
20
|
+
├── routes/ # 라우트 모듈
|
|
21
|
+
├── middleware/ # 커스텀 미들웨어
|
|
22
|
+
├── validators/ # Zod 스키마
|
|
23
|
+
├── services/ # 비즈니스 로직
|
|
24
24
|
│ └── user/
|
|
25
|
-
│ ├── queries.ts #
|
|
26
|
-
│ └── mutations.ts #
|
|
25
|
+
│ ├── queries.ts # 조회
|
|
26
|
+
│ └── mutations.ts # 생성/수정/삭제
|
|
27
27
|
├── database/ # Prisma Client
|
|
28
|
-
├── types/ #
|
|
29
|
-
└── lib/ #
|
|
28
|
+
├── types/ # 타입 정의
|
|
29
|
+
└── lib/ # 유틸리티
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
---
|
|
@@ -227,8 +227,8 @@ const data = await res.json()
|
|
|
227
227
|
|
|
228
228
|
## Tech Stack
|
|
229
229
|
|
|
230
|
-
|
|
|
231
|
-
|
|
230
|
+
| 분류 | 기술 | 버전 |
|
|
231
|
+
|------|------|------|
|
|
232
232
|
| Framework | Hono | latest |
|
|
233
233
|
| Validation | Zod | **4.x** |
|
|
234
234
|
| ORM | Prisma | **7.x** |
|
|
@@ -236,20 +236,20 @@ const data = await res.json()
|
|
|
236
236
|
|
|
237
237
|
---
|
|
238
238
|
|
|
239
|
-
##
|
|
239
|
+
## 패턴 요약
|
|
240
240
|
|
|
241
|
-
|
|
|
242
|
-
|
|
243
|
-
| Routes | HTTP
|
|
244
|
-
| Middleware |
|
|
245
|
-
| Validators |
|
|
246
|
-
| Services |
|
|
247
|
-
| Database |
|
|
241
|
+
| 레이어 | 역할 | 파일 |
|
|
242
|
+
|--------|------|------|
|
|
243
|
+
| Routes | HTTP 라우팅 | `routes/*.ts` |
|
|
244
|
+
| Middleware | 요청/응답 처리 | `middleware/*.ts` |
|
|
245
|
+
| Validators | 입력 검증 | `validators/*.ts` |
|
|
246
|
+
| Services | 비즈니스 로직 | `services/*/*.ts` |
|
|
247
|
+
| Database | 데이터 액세스 | `database/prisma.ts` |
|
|
248
248
|
|
|
249
249
|
---
|
|
250
250
|
|
|
251
|
-
##
|
|
251
|
+
## 관련 문서
|
|
252
252
|
|
|
253
253
|
- [Hono](../library/hono/index.md)
|
|
254
254
|
- [Prisma](../library/prisma/index.md)
|
|
255
|
-
- [Cloudflare
|
|
255
|
+
- [Cloudflare 배포](../deployment/cloudflare.md)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Nitro - Cloudflare
|
|
1
|
+
# Nitro - Cloudflare 배포
|
|
2
2
|
|
|
3
|
-
> Cloudflare Workers/Pages Edge
|
|
3
|
+
> Cloudflare Workers/Pages Edge 배포
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## Workers
|
|
7
|
+
## Workers 설정
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
10
|
// nitro.config.ts
|
|
@@ -22,7 +22,7 @@ export default defineNitroConfig({
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
## Pages
|
|
25
|
+
## Pages 설정
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
28
|
// nitro.config.ts
|
|
@@ -65,7 +65,7 @@ bucket_name = "my-bucket"
|
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
68
|
-
##
|
|
68
|
+
## 배포
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
wrangler login
|
|
@@ -78,7 +78,7 @@ wrangler pages deploy .output/public
|
|
|
78
78
|
|
|
79
79
|
---
|
|
80
80
|
|
|
81
|
-
##
|
|
81
|
+
## Bindings 사용
|
|
82
82
|
|
|
83
83
|
### D1
|
|
84
84
|
|
|
@@ -137,7 +137,7 @@ app.get("/download/:name", async (c) => {
|
|
|
137
137
|
|
|
138
138
|
---
|
|
139
139
|
|
|
140
|
-
##
|
|
140
|
+
## 시크릿
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
143
|
wrangler secret put API_SECRET
|
|
@@ -146,7 +146,7 @@ wrangler secret list
|
|
|
146
146
|
|
|
147
147
|
---
|
|
148
148
|
|
|
149
|
-
## D1
|
|
149
|
+
## D1 마이그레이션
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
152
|
wrangler d1 migrations create my-database create_users
|
|
@@ -191,21 +191,21 @@ jobs:
|
|
|
191
191
|
|
|
192
192
|
---
|
|
193
193
|
|
|
194
|
-
##
|
|
194
|
+
## 문제 해결
|
|
195
195
|
|
|
196
|
-
|
|
|
197
|
-
|
|
198
|
-
| Worker size limit |
|
|
199
|
-
| D1 not found |
|
|
200
|
-
| Node.js API
|
|
196
|
+
| 문제 | 해결 |
|
|
197
|
+
|------|------|
|
|
198
|
+
| Worker size limit | externals 설정, minify |
|
|
199
|
+
| D1 not found | wrangler.toml 바인딩 확인 |
|
|
200
|
+
| Node.js API 오류 | `nodejs_compat` 플래그 |
|
|
201
201
|
|
|
202
202
|
```bash
|
|
203
|
-
wrangler tail #
|
|
204
|
-
wrangler deploy --dry-run #
|
|
203
|
+
wrangler tail # 실시간 로그
|
|
204
|
+
wrangler deploy --dry-run # 검증
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
---
|
|
208
208
|
|
|
209
|
-
##
|
|
209
|
+
## 관련 문서
|
|
210
210
|
|
|
211
|
-
- [
|
|
211
|
+
- [배포 가이드](./index.md)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Nitro - Docker
|
|
1
|
+
# Nitro - Docker 배포
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 컨테이너 배포
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -63,13 +63,13 @@ docs/
|
|
|
63
63
|
|
|
64
64
|
---
|
|
65
65
|
|
|
66
|
-
##
|
|
66
|
+
## 빌드 및 실행
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
69
|
docker build -t my-hono-app .
|
|
70
70
|
docker run -p 3000:3000 my-hono-app
|
|
71
71
|
|
|
72
|
-
#
|
|
72
|
+
# 환경 변수
|
|
73
73
|
docker run -p 3000:3000 \
|
|
74
74
|
-e DATABASE_URL="postgresql://..." \
|
|
75
75
|
my-hono-app
|
|
@@ -119,7 +119,7 @@ docker compose down
|
|
|
119
119
|
|
|
120
120
|
---
|
|
121
121
|
|
|
122
|
-
##
|
|
122
|
+
## 개발용
|
|
123
123
|
|
|
124
124
|
```yaml
|
|
125
125
|
# docker-compose.dev.yml
|
|
@@ -178,13 +178,13 @@ jobs:
|
|
|
178
178
|
|
|
179
179
|
---
|
|
180
180
|
|
|
181
|
-
##
|
|
181
|
+
## 문제 해결
|
|
182
182
|
|
|
183
|
-
|
|
|
184
|
-
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
183
|
+
| 문제 | 해결 |
|
|
184
|
+
|------|------|
|
|
185
|
+
| 포트 연결 실패 | `HOST=0.0.0.0` 설정 |
|
|
186
|
+
| 권한 오류 | 비-root 사용자 |
|
|
187
|
+
| 메모리 부족 | 멀티스테이지 빌드 |
|
|
188
188
|
|
|
189
189
|
```bash
|
|
190
190
|
docker exec -it hono-app sh
|
|
@@ -194,6 +194,6 @@ docker stats hono-app
|
|
|
194
194
|
|
|
195
195
|
---
|
|
196
196
|
|
|
197
|
-
##
|
|
197
|
+
## 관련 문서
|
|
198
198
|
|
|
199
|
-
- [
|
|
199
|
+
- [배포 가이드](./index.md)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Nitro v3
|
|
1
|
+
# Nitro v3 배포 가이드
|
|
2
2
|
|
|
3
|
-
> Hono + Nitro
|
|
3
|
+
> Hono + Nitro 배포
|
|
4
4
|
|
|
5
5
|
@docker.md
|
|
6
6
|
@railway.md
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## 설치
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
npm install nitro@3
|
|
@@ -17,7 +17,7 @@ npm install nitro@3
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## 기본 설정
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
// nitro.config.ts
|
|
@@ -32,7 +32,7 @@ export default defineNitroConfig({
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## 엔트리포인트
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
38
|
// src/server.ts
|
|
@@ -51,19 +51,19 @@ export default app;
|
|
|
51
51
|
## CLI
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
npx nitro dev #
|
|
55
|
-
npx nitro build #
|
|
56
|
-
npx nitro preview #
|
|
57
|
-
node .output/server/index.mjs #
|
|
54
|
+
npx nitro dev # 개발 서버
|
|
55
|
+
npx nitro build # 빌드
|
|
56
|
+
npx nitro preview # 프리뷰
|
|
57
|
+
node .output/server/index.mjs # 실행
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
---
|
|
61
61
|
|
|
62
|
-
## Preset
|
|
62
|
+
## Preset 선택
|
|
63
63
|
|
|
64
|
-
| Preset |
|
|
65
|
-
|
|
66
|
-
| `node` | Node.js
|
|
64
|
+
| Preset | 용도 |
|
|
65
|
+
|--------|------|
|
|
66
|
+
| `node` | Node.js 서버, Docker |
|
|
67
67
|
| `cloudflare_module` | Cloudflare Workers |
|
|
68
68
|
| `cloudflare_pages` | Cloudflare Pages |
|
|
69
69
|
| `vercel` | Vercel Functions |
|
|
@@ -71,7 +71,7 @@ node .output/server/index.mjs # Run
|
|
|
71
71
|
|
|
72
72
|
---
|
|
73
73
|
|
|
74
|
-
##
|
|
74
|
+
## 환경 변수
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
// nitro.config.ts
|
|
@@ -97,22 +97,22 @@ app.get("/config", (c) => {
|
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
100
|
-
##
|
|
100
|
+
## 프로젝트 구조
|
|
101
101
|
|
|
102
102
|
```
|
|
103
|
-
|
|
103
|
+
프로젝트/
|
|
104
104
|
├── nitro.config.ts
|
|
105
105
|
├── src/
|
|
106
|
-
│ ├── server.ts # Hono
|
|
106
|
+
│ ├── server.ts # Hono 앱
|
|
107
107
|
│ ├── routes/
|
|
108
108
|
│ └── lib/
|
|
109
|
-
├── .output/ #
|
|
109
|
+
├── .output/ # 빌드 결과물
|
|
110
110
|
└── package.json
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
---
|
|
114
114
|
|
|
115
|
-
##
|
|
115
|
+
## 관련 문서
|
|
116
116
|
|
|
117
117
|
- [Docker](./docker.md)
|
|
118
118
|
- [Railway](./railway.md)
|