WHAT YOU'LL LEARN
- How local development works in Webiny - Using watch commands for Admin and API - Understanding Local AWS Lambda Development

Overview
anchor

Webiny provides a streamlined local development experience through watch commands. You can develop both Admin UI and API extensions locally while connected to your deployed AWS infrastructure. This hybrid approach gives you fast iteration with a realistic environment.

Prerequisites
anchor

Before starting local development:

  1. Deploy Core and API applications:
  1. Verify deployment succeeded:

The Admin application deployment is optional unless you need to share URLs or test in production conditions.

Admin Development
anchor

Starting the Dev Server
anchor

This command:

  • Starts development server on http://localhost:3001
  • Enables hot module replacement
  • Watches for changes in Admin extensions
  • Provides instant feedback on changes

What You Can Develop
anchor

  • UI Extensions - Custom React components and pages
  • Themes - Branding and styling customizations
  • Navigation - Custom menu items and structure
  • Integrations - Third-party service connections

Development Workflow
anchor

  1. Start watch command
  2. Make changes to files in extensions/admin/
  3. See changes instantly in browser
  4. No deployment needed during development

API Development
anchor

Local AWS Lambda Development
anchor

API development uses a unique approach that runs Lambda code locally while connected to cloud services:

How It Works
anchor

  1. Lambda Stubs Deployed - Cloud Lambda functions replaced with forwarding stubs
  2. Event Forwarding - AWS requests forwarded to your local machine
  3. Local Execution - Code runs locally with full Lambda context
  4. Response Routing - Results sent back through Lambda stub

What You Can Develop
anchor

  • GraphQL Schemas - Custom types and fields
  • Resolvers - Business logic and data fetching
  • Event Handlers - Lifecycle hooks and reactions
  • Custom Endpoints - REST APIs or webhooks
  • Background Tasks - Async processing logic

Important Considerations
anchor

Redeploy After Watch
When you stop the watch command, Lambda functions still contain stub code. You must redeploy to restore actual Lambda code:

The watch command will remind you when you stop it.

Infrastructure Development
anchor

Infrastructure changes require deployment and cannot be tested with watch commands:

webiny.config.tsx

To apply infrastructure changes:

Environment Variables
anchor

Application-Specific Variables
anchor

Use prefixes to target specific applications:

.env

Prefixes:

  • WEBINY_ADMIN_ - Available only in Admin app
  • WEBINY_API_ - Available only in API app

Best Practices
anchor

  • .env files are optional for most development
  • Don’t commit .env to version control
  • Create .env.example for team reference
  • Document required variables

Development Workflow
anchor

Initial Setup
anchor

For new team members:

Daily Development
anchor

  1. Start watch command for the app you’re working on
  2. Make changes in extensions/ folder
  3. Test locally with immediate feedback
  4. Deploy when ready to share or update infrastructure

Concurrent Development
anchor

Run multiple watch commands in separate terminals:

TypeScript and Build Validation
anchor

Webiny enforces TypeScript checking:

  • IDE Support - Real-time type errors
  • Build Validation - Compilation fails on type errors
  • Deployment Safety - Errors caught before production

Performance Tips
anchor

Admin Development
anchor

  • Use React Developer Tools for profiling
  • Leverage hot module replacement
  • Keep browser console open for errors

API Development
anchor

  • Monitor Lambda execution time locally
  • Use console.log for debugging (appears in terminal)
  • Test with realistic data volumes

Watch Command Performance
anchor

  • Initial startup may take 30-60 seconds
  • Subsequent changes reflect in 2-5 seconds
  • Kill and restart if watch becomes unresponsive

Troubleshooting
anchor

Common Issues
anchor

Watch command not detecting changes:

  • Check file paths in extensions folder
  • Ensure proper file extensions (.ts, .tsx)
  • Restart watch command

Lambda stub errors:

  • Verify API was deployed before watch
  • Check AWS credentials are valid
  • Ensure no network/firewall issues

Type errors in IDE but not build:

  • Run yarn to update dependencies
  • Restart TypeScript service in IDE
  • Check tsconfig.json includes your files

Debug Mode
anchor

Enable verbose logging:

Next Steps
anchor

With local development running: