{"id":1882,"date":"2026-08-18T20:14:12","date_gmt":"2026-08-18T12:14:12","guid":{"rendered":"https:\/\/tongchun.website\/index.php\/kimiagent-16-website\/"},"modified":"2026-08-18T20:26:34","modified_gmt":"2026-08-18T12:26:34","slug":"kimiagent-16-website","status":"publish","type":"page","link":"https:\/\/tongchun.website\/index.php\/kimiagent-16-website\/","title":{"rendered":"16 \u00b7 \u660e\u661f\u6280\u80fd\u3010\u7f51\u7ad9\u3011\uff1awebapp-building + backend-building + .websites-templates \u6df1\u62c6"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u2190 \u8fd4\u56de\u4e3b\u62a5\u544a\uff1a<a href=\"https:\/\/tongchun.website\/index.php\/2026\/kimi-agent%ef%bc%88%e4%ba%91%e7%ab%af%e6%b2%99%e7%ae%b1%ef%bc%89%e6%8a%80%e6%9c%af%e6%8a%a5%e5%91%8a\/\">Kimi Agent\uff08\u4e91\u7aef\u6c99\u7bb1\uff09\u6280\u672f\u62a5\u544a<\/a> \uff5c <a href=\"https:\/\/github.com\/SHAWNTRIBBIANI\/kimiagent-analysis\/blob\/main\/sections\/16-website.md\">GitHub \u539f\u6587<\/a><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u5408\u89c4\u4e0e\u98ce\u9669\u58f0\u660e<\/strong>\uff1a\u672c\u62a5\u544a\u4e3a\u5b89\u5168\u7814\u7a76\u4e0e\u4e92\u64cd\u4f5c\u5b66\u4e60\u76ee\u7684\u7684\u9006\u5411\u5206\u6790\uff0c\u5168\u7a0b\u53ea\u8bfb\u91c7\u96c6\uff0c\u672a\u5bf9\u76ee\u6807\u7cfb\u7edf\u505a\u4efb\u4f55\u4fee\u6539\uff1b\u6587\u4e2d\u6240\u6709\u5bc6\u94a5\u3001token\u3001\u8d26\u53f7\u7ea7\u6807\u8bc6\uff08chat_id \/ project_id \/ tenant_id \u7b49\uff09\u5747\u5df2\u8131\u654f\uff1b\u6c99\u7bb1\u5185\u53d1\u73b0\u7684\u9ed8\u8ba4\u5f31\u53e3\u4ee4\uff08VNC\/SSH\uff09\u5c5e\u5e73\u53f0\u4fa7\u914d\u7f6e\uff0c\u4ec5\u4f5c\u5b89\u5168\u53d1\u73b0\u62ab\u9732\uff0c\u8bf7\u52ff\u7528\u4e8e\u8bbf\u95ee\u4efb\u4f55\u4e0d\u5c5e\u4e8e\u81ea\u5df1\u7684\u7cfb\u7edf\u3002docx\/pdf\/xlsx\/kimi-slides \u7b49\u5f15\u64ce\u4e8c\u8fdb\u5236\u4e3a Moonshot \u4e13\u6709\u8bb8\u53ef\uff08\u7981\u518d\u5206\u53d1\/\u9006\u5411\uff09\uff0c\u672c\u6587\u4ec5\u4f5c\u884c\u4e3a\u7ea7\u63cf\u8ff0\u3002\u62a5\u544a\u57fa\u4e8e\u5355\u6b21\u5206\u6790\u7a97\u53e3\uff08\u7ea6 50 \u5206\u949f\u751f\u547d\u5468\u671f\uff09\uff0c\u8f6f\u4ef6\u7248\u672c\u4e0e\u6280\u80fd\u5e93\u5b58\u968f\u955c\u50cf\u66f4\u65b0\u53ef\u80fd\u53d8\u5316\u3002<\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u8303\u56f4\uff1a<code>\/app\/.agents\/skills\/webapp-building\/<\/code>\uff08141 \u884c init \u811a\u672c + 25 \u5957\u6a21\u677f\u76ee\u5f55\uff09\u3001 <code>\/app\/.agents\/skills\/backend-building\/<\/code>\uff08650 \u884c graft \u811a\u672c + 9 \u4e2a .mjs \u7ed3\u6784\u5316\u5408\u5e76\u5668 + base\/db\/auth \u4e09\u5c42\u6a21\u677f\u6811 + 6 \u7bc7 docs\uff09\u3001 <code>\/mnt\/portal-overlay\/.websites-templates\/<\/code>\uff0813 \u5957\u8fd0\u884c\u65f6\u6a21\u677f zip + info.md\uff0cportal FUSE \u53ea\u8bfb\u6302\u8f7d\uff09\u3002 \u91c7\u96c6\u65b9\u5f0f\uff1aHTTP \u53ea\u8bfb\uff0818080\uff09\u3002\u91c7\u96c6\u4e2d\u6bb5\u6c99\u7bb1\u96a7\u9053\u4e00\u5ea6\u4e2d\u65ad\uff0818080 connection refused\uff0c\u7ea6 10:05\u201310:21Z\uff09\uff0c\u6062\u590d\u540e\u8865\u91c7\u5b8c\u6210 docs\/ \u516d\u7bc7\u4e0e 13 \u4efd info.md\uff0c\u5168\u90e8\u5173\u952e\u6587\u4ef6\u5747\u5df2\u901a\u8bfb\u3002<\/p><\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 id=\"1-%25e6%2580%25bb%25e8%25a7%2588%25e4%25b8%25a4%25e4%25b8%25aa%25e6%258a%2580%25e8%2583%25bd-%25e4%25b8%2580%25e4%25b8%25aa-portal-%25e8%25b5%2584%25e4%25ba%25a7%25e7%259b%25ae%25e5%25bd%2595%25e7%259a%2584%25e5%2588%2586%25e5%25b7%25a5\" class=\"wp-block-heading\">1. \u603b\u89c8\uff1a\u4e24\u4e2a\u6280\u80fd + \u4e00\u4e2a portal \u8d44\u4ea7\u76ee\u5f55\u7684\u5206\u5de5<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>webapp-building\uff08\u524d\u7aef\u5236\u54c1\uff09\n  \u251c\u2500 SKILL.md 121 \u884c\uff1aReact19+TS+Vite+Tailwind3.4+shadcn\/ui\uff1b\u5c3e\u90e8\u6574\u6bb5 Product Knowledge\uff08\u5e73\u53f0\u4e8b\u5b9e\u9632\u5e7b\u89c9\uff09\n  \u251c\u2500 scripts\/init-webapp.sh 141 \u884c\uff1a\u89e3 zip \u6a21\u677f \u2192 \u6539 &lt;title&gt; \u2192 \u8986\u76d6\u9884\u88c5 node_modules \u2192 \u6ce8\u518c app \u2192 git \u57fa\u7ebf\u63d0\u4ea4\n  \u251c\u2500 scripts\/.prepare-template.sh\uff1a\u955c\u50cf\u6784\u5efa\u671f\u9884\u8dd1 npm install \u751f\u6210 scripts\/template\/node_modules\/\uff08\u8fd0\u884c\u65f6\u96f6\u4e0b\u8f7d\uff09\n  \u251c\u2500 scripts\/template\/\uff1a\u9884\u88c5\u4f9d\u8d56\u7684\u9ed8\u8ba4\u6a21\u677f\u5de5\u7a0b\u672c\u4f53\uff08http.server \u76f4\u63a5\u8fd4\u56de\u5176 index.html\uff0c\u8bc1\u660e\u662f\u5b8c\u6574 Vite \u5de5\u7a0b\uff09\n  \u2514\u2500 templates\/\uff1a25 \u4e2a\u76ee\u5f55 = 13 \u5957\u7f16\u53f7\u6a21\u677f\uff080-origin\u202612-seaside-stay\uff09+ 12 \u5957 *-style \u98ce\u683c\u6a21\u677f\uff08airlens\/exhibition\/exvia\/forest\/kaleo\/lipstick\/modo\/photographer\/playza\/shibumi\/swiss-dada\/villa\uff09\n\nbackend-building\uff08\u540e\u7aef\u5ac1\u63a5\uff0c\u6280\u672f\u542b\u91cf\u6838\u5fc3\uff09\n  \u251c\u2500 SKILL.md 274 \u884c\uff1atRPC 11 + Drizzle + Hono + MySQL + Kimi OAuth\uff1b10+ \u6761 NEVER \u9632\u5fa1\u6027\u6761\u6b3e\n  \u251c\u2500 scripts\/init.sh 650 \u884c\uff1a--features db,auth \u589e\u91cf graft\uff1b.backend-features.json manifest \u8bb0\u8d26\uff1b--template \u6a21\u5f0f\n  \u251c\u2500 scripts\/lib\/*.mjs \u00d79\uff1a\u7ed3\u6784\u5316\u5408\u5e76\u5668\/\u8865\u4e01\u5668\uff08regex \u7ea7\uff0c\u975e AST\uff09\n  \u2514\u2500 scripts\/template\/\uff1abase\/ db\/ auth\/ \u4e09\u5c42\u6a21\u677f + \u9884\u88c5 node_modules\/\uff0885 \u4e2a\u9876\u5c42\u5305\uff0c\u542b @trpc\/*\u3001drizzle-orm\u3001mysql2\u3001jose\u3001@aws-sdk\/client-s3\u3001hono\u3001react-router \u7b49\uff09+ package.json\uff08name: backend-building-toolchain\uff09\n\n\/mnt\/portal-overlay\/.websites-templates\/\uff08portal \u4e0b\u53d1\u7684\u53ea\u8bfb\u8d44\u4ea7\uff09\n  \u2514\u2500 13 \u4e2a\u76ee\u5f55\uff1a\u6bcf\u4e2a\u542b &lt;name&gt;.zip + info.md\uff08+ 0-origin \u6709\u4e2a .DS_Store\uff09\n     0-origin \/ 1-cyber-rain-frontend \/ 2-color-room-frontend \/ 3-flow-shader-frontend \/\n     4-sunset-trip-frontend \/ 5-dream-run-frontend \/ 6-ascii-moon-frontend \/ 7-vortex-gallery-frontend \/\n     8-liquit-paint-frontend \/ 9-moon-note-fullstack \/ 10-calm-space-fullstack \/ 11-my-blog-fullstack \/ 12-seaside-stay-fullstack<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5173\u952e\u67b6\u6784\u4e8b\u5b9e\uff08\u4e0e\u7b2c\u4e00\u8f6e\u62a5\u544a\u4e92\u76f8\u5370\u8bc1\uff09\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>\/app\/.websites-templates<\/code> \u4e0e <code>\/mnt\/agents\/.websites-templates<\/code> \u90fd\u662f\u6307\u5411 <code>\/mnt\/portal-overlay\/.websites-templates<\/code> \u7684\u7b26\u53f7\u94fe\u63a5\u2014\u2014<strong>\u6a21\u677f\u7531 portal \u6309\u8d26\u53f7\u5b9e\u65f6\u4e0b\u53d1\u3001\u53ef\u70ed\u66f4\u65b0\uff0c\u4e0d\u70d8\u7119\u8fdb\u955c\u50cf<\/strong>\u3002<\/li><li>webapp-building\/scripts \u4e0b\u7684\u6ce8\u91ca\u660e\u786e\u5199\u4e86\u8fd9\u4e00\u70b9\uff1a&#8221;The repository-local templates directory remains a build input for <code>.prepare-template.sh<\/code> only and is intentionally not a runtime fallback.&#8221;<\/li><\/ul>\n\n\n\n<h2 id=\"2-webappbuilding-%25e8%25af%25a6%25e8%25a7%25a3\" class=\"wp-block-heading\">2. webapp-building \u8be6\u89e3<\/h2>\n\n\n\n<h3 id=\"21-%25e8%25be%2593%25e5%2585%25a5%25e8%25be%2593%25e5%2587%25ba%25e5%25a5%2591%25e7%25ba%25a6\" class=\"wp-block-heading\">2.1 \u8f93\u5165\u8f93\u51fa\u5951\u7ea6<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>\u8f93\u5165\uff1a<code>init-webapp.sh &lt;website-title&gt; [template-name]<\/code>\uff1b\u6a21\u677f\u540d\u6b63\u5219\u767d\u540d\u5355 <code>^[A-Za-z0-9_-]+$<\/code>\u3002<\/li><li>\u786c\u9519\u8bef\uff08\u65e0\u56de\u9000\uff09\uff1aportal \u6302\u8f7d\u7f3a\u5931\u3001\u6a21\u677f\u76ee\u5f55\u7f3a\u5931\u3001zip \u7f3a\u5931\u3001info.md \u7f3a\u5931\u3001zip\/info.md \u662f\u7b26\u53f7\u94fe\u63a5\u2014\u2014\u5168\u90e8\u76f4\u63a5 exit 1\u3002<\/li><li>\u9632\u76ee\u5f55\u9003\u9038\uff1a<code>cd -P<\/code> \u89e3\u6790\u7269\u7406\u8def\u5f84\u540e\u505a\u524d\u7f00\u68c0\u67e5\uff0c<code>TEMPLATE_PATH_REAL != MOUNT_ROOT_REAL\/*<\/code> \u5373\u62d2\u7edd\u3002<\/li><li>\u8f93\u51fa\uff1a\u56fa\u5b9a\u5199\u5230 <code>\/mnt\/agents\/output\/app<\/code>\uff08\u53ef\u7528 <code>PROJECT_PATH<\/code> \u73af\u5883\u53d8\u91cf\u8986\u76d6\uff09\uff1b\u6a21\u677f\u4e13\u5c5e\u8bf4\u660e\u901a\u8fc7 stdout \u6253\u5370 info.md \u7ed9 agent \u8bfb\u3002<\/li><\/ul>\n\n\n\n<h3 id=\"22-%25e5%25b7%25a5%25e4%25bd%259c%25e6%25b5%2581%25e7%25a8%258binitwebappsh-%25e5%2585%25a8%25e6%2596%2587%25e5%25b7%25b2%25e8%25af%25bb\" class=\"wp-block-heading\">2.2 \u5de5\u4f5c\u6d41\u7a0b\uff08init-webapp.sh \u5168\u6587\u5df2\u8bfb\uff09<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>\u89e3\u538b <code>$TEMPLATE_NAME.zip<\/code> \u5230 <code>\/tmp\/temp-webapp<\/code>\uff08\u82e5\u89e3\u538b\u51fa\u540c\u540d\u5b50\u76ee\u5f55\u5219\u4e0b\u94bb\u4e00\u5c42\uff09\uff1b<\/li><li>\u628a info.md \u62f7\u8fdb\u9879\u76ee\u6839\uff08\u7559\u7ed9 agent \u8bfb\uff09\uff1b<\/li><li>sed \u66ff\u6362 <code>index.html<\/code> \u7684 <code>&lt;title&gt;<\/code>\uff08\u5bf9 <code>\/<\/code> <code>&amp;<\/code> \u505a\u8f6c\u4e49\uff09\uff1b<\/li><li><code>cp -r<\/code> \u6a21\u677f\u6587\u4ef6 + <strong>\u76f4\u63a5\u590d\u5236 <code>scripts\/template\/node_modules<\/code><\/strong>\uff08\u8fd9\u5c31\u662f\u51b7\u542f\u52a8\u96f6\u4e0b\u8f7d\u7684\u5173\u952e\uff09\uff1b<\/li><li>\u975e\u9ed8\u8ba4\u6a21\u677f\uff08\u22600-origin\uff09\u989d\u5916\u8dd1\u4e00\u6b21 <code>npm install --silent<\/code> \u8865\u9f50\u6a21\u677f\u7279\u6709\u4f9d\u8d56\uff1b<\/li><li><code>curl -sf -X POST http:\/\/localhost:8080\/api\/v1\/apps -d '{\"name\":..., \"features\":[]}'<\/code> <strong>\u5411 portal \u6ce8\u518c app<\/strong>\uff08\u5931\u8d25\u4ec5\u8b66\u544a\uff0c\u4e0d\u963b\u585e\uff09\uff1b<\/li><li>\u8ffd\u52a0 <code>node_modules<\/code> \u5230 .gitignore\uff0c<code>git init -b main<\/code> + \u914d\u7f6e safe.directory + \u63d0\u4ea4\u57fa\u7ebf commit <code>chore(webapp-building): init template \"...\"<\/code>\uff1b<\/li><li>\u975e\u9ed8\u8ba4\u6a21\u677f\u628a info.md \u5168\u6587\u7528\u5206\u9694\u7ebf\u6846\u8d77\u6765\u6253\u5230 stdout\uff08&#8221;TEMPLATE INFO&#8221;\uff09\uff0c\u4f9b agent \u6d88\u8d39\u3002<\/li><\/ol>\n\n\n\n<h3 id=\"23-%25e9%25a2%2584%25e8%25a3%2585-nodemodules-%25e7%259a%2584%25e6%259d%25a5%25e5%258e%2586preparetemplatesh-%25e5%2585%25a8%25e6%2596%2587%25e5%25b7%25b2%25e8%25af%25bb27-%25e8%25a1%258c\" class=\"wp-block-heading\">2.3 \u9884\u88c5 node_modules \u7684\u6765\u5386\uff08.prepare-template.sh \u5168\u6587\u5df2\u8bfb\uff0c27 \u884c\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u955c\u50cf\u6784\u5efa\u671f\u8dd1\u4e00\u6b21\uff1a\u89e3 <code>templates\/0-origin\/0-origin.zip<\/code> \u2192 \u5728\u6a21\u677f\u76ee\u5f55\u91cc <code>npm install<\/code> \u2192 \u628a\u6574\u4e2a\u5de5\u7a0b\uff08\u542b node_modules\uff09\u62f7\u5230 <code>scripts\/template\/<\/code>\u3002\u8fd0\u884c\u65f6 init-webapp.sh \u7684 <code>cp -r node_modules<\/code> \u5168\u90e8\u6765\u6e90\u4e8e\u6b64\u2014\u2014<strong>\u6c99\u7bb1\u8fd0\u884c\u65f6\u96f6 npm \u4e0b\u8f7d<\/strong>\uff0c\u53ea\u6709\u975e\u9ed8\u8ba4\u6a21\u677f\u624d\u9700\u8981\u589e\u91cf <code>npm install<\/code> \u8865\u5dee\u5f02\u4f9d\u8d56\u3002\u5b9e\u6d4b <code>scripts\/template\/<\/code> \u662f\u4e00\u4e2a\u5b8c\u6574 Vite \u5de5\u7a0b\uff08http.server \u76f4\u63a5\u8fd4\u56de\u5b83\u7684 index.html\uff09\uff0cnode_modules \u9876\u5c42 257 \u4e2a\u6761\u76ee\uff1bpackage.json \u8bc1\u5b9e\u6808\u4e3a React 19.2 + Vite 7.2.4 + Tailwind 3.4.19 + \u5168\u90e8 30 \u4e2a @radix-ui \u5305 + recharts\/embla\/cmdk\/sonner\/react-hook-form\/zod\u3002info.md\uff080-origin\uff09\u81ea\u8ff0 &#8220;Using Node.js 20, Tailwind CSS v3.4.19, and Vite v7.2.4&#8221; + 40+ \u7ec4\u4ef6\u6e05\u5355 + import \u793a\u4f8b\u2014\u2014\u662f init \u56de\u663e + agent \u8bf4\u660e\u4e66\u4e8c\u5408\u4e00\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">devDependencies \u91cc\u6709 <strong><code>kimi-plugin-inspect-react: ^1.0.3<\/code><\/strong>\u2014\u2014Kimi \u81ea\u5df1\u53d1\u5e03\u7684 npm \u5305\uff08React \u5143\u7d20\u5ba1\u67e5\uff09\uff0c\u662f\u9884\u89c8\u73af\u5883&#8221;\u70b9\u9009\u5143\u7d20\u5b9a\u4f4d\u6e90\u7801&#8221;\u80fd\u529b\u7684\u6784\u5efa\u671f\u94a9\u5b50\uff0c\u968f\u9ed8\u8ba4\u6a21\u677f\u8fdb\u5165\u6bcf\u4e2a\u4ea7\u7269\u5de5\u7a0b\u3002<\/p>\n\n\n\n<h3 id=\"24-skillmd-%25e7%259a%2584-product-knowledge-%25e6%25ae%25b5%25e9%2598%25b2%25e5%25b9%25bb%25e8%25a7%2589%25e5%25b7%25a5%25e7%25a8%258b\" class=\"wp-block-heading\">2.4 SKILL.md \u7684 Product Knowledge \u6bb5\uff08\u9632\u5e7b\u89c9\u5de5\u7a0b\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u540e\u534a 40 \u884c\u4e0d\u662f\u6280\u672f\u6587\u6863\u800c\u662f<strong>\u5e73\u53f0\u4e8b\u5b9e\u6ce8\u5165<\/strong>\uff0c\u503c\u5f97\u9010\u6761\u5b66\u4e60\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u4ea4\u4ed8 = \u4fdd\u5b58 <code>build_version<\/code>\uff0c\u5e73\u53f0\u6e32\u67d3\u9884\u89c8\u5e76\u6302&#8221;\u7248\u672c\u5361\u7247&#8221;\uff1b<strong>\u5de5\u5177\u8fd4\u56de version ID \u800c\u975e URL<\/strong>\uff08deploy \u5173\u95ed\uff09\uff0c\u7981\u6b62\u7f16\u9020 URL\uff1b<\/li><li>\u9884\u89c8 \u2260 \u53d1\u5e03\uff1a\u53d1\u5e03\u662f\u7528\u6237\u624b\u52a8\u70b9\u300cpublish\u300d\u5f97\u5230 <code>&lt;name&gt;.ok.kimi.link<\/code>\uff0cagent \u6c38\u8fdc\u4e0d\u80fd\u8bf4&#8221;\u5df2\u4e0a\u7ebf&#8221;\uff1b<\/li><li>\u80fd\u529b\u6e05\u5355\uff1a\u5168\u6808\uff08backend-building\uff09\u3001Kimi \u767b\u5f55\u5185\u7f6e\u3001\u516c\u5171\u6258\u7ba1\u5185\u7f6e\u3001\u7248\u672c\u56de\u6eda\u3001\u81ea\u5b9a\u4e49\u5b50\u57df\u3001\u4ee3\u7801\u5bfc\u51fa\u2014\u2014\u5e76\u660e\u786e&#8221;\u5bfc\u51fa\u7684\u4ee3\u7801\u4e0d\u5e26\u8d70 Kimi \u767b\u5f55\u548c\u5e73\u53f0\u6570\u636e\u5e93&#8221;\uff1b<\/li><li>\u8fb9\u754c\uff1a\u4e0d\u652f\u6301\u5fae\u4fe1\u652f\u4ed8\/\u652f\u4ed8\u5b9d\u3001\u4e0d\u652f\u6301\u7b2c\u4e09\u65b9 OAuth\uff08\u53ea\u6709 Kimi \u767b\u5f55 + \u8d26\u53f7\u5bc6\u7801\uff09\uff1b<\/li><li>\u6392\u969c\u8bdd\u672f\uff1a\u9884\u89c8\u7a7a\u767d\u2192\u786e\u8ba4\u9879\u76ee\u5728 <code>\/mnt\/agents\/output\/app<\/code>\uff1b&#8221;\u6570\u636e\u4e22\u4e86&#8221;\u2192\u5148\u786e\u8ba4\u662f\u4e0d\u662f\u771f\u7684\u5168\u6808\uff1b\u957f\u5bf9\u8bdd\u2192\u5efa\u8bae\u5f00\u65b0\u4f1a\u8bdd\u5e76\u5bfc\u51fa\u9879\u76ee\u3002<\/li><\/ul>\n\n\n\n<h2 id=\"3-backendbuilding-%25e8%25af%25a6%25e8%25a7%25a3%25e6%259c%25ac%25e8%25bd%25ae%25e6%25a0%25b8%25e5%25bf%2583\" class=\"wp-block-heading\">3. backend-building \u8be6\u89e3\uff08\u672c\u8f6e\u6838\u5fc3\uff09<\/h2>\n\n\n\n<h3 id=\"31-graft-%25e5%25a2%259e%25e9%2587%258f%25e5%25ae%2589%25e8%25a3%2585%25e6%259c%25ba%25e5%2588%25b6initsh-650-%25e8%25a1%258c%25e5%2585%25a8%25e6%2596%2587%25e5%25b7%25b2%25e8%25af%25bb\" class=\"wp-block-heading\">3.1 graft \u589e\u91cf\u5b89\u88c5\u673a\u5236\uff08init.sh 650 \u884c\u5168\u6587\u5df2\u8bfb\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u8bbe\u8ba1\u601d\u60f3\uff1a\u4e0d\u91cd\u5199\u524d\u7aef\uff0c\u53ea\u589e\u91cf\u5408\u5e76\u3002<\/strong> \u524d\u7aef\u6587\u4ef6\u6c38\u4e0d\u66ff\u6362\uff1b\u540e\u7aef\u4ee5 <code>api\/<\/code>\u3001<code>contracts\/<\/code>\u3001\u53ef\u9009 <code>db\/<\/code> \u7684\u5f62\u5f0f&#8221;\u5ac1\u63a5&#8221;\u5230\u65e2\u6709 webapp-building \u5de5\u7a0b\u4e0a\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e09\u79cd\u8fd0\u884c\u6a21\u5f0f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u9996\u8dd1<\/strong>\uff08\u65e0 manifest \u65e0 api\/\uff09\uff1a\u88c5 base \u57fa\u7840\u8bbe\u65bd + \u8bf7\u6c42\u7684\u7279\u6027\uff08\u9ed8\u8ba4 <code>auth<\/code>\uff0c\u5411\u540e\u517c\u5bb9\uff09\uff1b<\/li><li><strong>\u589e\u91cf\u8dd1<\/strong>\uff08\u6709 manifest\uff09\uff1a\u53ea\u88c5 <code>NEW_FEATURES = \u8bf7\u6c42\u7279\u6027 \u2212 \u5df2\u88c5\u7279\u6027<\/code>\uff1b\u65e0\u65b0\u7279\u6027\u5219\u76f4\u63a5 <code>exit 0<\/code>\uff08\u5e42\u7b49\uff09\uff1b<\/li><li><strong>&#8211;template \u6a21\u5f0f<\/strong>\uff1afullstack \u6a21\u677f zip\uff089\/10\/11\/12 \u53f7\uff09\u5df2\u628a\u6587\u4ef6\u94fa\u597d\u5e76\u81ea\u5e26 <code>.backend-features.json<\/code>\uff0c\u811a\u672c\u8df3\u8fc7\u6240\u6709\u6587\u4ef6\u811a\u624b\u67b6\uff0c\u53ea\u505a portal \u6ce8\u518c + \u5199 .env + node_modules \u8986\u76d6 + npm install + git \u63d0\u4ea4\u3002\u4e0e <code>--features<\/code> \u4e92\u65a5\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u7279\u6027\u89e3\u6790<\/strong>\uff1a<code>resolve_features()<\/code> \u628a <code>auth<\/code> \u81ea\u52a8\u5c55\u5f00\u4e3a <code>db auth<\/code>\uff08\u4f9d\u8d56\u95ed\u5305\uff09\uff0c\u53bb\u91cd\u3001\u767d\u540d\u5355\u6821\u9a8c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u72b6\u6001\u8bb0\u8d26<\/strong>\uff1a<code>.backend-features.json<\/code> manifest\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\">{ \"version\": 1, \"features\": [\"db\",\"auth\"], \"app_id\": \"...\", \"initialized_at\": \"...\" }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u9057\u7559\u5de5\u7a0b\u63a2\u6d4b<\/strong>\uff1a\u65e0 manifest \u4f46\u6709 <code>api\/<\/code> \u65f6\uff0c\u6309 <code>db\/schema.ts<\/code>+<code>drizzle.config.ts<\/code>\uff08\u2192db\uff09\u548c <code>api\/kimi\/<\/code>\uff08\u2192auth\uff09\u53cd\u63a8\u7279\u6027\uff0c\u4ece\u65e7 <code>.env<\/code> \u8bfb <code>APP_ID<\/code>\uff0c<strong>\u8865\u5199 manifest<\/strong>\u2014\u2014\u8001\u5de5\u7a0b\u5e73\u6ed1\u8fc1\u79fb\u5230\u65b0\u8bb0\u8d26\u4f53\u7cfb\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5b89\u5168\u7f51<\/strong>\uff1a\u52a8\u4efb\u4f55\u6587\u4ef6\u4e4b\u524d\uff0c\u5148\u628a\u5de5\u4f5c\u533a\u672a\u63d0\u4ea4\u7684\u6539\u52a8 <code>git add -A && commit -m \"wip: save changes before backend-building init\"<\/code>\u3002\u6bcf\u6b65\u5b8c\u6210\u540e\u518d\u6b21\u63d0\u4ea4\u57fa\u7ebf\u3002\u914d\u5408 <code>trap ERR<\/code> \u6253\u5370&#8221;\u8bf7\u4e2d\u6b62\u4efb\u52a1\u5e76\u5411 Kimi \u53cd\u9988&#8221;\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>safe_copy \u54f2\u5b66<\/strong>\uff1a\u76ee\u6807\u5df2\u5b58\u5728\u5219\u8df3\u8fc7\u5e76\u8bb0\u5f55\u5230 <code>SKIPPED_FILES<\/code>\uff08\u5e26\u4eba\u7c7b\u53ef\u8bfb\u7684&#8221;\u8be5\u6587\u4ef6\u672c\u5e94\u63d0\u4f9b\u4ec0\u4e48&#8221;\u63cf\u8ff0\uff09\uff0c\u7ed3\u5c3e\u7edf\u4e00\u6253\u5370&#8221;Skipped (already exist)&#8221;\u6e05\u5355\u8ba9 agent \u4eba\u5de5\u6838\u5bf9\u3002\u7528\u6237\u6539\u8fc7\u7684\u6587\u4ef6\u6c38\u4e0d\u88ab\u8986\u76d6\u3002<\/p>\n\n\n\n<h3 id=\"32-%25e4%25b9%259d%25e4%25b8%25aa-mjs-%25e7%25bb%2593%25e6%259e%2584%25e5%258c%2596%25e5%2590%2588%25e5%25b9%25b6%25e5%2599%25a8scriptslib%25e5%2585%25a8%25e9%2583%25a8%25e5%25b7%25b2%25e8%25af%25bb\" class=\"wp-block-heading\">3.2 \u4e5d\u4e2a .mjs \u7ed3\u6784\u5316\u5408\u5e76\u5668\uff08scripts\/lib\/\uff0c\u5168\u90e8\u5df2\u8bfb\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ce8\u610f\uff1a\u5168\u90e8\u57fa\u4e8e<strong>\u6b63\u5219\/\u5b57\u7b26\u4e32\u951a\u70b9<\/strong>\uff0c\u4e0d\u662f AST\uff1b\u6bcf\u4e2a\u90fd\u5e42\u7b49\uff08\u5df2\u542b\u76ee\u6807\u5185\u5bb9\u5219 exit 0\uff09\uff0c\u5931\u8d25\u65f6 init.sh \u6709\u515c\u5e95\uff08\u5168\u91cf\u66ff\u6362 vite.config.ts\uff09\u6216\u964d\u7ea7\u4e3a\u4eba\u5de5\u63a5\u7ebf\u6e05\u5355\uff08WIRING_TODO\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u811a\u672c<\/th><th>\u903b\u8f91\u8981\u70b9<\/th><\/tr><\/thead><tbody><tr><td><code>merge-package-json.mjs<\/code><\/td><td>\u5f3a\u5236 <code>type:\"module\"<\/code>\uff1bscripts \u540e\u7aef\u8986\u76d6\uff1bdeps <strong>\u53ea\u589e\u4e0d\u6539<\/strong>\uff08\u4e0d\u8986\u76d6\u65e2\u6709\u7248\u672c\uff0c\u907f\u514d\u628a\u524d\u7aef\u4f9d\u8d56\u7248\u672c\u51b2\u6389\uff09<\/td><\/tr><tr><td><code>merge-tsconfig.mjs<\/code><\/td><td>\u81ea\u5e26 JSONC \u89e3\u6790\uff08\u53bb <code>\/\/<\/code> \u6ce8\u91ca\u3001\u53bb\u5c3e\u9017\u53f7\uff09\uff1broot tsconfig \u52a0 <code>references: [.\/tsconfig.server.json]<\/code> + <code>@contracts\/<em><\/code>\u3001<code>@db\/<\/em><\/code> paths\uff1btsconfig.app.json \u989d\u5916\u52a0 <code>\"node\"<\/code> types\uff08\u56e0\u4e3a trpc.tsx \u7c7b\u578b\u5f15\u7528 api\/router.ts \u4f1a\u62d6\u5165 Node \u7c7b\u578b\uff09<\/td><\/tr><tr><td><code>patch-vite-config.mjs<\/code><\/td><td>9 \u6b65\u5e42\u7b49\u8865\u4e01\uff1a\u52a0 <code>import path<\/code>\u3001\u6ce8\u5165 <code>__dirname = import.meta.dirname<\/code>\u3001<strong>\u5220\u9664 <code>base:\".\/\"<\/code><\/strong>\uff08Hono \u5fc5\u987b\u4ece &#8220;\/&#8221; \u670d\u52a1\uff09\u3001\u52a0 <code>@contracts<\/code>\/<code>@db<\/code>\/<code>db<\/code> alias\u3001\u52a0 envDir\u3001build.outDir=dist\/public\u3001\u52a0 <code>@hono\/vite-dev-server<\/code> import \u548c\u63d2\u4ef6\uff08exclude \u975e \/api \u8def\u5f84\uff09\u3001server.port=3000<\/td><\/tr><tr><td><code>merge-schema.mjs<\/code><\/td><td>\u628a users \u8868\u5b9a\u4e49\u5408\u5165 db\/schema.ts\uff1a\u6b63\u5219\u63d0\u53d6 <code>export const X = mysqlTable(<\/code> \u5f97\u8868\u540d\u505a\u5e42\u7b49\u68c0\u67e5\uff1b\u9010\u6761 merge import \u7b26\u53f7\uff08\u540c\u540d from \u5408\u5e76\u3001\u53bb\u91cd\uff09\uff1b\u8868\u4f53\u63d2\u5230 <code>\/\/ TODO:<\/code> \u6ce8\u91ca\u4e4b\u524d\u2014\u2014\u5373\u6a21\u677f schema \u91cc\u7684 TODO \u951a\u70b9\u662f\u6709\u8bed\u4e49\u7684<\/td><\/tr><tr><td><code>patch-env-ts.mjs<\/code><\/td><td>\u901a\u7528\u5de5\u5177\uff1a\u5411 <code>api\/lib\/env.ts<\/code> \u7684 env \u5bf9\u8c61\u6700\u540e\u4e00\u4e2a <code>};<\/code> \u524d\u63d2\u5165 JSON \u7247\u6bb5\u63cf\u8ff0\u7684\u5c5e\u6027\uff08\u5982 <code>databaseUrl: required(\"DATABASE_URL\")<\/code>\uff09\uff1b\u6309 key \u5e42\u7b49<\/td><\/tr><tr><td><code>patch-router-auth.mjs<\/code><\/td><td>\u5411 <code>api\/router.ts<\/code> \u6700\u540e import \u540e\u63d2 <code>import { authRouter }<\/code>\uff1b\u627e\u5230 <code>ping:<\/code> \u884c\u5728\u5176\u540e\u63d2 <code>auth: authRouter,<\/code>\u2014\u2014<strong>ping \u8def\u7531\u662f\u6ce8\u5165\u951a\u70b9<\/strong><\/td><\/tr><tr><td><code>patch-boot-auth.mjs<\/code><\/td><td>\u5411 <code>api\/boot.ts<\/code> \u63d2 OAuth import\uff08\u4f18\u5148\u951a\u5b9a env import \u884c\uff09\uff0c\u5728 <code>app.use(bodyLimit(...))<\/code> \u540e\u63d2 <code>app.get(Paths.oauthCallback, createOAuthCallbackHandler())<\/code><\/td><\/tr><tr><td><code>wire-main-tsx.mjs<\/code><\/td><td>\u628a <code>&lt;BrowserRouter&gt;<\/code> \u5185\u5bb9\u5305\u8fdb <code>&lt;TRPCProvider&gt;<\/code>\uff0c\u5e76<strong>\u5bf9\u5305\u88f9\u5185\u5bb9\u7edf\u4e00\u52a0\u4e24\u683c\u7f29\u8fdb<\/strong>\uff1b\u65e0\u951a\u70b9\u5219 exit 1 \u2192 \u964d\u7ea7\u4e3a\u4eba\u5de5 TODO<\/td><\/tr><tr><td><code>wire-app-tsx.mjs<\/code><\/td><td>\u5728\u6700\u540e\u4e00\u4e2a <code>.\/pages\/<\/code> import \u540e\u63d2 Login\/NotFound import\uff0c\u5728 <code>&lt;\/Routes&gt;<\/code> \u524d\u63d2\u4e24\u6761 <code>&lt;Route&gt;<\/code>\uff0c\u7f29\u8fdb\u81ea\u52a8\u5339\u914d\u5df2\u6709 Route<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5de5\u7a0b\u8d28\u91cf\u8bc4\u4ef7\uff1a\u951a\u70b9\u9009\u62e9\uff08ping \u8def\u7531\u3001bodyLimit \u884c\u3001<code>\/\/ TODO:<\/code> \u6ce8\u91ca\u3001\u6700\u540e\u4e00\u4e2a <code>};<\/code>\uff09\u8bf4\u660e\u6a21\u677f\u6587\u4ef6\u548c\u8865\u4e01\u5668\u662f<strong>\u534f\u540c\u8bbe\u8ba1<\/strong>\u7684\uff1b\u6bcf\u4e2a\u8865\u4e01\u5668\u5931\u8d25\u90fd\u6709\u660e\u786e\u964d\u7ea7\u8def\u5f84\uff08fallback \u5168\u91cf\u66ff\u6362 \/ WIRING_TODO \u6e05\u5355\uff09\uff0c\u4e0d\u4f1a\u51fa\u73b0\u534a\u6b8b\u72b6\u6001\u3002<\/p>\n\n\n\n<h3 id=\"33-%25e6%25a8%25a1%25e6%259d%25bf%25e6%25a0%2591%25e4%25b8%2589%25e5%25b1%2582%25e7%25bb%2593%25e6%259e%2584scriptstemplate\" class=\"wp-block-heading\">3.3 \u6a21\u677f\u6811\u4e09\u5c42\u7ed3\u6784\uff08scripts\/template\/\uff09<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>template\/\n\u251c\u2500 node_modules\/          85 \u4e2a\u9876\u5c42\u6761\u76ee\uff08.bin + @aws @hono @trpc @tanstack drizzle-orm mysql2 jose hono react-router\u2026\uff09\n\u251c\u2500 package.json           \"backend-building-toolchain\"\uff1a\u5168\u7279\u6027\u4f9d\u8d56\u5408\u96c6\uff08npm install \u65f6 --prefer-offline \u79d2\u88c5\uff09\n\u251c\u2500 package-lock.json\n\u251c\u2500 base\/   \uff08\u9996\u8dd1\u5fc5\u88c5\uff09\n\u2502  \u251c\u2500 api\/  boot.ts(Hono+tRPC fetchRequestHandler+\u751f\u4ea7\u6a21\u5f0f serveStatic+\u52a8\u6001 import @hono\/node-server)\n\u2502  \u2502        context.ts(\u88f8 req\/resHeaders) middleware.ts(initTRPC+superjson) router.ts(ping \u951a\u70b9)\n\u2502  \u2502        lib\/env.ts(required() \u4ec5\u751f\u4ea7\u629b\u9519) lib\/http.ts(\u901a\u7528 HttpClient) lib\/vite.ts(SPA fallback)\n\u2502  \u251c\u2500 contracts\/ errors.ts(5 \u4e2a\u5de5\u5382\u51fd\u6570) types.ts(\u4ec5 re-export errors)\n\u2502  \u251c\u2500 client-patches\/providers\/trpc.tsx\uff08httpBatchLink + credentials:include\uff0c\u552f\u4e00\u8de8\u8fb9\u754c type import\uff09\n\u2502  \u2514\u2500 configs\/ package.json.feat \/ tsconfig.server.json \/ vitest.config.ts \/ .prettierrc \/ .gitignore \/ .dockerignore\n\u251c\u2500 db\/     \uff08--features db\uff09\n\u2502  \u251c\u2500 db\/ schema.ts(\u7a7a\u8868+TODO \u951a\u70b9+serial\/bigint \u6ce8\u610f\u4e8b\u9879\u6ce8\u91ca) relations.ts seed.ts migrations\/.gitkeep\n\u2502  \u251c\u2500 api\/queries\/connection.ts\uff08lazy getDb() \u5355\u4f8b\uff09\n\u2502  \u2514\u2500 configs\/ drizzle.config.ts(mysql dialect) package.json.feat(db:generate\/migrate\/push \u4e09\u811a\u672c)\n\u2514\u2500 auth\/   \uff08--features auth\uff0c\u81ea\u52a8\u542b db\uff09\n   \u251c\u2500 api\/ context.ts(\u53ef\u9009\u8ba4\u8bc1:try\/catch \u9644\u52a0 ctx.user) middleware.ts(authedQuery\/adminQuery \u4e24\u7ea7)\n   \u2502       auth-router.ts(me\/logout) queries\/users.ts(findUserByUnionId\/upsertUser+ownerUnionId\u2192admin)\n   \u2502       kimi\/ auth.ts(OAuth callback+JWKS \u9a8c\u7b7e+authenticateRequest) platform.ts(\/v1\/users\/me\/profile)\n   \u2502            session.ts(HS256 JWT, 1 \u5e74\u6709\u6548\u671f) types.ts\n   \u2502       lib\/cookies.ts(localhost\u2192Lax+\u975e secure\uff0c\u5426\u5219 None+secure)\n   \u251c\u2500 db\/ schema.users.ts\uff08users \u8868\uff1aserial PK + unionId unique + role enum(user,admin) + $onUpdate \u65f6\u95f4\u6233\uff09\n   \u251c\u2500 contracts\/ constants.ts(Session.cookieName=\"kimi_sid\"\/Paths\/ErrorMessages) types.ts(re-export db\/schema+errors)\n   \u251c\u2500 client-patches\/ hooks\/useAuth.ts pages\/Login.tsx pages\/NotFound.tsx components\/AuthLayout.tsx(\u53ef\u62d6\u5bbd sidebar)\n   \u2502                 AuthLayoutSkeleton.tsx const.ts(LOGIN_PATH)\n   \u2514\u2500 configs\/ package.json.feat\uff08\u542b @aws-sdk\/client-s3\u2014\u2014\u5934\u50cf\/\u6587\u4ef6\u4e0a\u4f20\u9884\u7559\uff09<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u503c\u5f97\u6ce8\u610f\u7684\u6a21\u677f\u8bbe\u8ba1\u7ec6\u8282\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>boot.ts<\/code> \u751f\u4ea7\u6a21\u5f0f\u7528<strong>\u52a8\u6001 import<\/strong> <code>@hono\/node-server<\/code> \u548c vite.ts\u2014\u2014\u5f00\u53d1\u6001\u7531 <code>@hono\/vite-dev-server<\/code> \u6258\u7ba1\uff0c\u4e0d\u52a0\u8f7d node-server\uff1b<\/li><li><code>build<\/code> \u811a\u672c\u662f <code>vite build &amp;&amp; esbuild api\/boot.ts --bundle<\/code> + createRequire banner\u2014\u2014\u524d\u540e\u7aef\u540c\u4e00\u4ed3\u5e93\u53cc\u4ea7\u7269\uff08dist\/public + dist\/boot.js\uff09\uff1b<\/li><li><code>env.ts<\/code> \u7684 <code>required()<\/code> <strong>\u53ea\u5728 production \u629b\u9519<\/strong>\u2014\u2014\u5f00\u53d1\u671f\u5141\u8bb8\u7a7a\u503c\uff0c\u964d\u4f4e\u4e0a\u624b\u6469\u64e6\uff1b<\/li><li>auth \u7684 context \u662f&#8221;\u53ef\u9009\u8ba4\u8bc1&#8221;\uff08try\/catch \u9759\u9ed8\uff09\uff0c\u9274\u6743\u5f3a\u5236\u70b9\u4e0b\u653e\u5230 <code>authedQuery<\/code> \u4e2d\u95f4\u4ef6\u2014\u2014\u516c\u5f00\/\u79c1\u6709\u8def\u7531\u53ef\u4ee5\u5171\u5b58\uff1b<\/li><li>users \u8868\u628a <code>OWNER_UNION_ID<\/code> \u5339\u914d\u7684\u9996\u4e2a\u767b\u5f55\u8005\u81ea\u52a8\u63d0\u5347\u4e3a admin\u2014\u2014\u96f6\u914d\u7f6e\u7ba1\u7406\u5458\u3002<\/li><\/ul>\n\n\n\n<h3 id=\"34-kimi-oauth-%25e4%25b8%258e-portal-%25e7%259a%2584%25e5%25af%25b9%25e6%258e%25a5%25e5%2587%25ad%25e8%25af%2581%25e6%25b5%2581\" class=\"wp-block-heading\">3.4 Kimi OAuth \u4e0e portal \u7684\u5bf9\u63a5\uff08\u51ed\u8bc1\u6d41\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f\u6574\u4e2a\u6280\u80fd\u7ec4\u4e0e Kimi \u4e91<strong>\u8026\u5408\u6700\u6df1<\/strong>\u7684\u90e8\u5206\uff0c\u4e24\u6761\u901a\u9053\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u901a\u9053\u4e00\uff1aportal \u5e94\u7528\u6ce8\u518c\uff08\u6c99\u7bb1\u5185 \u2192 portal:8080\uff09<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>init.sh \u2192 POST http:\/\/localhost:8080\/api\/v1\/apps {\"name\":..., \"features\":[\"db\",\"auth\"]}\n       \u2190 {app_id, app_secret, credentials: {KIMI_AUTH_URL, KIMI_OPEN_URL, DATABASE_URL, ...}}\n\u2192 \u5199 $PROJECT_PATH\/.env\uff1aAPP_ID\/APP_SECRET + \u6d3e\u751f VITE_APP_ID\/VITE_KIMI_AUTH_URL + \u5168\u90e8 credentials \u539f\u6837\u5c55\u5f00<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>webapp-building \u4e5f\u8c03\u540c\u4e00\u7aef\u70b9\u4f46 <code>features:[]<\/code> \u4e14\u5931\u8d25\u4ec5\u8b66\u544a\uff1bbackend-building \u5219<strong>\u5931\u8d25\u5373\u6b7b<\/strong>\uff08\u62ff\u4e0d\u5230 app_id\/secret \u65e0\u6cd5\u7ee7\u7eed\uff09\u3002<\/li><li><code>.env<\/code> \u7531 init.sh \u751f\u6210\u4e14 SKILL.md \u7528 NEVER \u6761\u6b3e\u7981\u6b62 agent \u4fee\u6539\/\u91cd\u5efa\/\u5360\u4f4d\u5316\u5176\u4e2d\u4efb\u4f55\u503c\u3002<\/li><li>manifest \u91cc\u5b58 app_id\uff0c\u589e\u91cf\u52a0\u7279\u6027\u65f6\u4e0d\u4f1a\u91cd\u590d\u6ce8\u518c\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u901a\u9053\u4e8c\uff1a\u8fd0\u884c\u65f6 OAuth\uff08\u4ea7\u7269\u7ad9\u70b9 \u2192 Kimi \u4e91\u670d\u52a1\uff09<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u524d\u7aef Login.tsx \u62fc <code>${VITE_KIMI_AUTH_URL}\/api\/oauth\/authorize?client_id&amp;redirect_uri&amp;response_type=code&amp;scope=profile&amp;state=btoa(redirectUri)<\/code>\uff1b<\/li><li>\u56de\u8c03 <code>GET \/api\/oauth\/callback<\/code>\uff1a<code>state<\/code> atob \u56de redirectUri \u2192 <code>POST {KIMI_AUTH_URL}\/api\/oauth\/token<\/code> \u6362 access_token \u2192 <strong>jose.createRemoteJWKSet(<code>{KIMI_AUTH_URL}\/api\/.well-known\/jwks.json<\/code>) \u9a8c\u7b7e<\/strong> \u53d6 <code>user_id<\/code> \u2192 <code>GET {KIMI_OPEN_URL}\/v1\/users\/me\/profile<\/code> \u53d6\u6635\u79f0\u5934\u50cf \u2192 upsertUser \u2192 \u81ea\u7b7e HS256 \u4f1a\u8bdd JWT\uff08APP_SECRET \u7b7e\u540d\uff0c1 \u5e74\uff09\u2192 \u5199 <code>kimi_sid<\/code> cookie \u8df3\u56de <code>\/<\/code>\uff1b<\/li><li>cookie \u7b56\u7565\u6309 host \u533a\u5206\uff1alocalhost \u2192 SameSite=Lax \u975e secure\uff1b\u5426\u5219 SameSite=None+Secure\uff08\u8de8\u57df\u9884\u89c8 iframe \u573a\u666f\uff09\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5373\uff1aapp_id\/secret \u7531 portal \u4e0b\u53d1\uff0cauthorize\/token\/jwks\/profile \u56db\u4e2a\u7aef\u70b9\u6307\u5411 <code>auth.kimi.com<\/code>\/<code>open.kimi.com<\/code> \u4f53\u7cfb\u3002<strong>\u6ca1\u6709 portal \u5c31\u6ca1\u6709 .env\uff1b\u6ca1\u6709 Kimi OAuth \u670d\u52a1 auth \u7279\u6027\u6574\u4f53\u5931\u6548\u3002<\/strong><\/p>\n\n\n\n<h3 id=\"35-%25e4%25ba%25a7%25e7%2589%25a9%25e9%25aa%258c%25e6%2594%25b6%25e6%25a0%2587%25e5%2587%2586\" class=\"wp-block-heading\">3.5 \u4ea7\u7269\u9a8c\u6536\u6807\u51c6<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">SKILL.md \u628a\u9a8c\u6536\u5199\u6210\u786c\u95e8\u69db\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><code>npm run check<\/code>\uff08<code>tsc -b<\/code>\uff09\u5fc5\u987b\u96f6\u7c7b\u578b\u9519\u8bef\uff1b<\/li><li><code>npm run dev<\/code> \u5fc5\u987b\u8d77\u5728 3000 \u7aef\u53e3\uff08\u7aef\u53e3\u5199\u6b7b\uff0c\u7981\u6b62\u6539\uff09\uff1b<\/li><li>init \u8f93\u51fa\u51fa\u73b0 &#8220;Wiring required&#8221; \u65f6\u5fc5\u987b\u6309 docs\/Post-Init-Wiring.md \u624b\u52a8\u8865\u63a5\u7ebf\uff1b<\/li><li>\u6570\u636e\u5c42\uff1a<code>npm run db:push<\/code> \u540c\u6b65 schema\uff1bNEVER <code>db:push --force<\/code>\u3001NEVER drop \u8868\u4fee\u8fc1\u79fb\uff08MySQL \u65e0\u4e8b\u52a1 DDL\uff0c\u7ed9\u4e86 4 \u6b65\u6062\u590d\u6d41\u7a0b\uff09\uff1b<\/li><li>Common Mistakes 11 \u6761\uff1a\u7981\u6b62\u624b\u5199 DB \u7c7b\u578b\uff08\u7528 <code>typeof table.$inferSelect<\/code>\uff0c\u5bf9\u9f50 superjson \u7684 Date \u5e8f\u5217\u5316\uff09\u3001\u7981\u6b62\u88f8 SQL\u3001\u7981\u6b62\u6539 <code>api\/lib<\/code>\/<code>api\/kimi<\/code>\u3001\u7981\u6b62\u4ece\u524d\u7aef import <code>api\/<\/code>\uff08\u8d70 <code>@contracts\/<\/code>\uff09\u3001tRPC \u5ba2\u6237\u7aef\u540d\u662f <code>trpc<\/code> \u4e0d\u662f <code>api<\/code>\u3001\u5fc5\u987b Zod \u6821\u9a8c input\u3001FK \u5fc5\u987b <code>bigint(unsigned)<\/code> \u5339\u914d serial PK\u2026\u2026<\/li><\/ol>\n\n\n\n<h3 id=\"36-docs-%25e5%2585%25ad%25e7%25af%2587%25e5%2585%25a8%25e9%2583%25a8%25e5%25b7%25b2%25e8%25af%25bb%25e5%2585%25b6%25e4%25b8%25ad-databasedevelopmentguidepostinitwiringtrpc-%25e4%25b8%258e-swarm-%25e5%258f%2598%25e4%25bd%2593%25e9%2580%2590%25e5%25ad%2597%25e8%258a%2582%25e7%259b%25b8\" class=\"wp-block-heading\">3.6 docs\/ \u516d\u7bc7\uff08\u5168\u90e8\u5df2\u8bfb\uff1b\u5176\u4e2d Database\/Development-Guide\/Post-Init-Wiring\/tRPC \u4e0e swarm \u53d8\u4f53\u9010\u5b57\u8282\u76f8\u540c\uff0cAuthentication\/Project-Structure \u4ec5\u5dee 1-3 \u884c\u63aa\u8f9e\uff09<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Authentication.md<\/strong>\uff08242 \u884c\uff09\uff1a\u5b8c\u6574 OAuth 2.0 \u8bf4\u660e\u2014\u2014\u67b6\u6784\uff08<code>api\/kimi\/{auth,session,platform}.ts<\/code>\uff09\u3001<strong>Login.tsx \u5168\u6587\u5185\u5d4c\u5e76\u8981\u6c42&#8221;\u7981\u6b62\u81ea\u5199\u767b\u5f55\u9875&#8221;<\/strong>\u3001\u65e0\u6ce8\u518c\u6d41\u7a0b\uff08\u9996\u767b\u81ea\u52a8 upsert\uff0c\u6ce8\u518c CTA \u4e00\u5f8b\u6307\u5411 <code>LOGIN_PATH<\/code>\uff09\u3001admin \u5206\u914d\u673a\u5236\uff08portal \u54cd\u5e94\u7684 <code>creator_user_id<\/code> \u2192 <code>OWNER_UNION_ID<\/code>\uff0cunionId \u5339\u914d\u5373 admin\uff09\u3001\u4e09\u7ea7 procedure \u8868\uff08publicQuery\/authedQuery\/adminQuery\uff09\u3002\u4e0e swarm \u7248\u552f\u4e00\u5b9e\u8d28\u5dee\u5f02\uff1a\u5c11\u4e86 &#8220;The supported scope is <code>profile<\/code>&#8221; \u548c\u6ce8\u518c\u6d41\u7a0b\u4e24\u53e5\u8bdd\uff08swarm \u7248\u66f4\u65b0\uff09\u3002<\/li><li><strong>Database.md<\/strong>\uff08381 \u884c\uff09\uff1aDrizzle \u7eaa\u5f8b\u2014\u2014<code>$inferSelect<\/code>\/<code>$inferInsert<\/code> \u4ee3\u66ff\u624b\u5199 interface\uff08\u4e0e superjson \u7684 Date \u5e8f\u5217\u5316\u5bf9\u9f50\uff09\u3001MySQL \u65e0 <code>.returning()<\/code> \u7528 <code>.$returningId()<\/code>\u3001<code>onDuplicateKeyUpdate<\/code> upsert\u3001<code>db:push<\/code>\uff08\u5f00\u53d1\uff09vs <code>db:generate<\/code>+<code>db:migrate<\/code>\uff08\u751f\u4ea7\uff09\u5206\u6d41\u3001relations \u578b\u8054\u8868\u67e5\u8be2\u3002<\/li><li><strong>Project-Structure.md<\/strong>\uff08147 \u884c\uff09\uff1a\u5b8c\u6574\u76ee\u5f55\u6811 + import \u522b\u540d\u516c\u7ea6\u8868\uff08<code>@\/<\/code>\u2192src \u524d\u7aef\u4e13\u7528\u3001<code>@contracts\/<\/code>\u2192\u524d\u540e\u7aef\u5171\u4eab\u3001<code>@db\/<\/code>\u2192api \u4e13\u7528\uff1bapi \u5185\u90e8\u7528\u76f8\u5bf9\u8def\u5f84\uff09\u3002<\/li><li><strong>tRPC.md<\/strong>\uff08161 \u884c\uff09\uff1a\u6309\u7279\u6027\u6a21\u5757\u5316 router\u3001zod input \u5f3a\u5236\u3001superjson \u8bed\u4e49\u3001curl \u6d4b\u7aef\u70b9\uff1b\u660e\u786e &#8220;db-only \u6a21\u5f0f middleware.ts \u53ea\u5bfc\u51fa publicQuery\/createRouter&#8221;\u3002<\/li><li><strong>Development-Guide.md<\/strong>\uff08260 \u884c\uff09\uff1a\u7aef\u5230\u7aef\u52a0\u4e00\u4e2a notes \u7279\u6027\u7684\u4e94\u6b65\u8d70\uff08schema\u2192queries\u2192router\u2192\u6ce8\u518c\u2192\u524d\u7aef\u9875\u9762\uff09\u3002<\/li><li><strong>Post-Init-Wiring.md<\/strong>\uff0838 \u884c\uff09\uff1aauto-wire \u5931\u8d25\u65f6\u7684\u4eba\u5de5\u63a5\u7ebf\u4e24\u6b65\u9aa4\uff08main.tsx \u5305 TRPCProvider\u3001App.tsx \u52a0\u4e24\u6761 Route\uff09\u2014\u2014\u786e\u5b9a\u6027\u811a\u672c\u5931\u8d25\u6709\u663e\u5f0f\u4eba\u5de5\u515c\u5e95\u6587\u6863\uff0c\u95ed\u73af\u5b8c\u6574\u3002<\/li><\/ul>\n\n\n\n<h3 id=\"37-13-%25e5%25a5%2597-portal-%25e6%25a8%25a1%25e6%259d%25bfmntportaloverlaywebsitestemplatesinfomd-%25e5%2585%25a8%25e9%2583%25a8%25e5%25b7%25b2%25e8%25af%25bb-zip-%25e5%25b0%25ba%25e5%25af%25b8%25e5%25b7%25b2%25e8%25ae%25b0%25e5%25bd%2595\" class=\"wp-block-heading\">3.7 13 \u5957 portal \u6a21\u677f\uff08\/mnt\/portal-overlay\/.websites-templates\/\uff0cinfo.md \u5168\u90e8\u5df2\u8bfb + zip \u5c3a\u5bf8\u5df2\u8bb0\u5f55\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">zip \u5c3a\u5bf8\uff08HEAD content-length\uff09\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u6a21\u677f<\/th><th>zip \u5927\u5c0f<\/th><th>\u7c7b\u578b<\/th><\/tr><\/thead><tbody><tr><td>0-origin<\/td><td>116 KB<\/td><td>\u9ed8\u8ba4\u57fa\u5ea7\uff0840+ shadcn \u7ec4\u4ef6\uff09<\/td><\/tr><tr><td>1-cyber-rain<\/td><td>90 KB<\/td><td>\u6570\u5b57\u96e8 hero\uff0cAI\/\u6df1\u79d1\u6280\u843d\u5730\u9875<\/td><\/tr><tr><td>2-color-room<\/td><td>31 KB<\/td><td>\u6700\u5c0f\u7684\u4e00\u5957<\/td><\/tr><tr><td>3-flow-shader<\/td><td>89 KB<\/td><td>\u6d41\u4f53 shader<\/td><\/tr><tr><td>4-sunset-trip<\/td><td>88 KB<\/td><td>\u65c5\u884c<\/td><\/tr><tr><td>5-dream-run<\/td><td>87 KB<\/td><td>\u5954\u8dd1\u52a8\u6548<\/td><\/tr><tr><td>6-ascii-moon<\/td><td>87 KB<\/td><td>ASCII \u827a\u672f<\/td><\/tr><tr><td>7-vortex-gallery<\/td><td>84 KB<\/td><td>\u753b\u5eca<\/td><\/tr><tr><td>8-liquit-paint<\/td><td>88 KB<\/td><td>\u6db2\u6001\u989c\u6599\uff08info.md \u6700\u957f\uff0c15.5 KB\uff09<\/td><\/tr><tr><td>9-moon-note-fullstack<\/td><td>167 KB<\/td><td>wiki \u53cc\u94fe\u7b14\u8bb0 + D3 \u77e5\u8bc6\u56fe\u8c31 + \u6708\u76f8 widget<\/td><\/tr><tr><td>10-calm-space-fullstack<\/td><td>122 KB<\/td><td>CHRONOS \u8ba1\u65f6\u5668 + WebGL \u7c92\u5b50\u7403<\/td><\/tr><tr><td>11-my-blog-fullstack<\/td><td>1.2 MB<\/td><td>\u53cc\u8bed\u535a\u5ba2 NEURAL ATELIER\uff08\u542b admin \u5199\u4f5c\u6d41\uff09<\/td><\/tr><tr><td>12-seaside-stay-fullstack<\/td><td><strong>14.4 MB<\/strong><\/td><td>\u6d77\u666f\u9152\u5e97 LUNAMARE\uff08\u89c6\u9891 hero\uff0c\u4f53\u79ef\u5927\u6237\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">info.md \u7684\u7edf\u4e00\u5957\u8def\uff08\u8fd9\u662f&#8221;\u6a21\u677f\u8bf4\u660e\u4e66\u9a71\u52a8 agent&#8221;\u7684\u8303\u5f0f\uff09\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>frontend \u6a21\u677f<\/strong>\uff081-8 \u53f7\uff09\uff1a\u7ea6\u5b9a <strong>\u6240\u6709\u53ef\u7f16\u8f91\u5185\u5bb9\u96c6\u4e2d\u5728 <code>src\/config.ts<\/code>\uff0c\u7981\u6b62\u6539\u7ec4\u4ef6\u6587\u4ef6<\/strong>\uff1binfo.md \u9010\u4e2a config \u5bf9\u8c61\u7ed9\u51fa\u5b57\u6bb5\u8bf4\u660e + <strong>\u5b57\u7b26\u6570\u7ea6\u675f<\/strong>\uff08\u5982 hero \u6807\u9898 \u226420 \u5b57\u7b26\u3001nav CTA \u226415 \u5b57\u7b26\u2014\u2014\u6309\u6e32\u67d3\u5bbd\u5ea6\u63a8\u7b97\uff09\uff1b\u5f00\u5934\u7edf\u4e00\u4e24\u6bb5&#8221;Language\/Content&#8221;\u6307\u4ee4\uff08\u7f51\u7ad9\u8bed\u8a00\u8ddf\u968f\u7528\u6237\u67e5\u8be2\u8bed\u8a00\uff0c\u5185\u5bb9\u5339\u914d\u7528\u6237\u610f\u56fe\uff09\u3002<\/li><li><strong>fullstack \u6a21\u677f<\/strong>\uff089-12 \u53f7\uff09\uff1a\u5f00\u5934\u7ea2\u5b57\u8b66\u544a &#8220;\u26a0 FULLSTACK \u2014 READ FIRST: You MUST use the <code>backend-building<\/code> skill&#8221;\uff0c\u5e76\u7ed9\u51fa\u5f3a\u5236\u6d41\u6c34\u7ebf &#8220;webapp-building \u51fa\u6a21\u677f \u2192 <code>backend-building --template<\/code> \u4f9b\u5e94 \u2192 \u6539\u5185\u5bb9&#8221;\uff1bzip \u5185\u81ea\u5e26 <code>api\/ db\/ contracts\/ Dockerfile .backend-features.json .env.example<\/code>\uff0cmanifest \u58f0\u660e <code>[\"auth\",\"db\"]<\/code> \u4f9b init.sh &#8211;template \u6a21\u5f0f\u6d88\u8d39\uff1b\u5185\u5bb9\u7f16\u8f91\u70b9\u662f<strong>\u53cc\u5904<\/strong>\uff08<code>src\/config.ts<\/code> + <code>api\/notes-router.ts<\/code> \u7684 STARTER_NOTES\uff0c\u660e\u786e\u8981\u6c42\u4e24\u4e2a\u6570\u7ec4\u4fdd\u6301\u540c\u6b65\uff09\uff1b\u672a\u767b\u5f55\u7528\u6237\u8d70 localStorage \u964d\u7ea7 + \u9996\u767b\u81ea\u52a8 seed \u7684\u5b8c\u6574\u8bbe\u8ba1\u3002<\/li><li>\u5c0f\u77db\u76fe\u70b9\uff1afullstack info.md \u5199 &#8220;Then you must deploy the website&#8221;\uff0c\u4e0e webapp-building SKILL.md \u7684&#8221;agent \u4e0d\u80fd\u53d1\u5e03\u3001\u53ea\u6709\u4fdd\u5b58\u7248\u672c&#8221;\u5b58\u5728\u63aa\u8f9e\u51b2\u7a81\u2014\u2014\u5b9e\u9645\u542b\u4e49\u5e94\u662f&#8221;\u4fdd\u5b58 build_version \u5b8c\u6210\u4ea4\u4ed8&#8221;\uff0c\u4f46\u5bf9\u6a21\u578b\u662f\u4e2a\u6f5c\u5728\u7684\u6b67\u4e49\u6e90\u3002<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u53e6\u5916\u6ce8\u610f\u5230 webapp \u9ed8\u8ba4\u6a21\u677f\u7684 devDependencies \u91cc\u6709 <strong><code>kimi-plugin-inspect-react: ^1.0.3<\/code><\/strong>\u2014\u2014Kimi \u81ea\u5df1\u53d1\u7684 npm \u5305\uff08React \u5143\u7d20\u5ba1\u67e5\u5de5\u5177\uff09\uff0c\u662f\u9884\u89c8\u73af\u5883&#8221;\u70b9\u9009\u5143\u7d20\u5b9a\u4f4d\u6e90\u7801&#8221;\u80fd\u529b\u7684\u6784\u5efa\u671f\u94a9\u5b50\uff0c\u968f\u6a21\u677f\u8fdb\u5165\u6bcf\u4e2a\u4ea7\u7269\u5de5\u7a0b\u3002<\/p>\n\n\n\n<h2 id=\"4-%25e5%259d%2591%25e4%25b8%258e%25e4%25ba%25ae%25e7%2582%25b9%25e6%2580%25bb%25e7%25bb%2593\" class=\"wp-block-heading\">4. \u5751\u4e0e\u4eae\u70b9\u603b\u7ed3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4eae\u70b9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>\u5e42\u7b49\u53ef\u91cd\u5165<\/strong>\uff1amanifest + \u7279\u6027\u5dee\u96c6 + \u6bcf\u4e2a\u8865\u4e01\u5668\u81ea\u68c0\uff0c\u91cd\u590d\u6267\u884c\u5b89\u5168\uff1b<\/li><li><strong>\u6c38\u4e0d\u8986\u76d6\u7528\u6237\u4ee3\u7801<\/strong>\uff1asafe_copy + git wip \u5feb\u7167 + \u8df3\u8fc7\u6e05\u5355\uff1b<\/li><li><strong>\u951a\u70b9\u534f\u540c\u8bbe\u8ba1<\/strong>\uff1aping \u8def\u7531\u3001<code>\/\/ TODO:<\/code> \u6ce8\u91ca\u3001bodyLimit \u884c\u90fd\u662f\u9884\u7559\u6ce8\u5165\u70b9\uff1b<\/li><li><strong>\u964d\u7ea7\u800c\u975e\u5931\u8d25<\/strong>\uff1a\u8865\u4e01\u5931\u8d25 \u2192 \u5168\u91cf\u66ff\u6362\u6216\u4eba\u5de5 TODO \u6e05\u5355\uff1b<\/li><li><strong>\u51ed\u8bc1\u96f6\u786c\u7f16\u7801<\/strong>\uff1aportal \u52a8\u6001\u4e0b\u53d1\uff0c.env \u751f\u6210\u540e\u51bb\u7ed3\uff1b<\/li><li><strong>Product Knowledge \u9632\u5e7b\u89c9<\/strong>\uff1a\u628a&#8221;\u9884\u89c8\u2260\u53d1\u5e03&#8221;&#8221;\u5bfc\u51fa\u4e0d\u5e26\u767b\u5f55&#8221;\u7b49\u4ea7\u54c1\u4e8b\u5b9e\u5199\u8fdb\u6280\u80fd\uff0c\u76f4\u63a5\u780d\u65ad\u4e00\u7c7b\u7528\u6237\u6295\u8bc9\u3002<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u5751 \/ \u98ce\u9669\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u6b63\u5219\u8865\u4e01\u5bf9<strong>\u7528\u6237\u5927\u6539\u8fc7\u7684\u6587\u4ef6<\/strong>\u4f1a\u5931\u914d\uff08wire-*.mjs \u76f4\u63a5 exit 1 \u9760\u4eba\u5de5\uff09\uff1b\u524d\u7aef\u82e5\u6362\u4e86 router \u5e93\u6216 main.tsx \u7ed3\u6784\uff0c\u63a5\u7ebf\u5168\u5e9f\uff1b<\/li><li><code>merge-tsconfig.mjs<\/code> \u7684 JSONC \u6e05\u6d17\u5f88\u7cd9\uff08\u53ea\u8ba4\u884c\u9996 <code>\/\/<\/code>\u3001\u5355\u884c <code>\/<em> <\/em>\/<\/code>\uff09\uff0c\u590d\u6742\u6ce8\u91ca\u4f1a\u70b8\uff1b<\/li><li>\u4f1a\u8bdd JWT \u6709\u6548\u671f 1 \u5e74\u3001\u65e0\u5237\u65b0\u673a\u5236\uff08<code>refresh_token<\/code> \u5728 TokenResponse \u91cc\u4f46\u4ee3\u7801\u6ca1\u7528\uff09\uff1b<\/li><li><code>state<\/code> \u53ea\u662f base64 \u7684 redirectUri\uff0c<strong>\u65e0 CSRF \u6821\u9a8c<\/strong>\uff08state \u4e0d\u9a8c\u968f\u673a\u6027\uff09\uff0c\u9760 cookie SameSite \u515c\u5e95\uff1b<\/li><li>auth \u7279\u6027\u4f9d\u8d56 portal + Kimi OAuth + MySQL \u4e09\u4ef6\u5957\u540c\u65f6\u53ef\u7528\uff0c\u4efb\u4e00\u7f3a\u5931\u7279\u6027\u5373\u6b8b\uff1b<\/li><li>node_modules \u8986\u76d6\u590d\u5236\uff0885 \u5305\uff09\u540e <code>npm install --prefer-offline<\/code> \u8865\u7f3a\u2014\u2014\u6c99\u7bb1\u65e0\u5916\u7f51\u65f6\u975e\u9ed8\u8ba4\u6a21\u677f\u7684\u589e\u91cf install \u4f1a\u5931\u8d25\u3002<\/li><\/ol>\n\n\n\n<h2 id=\"5-%25e7%25a7%25bb%25e6%25a4%258d%25e8%25af%2584%25e4%25bc%25b0\" class=\"wp-block-heading\">5. \u79fb\u690d\u8bc4\u4f30<\/h2>\n\n\n\n<h3 id=\"51-%25e7%25a7%25bb%25e6%25a4%258d%25e8%25af%2584%25e4%25bc%25b0%25e8%25a1%25a8\" class=\"wp-block-heading\">5.1 \u79fb\u690d\u8bc4\u4f30\u8868<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u7ec4\u4ef6<\/th><th>\u5bf9 Hermes \u4ef7\u503c<\/th><th>\u5bf9 Kimi Code \u4ef7\u503c<\/th><th>\u79fb\u690d\u5de5\u4f5c\u91cf<\/th><th>\u786c\u4f9d\u8d56<\/th><\/tr><\/thead><tbody><tr><td>webapp-building init-webapp.sh\uff08\u89e3 zip+\u590d\u5236\u9884\u88c5 node_modules+git \u57fa\u7ebf\uff09<\/td><td>\u4e2d\u2014\u2014Hermes \u65e0\u5185\u7f6e\u7f51\u7ad9\u5236\u54c1\u94fe\uff0c\u4f46&#8221;\u9884\u88c5 node_modules \u51b7\u542f\u52a8&#8221;\u6a21\u5f0f\u53ef\u76f4\u63a5\u501f\u7ed9\u4efb\u4f55\u811a\u624b\u67b6\u6280\u80fd<\/td><td>\u9ad8\u2014\u2014Kimi Code \u672c\u5730\u6709 node\/npm\uff0c\u811a\u672c\u51e0\u4e4e\u53ef\u76f4\u63a5\u8dd1\uff1b\u6539 PROJECT_PATH \u9ed8\u8ba4\u503c\u5373\u53ef<\/td><td>\u9700\u9002\u914d\uff08\u53bb portal \u6ce8\u518c\u3001\u6a21\u677f\u6e90\u6539\u672c\u5730\u76ee\u5f55\uff09<\/td><td>node\/npm\/unzip\/git\uff1b\u6a21\u677f zip \u6e90<\/td><\/tr><tr><td>13 \u5957\u6a21\u677f zip + info.md\uff08portal \u4e0b\u53d1\uff09<\/td><td>\u4e2d\u2014\u2014\u524d\u7aef\u6a21\u677f\u672c\u8eab\u4e0e Kimi \u4e91\u65e0\u5173\uff08React+Vite\uff09\uff0c\u53ef\u76f4\u63a5\u79bb\u7ebf\u6253\u5305\u590d\u7528<\/td><td>\u9ad8\u2014\u2014\u540c\u4e0a\uff0c\u653e user\/plugin scope \u5373\u53ef<\/td><td>\u7eaf\u62f7\u8d1d\uff08zip \u65e0\u9700\u6539\u9020\uff09<\/td><td>\u65e0\uff08fullstack \u6a21\u677f\u9664\u5916\uff09<\/td><\/tr><tr><td>4 \u5957 fullstack \u6a21\u677f\uff089-12 \u53f7\uff09<\/td><td>\u4f4e\u2014\u2014\u4f9d\u8d56 portal \u4f9b\u5e94 + Kimi OAuth<\/td><td>\u4e2d\u2014\u2014\u9aa8\u67b6\u53ef\u590d\u7528\uff0c\u9700\u66ff\u6362\u4f9b\u5e94\u5c42<\/td><td>\u9700\u91cd\u5199\uff08\u66ff\u6362 portal \u6ce8\u518c\u4e0e .env \u751f\u6210\uff09<\/td><td>portal API\u3001Kimi OAuth\u3001MySQL<\/td><\/tr><tr><td>backend-building init.sh graft \u673a\u5236\uff08manifest\/\u7279\u6027\u5dee\u96c6\/safe_copy\/git \u5feb\u7167\uff09<\/td><td>\u9ad8\u2014\u2014\u8fd9\u5957&#8221;\u589e\u91cf graft \u800c\u975e\u91cd\u5efa&#8221;\u8303\u5f0f\u53ef\u76f4\u63a5\u642c\u8fdb Hermes \u7684\u6280\u80fd\u5de5\u7a0b\u5b9e\u8df5<\/td><td>\u9ad8\u2014\u2014\u673a\u5236\u672c\u8eab\u4e0e\u6808\u65e0\u5173<\/td><td>\u9700\u9002\u914d\uff08portal \u8c03\u7528\u66ff\u6362\uff09<\/td><td>git\u3001node<\/td><\/tr><tr><td>9 \u4e2a .mjs \u7ed3\u6784\u5316\u5408\u5e76\u5668<\/td><td>\u4e2d\u2014\u2014\u6b63\u5219\u8865\u4e01\u601d\u8def\u901a\u7528\uff0c\u4f46\u951a\u70b9\u5f3a\u8026\u5408\u6a21\u677f\u6587\u4ef6<\/td><td>\u9ad8\u2014\u2014\u8fde\u540c\u6a21\u677f\u4e00\u8d77\u642c\u5373\u53ef\u5de5\u4f5c<\/td><td>\u7eaf\u62f7\u8d1d\uff08\u968f\u6a21\u677f\uff09<\/td><td>node<\/td><\/tr><tr><td>base\/db \u6a21\u677f\u5c42\uff08Hono+tRPC+Drizzle+MySQL\uff09<\/td><td>\u4e2d\u2014\u2014Hermes \u7528\u6237\u672a\u5fc5\u7528\u8fd9\u5957\u6808\uff1b\u4f5c\u4e3a&#8221;\u5168\u6808\u811a\u624b\u67b6&#8221;\u53c2\u8003\u5b9e\u73b0\u6709\u4ef7\u503c<\/td><td>\u9ad8\u2014\u2014\u672c\u5730\u8d77 MySQL\/SQLite \u6362 dialect \u5373\u53ef\u7528<\/td><td>\u9700\u9002\u914d\uff08\u6570\u636e\u5e93\u8fde\u63a5\u6539\u672c\u5730\uff09<\/td><td>MySQL\uff08\u53ef\u6362 SQLite\uff09<\/td><\/tr><tr><td>auth \u6a21\u677f\u5c42\uff08Kimi OAuth + JWKS + \u4f1a\u8bdd JWT\uff09<\/td><td>\u4f4e\u2014\u2014\u5f3a\u8026\u5408 auth.kimi.com\/open.kimi.com \u56db\u7aef\u70b9\uff0cHermes \u81ea\u6258\u7ba1\u573a\u666f\u65e0\u6b64\u670d\u52a1<\/td><td>\u4f4e\u2014\u2014\u540c\u4e0a\uff1b\u9664\u975e\u76ee\u6807\u662f&#8221;\u7ed9 Kimi \u751f\u6001\u5efa\u7ad9&#8221;<\/td><td>\u9700\u91cd\u5199\uff08\u6362\u4efb\u610f OIDC provider \u7684\u5de5\u4f5c\u91cf\uff09<\/td><td>Kimi OAuth \u4e91\u670d\u52a1\uff08\u4e0d\u53ef\u66ff\u4ee3\u90e8\u5206\uff09<\/td><\/tr><tr><td>portal <code>POST \/api\/v1\/apps<\/code> \u51ed\u8bc1\u4e0b\u53d1<\/td><td>\u4f4e\u2014\u2014Hermes \u65e0 portal\uff1b\u9700\u81ea\u5efa\u7b49\u6548\u7269\uff08\u672c\u5730\u5bc6\u94a5\u7ba1\u7406\/<code>.env<\/code> \u5411\u5bfc\uff09<\/td><td>\u4f4e\u2014\u2014\u540c\u4e0a<\/td><td>\u9700\u91cd\u5199<\/td><td>portal \u6c99\u7bb1\u670d\u52a1\uff08\u95ed\u6e90\uff09<\/td><\/tr><tr><td>Product Knowledge \u9632\u5e7b\u89c9\u6bb5\uff08\u9884\u89c8\u2260\u53d1\u5e03\u3001\u5e73\u53f0\u8fb9\u754c\uff09<\/td><td>\u9ad8\u2014\u2014<strong>\u8303\u5f0f\u7ea7<\/strong>\u4ef7\u503c\uff1a\u628a\u4ea7\u54c1\u4e8b\u5b9e\u5199\u8fdb\u6280\u80fd\u9632\u6a21\u578b\u5e7b\u89c9\uff0c\u4efb\u4f55\u5e73\u53f0\u90fd\u8be5\u6284<\/td><td>\u9ad8\u2014\u2014\u540c\u4e0a<\/td><td>\u7eaf\u62f7\u8d1d\uff08\u6539\u5199\u6210\u81ea\u5df1\u4ea7\u54c1\u7684\u4e8b\u5b9e\uff09<\/td><td>\u65e0<\/td><\/tr><tr><td>docs\/ \u516d\u7bc7\u5fc5\u8bfb\u6587\u6863 + Common Mistakes \u6761\u6b3e<\/td><td>\u4e2d\u2014\u2014\u6761\u6b3e\u672c\u8eab\u8026\u5408\u6808\uff0c\u4f46&#8221;\u6545\u969c\u7ecf\u9a8c\u56fa\u5316\u8fdb\u63d0\u793a\u8bcd&#8221;\u7684\u505a\u6cd5\u901a\u7528<\/td><td>\u9ad8<\/td><td>\u9700\u9002\u914d<\/td><td>\u65e0<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 id=\"52-%25e6%2580%25bb%25e4%25bd%2593%25e5%2588%25a4%25e6%2596%25ad\" class=\"wp-block-heading\">5.2 \u603b\u4f53\u5224\u65ad<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u53ef\u76f4\u63a5\u5e26\u8d70\u7684<\/strong>\uff08\u7eaf\u62f7\u8d1d\/\u8f7b\u9002\u914d\uff09\uff1a13 \u5957\u524d\u7aef\u6a21\u677f\u30019 \u4e2a\u5408\u5e76\u5668\u3001init \u811a\u672c\u9aa8\u67b6\u3001Product Knowledge \u5199\u6cd5\u3001\u9a8c\u6536\u95e8\u69db\u8bbe\u8ba1\uff08<code>npm run check<\/code> \u96f6\u9519\u8bef + \u7aef\u53e3\u56fa\u5b9a\uff09\u3002<\/li><li><strong>\u5e26\u4e0d\u8d70\u7684<\/strong>\uff1aportal \u51ed\u8bc1\u4e0b\u53d1\u3001Kimi OAuth \u56db\u7aef\u70b9\u3001<code>&lt;name&gt;.ok.kimi.link<\/code> \u6258\u7ba1\u2014\u2014\u8fd9\u4e09\u8005\u662f Kimi \u4e91\u7684\u95ed\u73af\uff0c\u79bb\u5f00\u4e86\u6574\u5957 auth\/fullstack \u7279\u6027\u8981\u6362\u4f9b\u5e94\u5c42\uff08\u4efb\u4f55 OIDC + \u672c\u5730 DB + \u81ea\u7ba1\u5bc6\u94a5\uff09\u3002<\/li><li><strong>\u5bf9 Hermes \u6700\u6709\u4ef7\u503c\u7684\u662f\u8303\u5f0f\u800c\u975e\u4ee3\u7801<\/strong>\uff1agraft \u589e\u91cf\u5408\u5e76\u3001manifest \u8bb0\u8d26\u3001safe_copy \u6c38\u4e0d\u8986\u76d6\u3001git \u5feb\u7167\u515c\u5e95\u3001\u9632\u5e7b\u89c9\u4ea7\u54c1\u77e5\u8bc6\u6bb5\u2014\u2014\u8fd9\u4e9b\u53ef\u4ee5\u76f4\u63a5\u5199\u8fdb Hermes \u7684\u6280\u80fd\u5f00\u53d1\u89c4\u8303\u3002<\/li><li><strong>\u5bf9 Kimi Code \u6700\u6709\u4ef7\u503c\u7684\u662f\u6574\u5957\u811a\u624b\u67b6<\/strong>\uff1aKimi Code \u672c\u5730\u5177\u5907 node\/npm\/git\uff0cwebapp-building \u53bb\u6389 portal \u6ce8\u518c\u3001\u6a21\u677f\u6e90\u6539\u4e3a plugin \u5185\u7f6e\u76ee\u5f55\u540e\uff0c\u53ef\u4f5c\u4e3a user-scope \u6280\u80fd\u76f4\u63a5\u843d\u5730\uff1bbackend-building \u628a portal \u6ce8\u518c\u6362\u6210&#8221;\u4ea4\u4e92\u5f0f\u586b .env \/ \u672c\u5730\u5bc6\u94a5\u94fe&#8221;\uff0cdb \u5c42\u6362 SQLite\uff08drizzle \u652f\u6301\uff09\u5373\u53ef\u8131\u79bb Kimi \u4e91\u3002<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u2190 \u8fd4\u56de\u4e3b\u62a5\u544a\uff1aKimi Agent\uff08\u4e91\u7aef\u6c99\u7bb1\uff09\u6280\u672f\u62a5\u544a \uff5c GitHub \u539f\u6587 \u5408\u89c4\u4e0e\u98ce\u9669\u58f0\u660e\uff1a\u672c\u62a5\u544a\u4e3a\u5b89\u5168 &hellip; <a href=\"https:\/\/tongchun.website\/index.php\/kimiagent-16-website\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c16 \u00b7 \u660e\u661f\u6280\u80fd\u3010\u7f51\u7ad9\u3011\uff1awebapp-building + backend-building + .websites-templates \u6df1\u62c6\u201d<\/span><\/a><\/p>\n","protected":false},"author":55404,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"wpai_generated_summary":"","wpai_meta_description":"","footnotes":""},"class_list":["post-1882","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/pages\/1882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/users\/55404"}],"replies":[{"embeddable":true,"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/comments?post=1882"}],"version-history":[{"count":1,"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/pages\/1882\/revisions"}],"predecessor-version":[{"id":1902,"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/pages\/1882\/revisions\/1902"}],"wp:attachment":[{"href":"https:\/\/tongchun.website\/index.php\/wp-json\/wp\/v2\/media?parent=1882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}