webiny-local-development
它能做什么
讲解如何将 Webiny 项目部署到 AWS,在自己的电脑上运行其 API 或管理后台,并管理多个独立环境。适用于构建和测试 Webiny 项目的开发者。
适用场景
- ✓开发者询问如何部署整个 Webiny 项目或只部署其中一部分的时候。
- ✓开发者想用开发服务器在本地运行管理后台的时候。
- ✓开发者开发时需要调试 API 或管理后台的时候。
技能链接
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/local-development/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我要用什么命令在电脑上启动 Webiny 管理后台,以便测试更改?”
每周 5 个新技能,1 分钟读完。
工作原理
该技能提供部署命令和监视模式的命令。监视模式会在你工作时在本地运行应用。它还讲解如何选择正确的环境,例如 dev 或 prod。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Local Development and Deployment
TL;DR
Webiny is a serverless platform on AWS. Deploy with yarn webiny deploy, develop locally with yarn webiny watch (API uses Local Lambda Development, Admin runs a local React dev server). Projects support multiple environments (long-lived and short-lived). Always redeploy after stopping watch mode.
Deployment
Initial Deployment
Deploy all three applications (Core, API, Admin) at once:
yarn webiny deploy
This deploys to the dev environment by default. First deployment takes 5-15 minutes.
Deploying Individual Applications
yarn webiny deploy core # Infrastructure only
yarn webiny deploy api # Backend API only
yarn webiny deploy admin # Admin frontend only
Deploy to a Specific Environment
yarn webiny deploy --env prod
yarn webiny deploy api --env staging
Get Deployment Info
yarn webiny info # Shows all URLs (Admin, API, CloudFront)
yarn webiny info --env prod # Info for a specific environment
Local Development
Before developing locally, you must deploy Core and API first:
yarn webiny deploy core api
Admin Development
yarn webiny watch admin
- Starts a local dev server at
http://localhost:3001 - Hot module replacement for instant feedback
- Standard React development experience
- Use for: custom Admin UI extensions, white-label branding, custom views
API Development (Local Lambda Development)
yarn webiny watch api
How it works:
- Lambda stubs deployed -- real Lambda functions are replaced with stubs that forward events
- Events forwarded -- requests to AWS get forwarded to your local machine
- Local execution -- your code runs locally with full AWS Lambda environment
- Response routing -- responses sent back through the Lambda stub
Benefits:
- See backend code changes instantly (no redeployment)
- Debug locally with standard Node.js tools
- Console logs appear directly in your terminal
IMPORTANT: Redeploy After Watch
When you stop yarn webiny watch api, your Lambda functions still contain stub code. You must redeploy:
yarn webiny deploy api
The watch command prints a reminder when you stop it.
Running Both
You can run both watch commands simultaneously in separate terminals:
# Terminal 1
yarn webiny watch api
# Terminal 2
yarn webiny watch admin
Environments
Long-Lived Environments
Persistent environments maintained over time:
- dev -- daily development
- staging -- pre-production testing
- prod -- production
Best practice: manage via CI/CD pipelines.
Short-Lived Environments
Temporary environments for specific purposes:
- Feature branch testing
- PR previews
- Experimentation
# Create a short-lived environment
yarn webiny deploy --env feature-123
# Destroy when done
yarn webiny destroy --env feature-123
Deployment Modes
Webiny has two deployment templates:
- dev -- smaller, cheaper infrastructure for development
- prod -- production-grade infrastructure with HA, backups, auto-scaling
The mode is determined by whether the environment name is in the ProductionEnvironments list:
// webiny.config.tsx
<Infra.ProductionEnvironments environments={["prod", "staging"]} />
State Files
State files are JSON files that track the current state of your deployment:
- Store infrastructure resource info, configurations, and metadata
- Essential for managing environments and tracking changes
- Stored in S3 by default
Debugging
API Errors
During yarn webiny watch api:
- Console logs appear directly in the terminal
- Use
console.log()for quick debugging - Use
Logger(DI-injected) for production logging to CloudWatch
import { Logger } from "webiny/api";
// In your extension class
this.logger.info("Processing request...");
this.logger.warn("Something unexpected");
this.logger.error("Something failed");
Admin Errors
Use browser DevTools:
- Console -- view logs and errors
- Network tab -- inspect GraphQL requests/responses
- React Developer Tools -- debug component state/props
- GraphQL Network Inspector -- inspect GraphQL operations
Infrastructure Errors
Deployment errors from Pulumi typically relate to:
- IAM permission issues
- AWS service quotas
- Resource configuration problems
Check the deployment output
常见问题
部署默认使用哪个环境?
除非你用环境选项指定其他环境,否则使用 dev 环境。
在本地运行之前需要先部署吗?
需要。该技能说明,在本地开发前应先部署 core 和 API 部分。
停止监视模式后需要重新部署吗?
需要。该技能建议在停止监视模式后重新部署。
详情
作者的原始描述
Deploying, developing locally, managing environments, and debugging Webiny projects. Use this skill when the developer asks about deployment commands (deploy, destroy, info), local development with watch mode (API or Admin), the Local Lambda Development system, environment management (long-lived vs short-lived, production vs dev modes), build parameters, state files, debugging API/Admin/Infrastructure errors, or the redeploy-after-watch requirement.
repo: webiny/webiny-js
热度
- GitHub 星标
- 8.1k
- 排名
- #12614
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
prd-to-plan
8.1k帮你的智能体把产品需求文档转化为分阶段的计划,由许多小的端到端切片组成,并保存为 Markdown 文件。
webiny-admin-architect
8.1k教你的智能体如何为 Webiny 平台构建管理界面,使用其业务逻辑层和呈现器模式。
webiny-admin-permissions
8.1k教你的智能体为 Webiny 管理界面添加权限控制,包括自动生成的权限表单以及显示或隐藏检查。
webiny-form-model
8.1k教你的智能体使用声明式字段构建器、布局、校验和条件规则,在 Webiny 中构建表单。