Project Configuration
The project usessfdx-project.json to define package metadata:
- Source API Version: 65.0 (Winter ‘26)
- Package Directory:
force-app/contains all source code - No Namespace: Components use the default namespace
Deployment Options
Option 1: Scratch Org (Recommended for Developers)
Scratch orgs provide temporary, configurable Salesforce environments ideal for development and testing.Set up your environment
Follow the Quick Start: Lightning Web Components Trailhead project to:
- Enable Dev Hub in your Trailhead Playground
- Install Salesforce CLI
- Install Visual Studio Code with Salesforce extensions
Authorize your Dev Hub
-d to set this as the default Dev Hub.Create a scratch org
- Developer Edition features
- Lightning Experience enabled
- Walkthroughs and user engagement features
Assign the permission set
recipes permission set grants access to custom objects and Apex classes.Scratch Org Configuration
Theconfig/project-scratch-def.json file defines the scratch org:
Option 2: Unlocked Package
Unlocked packages allow anyone to install LWC Recipes without local development tools.Log in to your org
Use a Developer Edition Org or Trailhead Playground.
Install the package
Click this link to install the latest version:Install LWC Recipes PackageSelect Install for All Users when prompted.
Import sample data
- Download the Accounts-Contacts.csv file
- In Setup, search for Data Import Wizard
- Click Launch Wizard
- Select Accounts and Contacts > Add New Records
- Upload the CSV file and click Start Import
Assign permission set (if needed)
For Trailhead projects:
- Go to Setup > Users > Permission Sets
- Click recipes
- Click Manage Assignments
- Add your user
Option 3: Developer Edition or Trailhead Playground
Deploy source code directly to a persistent org for long-term testing.Deploy the metadata
force-app/ directory.Deployment to Production
For production deployments, follow Salesforce best practices:Production Deployment Checklist
- All unit tests passing with adequate coverage
- Code reviewed and approved
- Change set or deployment validated in sandbox
- Deployment scheduled during maintenance window
- Rollback plan documented
- Permission sets assigned to appropriate users
- Custom themes activated if needed
- Sample data imported or production data prepared
Continuous Integration/Continuous Deployment
The project includes GitHub Actions workflows for automated deployment:CI Workflow
The.github/workflows/ci.yml workflow runs on every push to main:
- Format and Lint: Verifies code formatting with Prettier
- Code Analysis: Runs Salesforce Code Analyzer
- Unit Tests: Executes all LWC Jest tests with coverage
- Scratch Org Testing: Deploys to a scratch org and runs Apex tests
- Package Trigger: Triggers packaging workflow if source changed
Packaging Workflow
The packaging workflow creates new unlocked package versions:- Creates a new package version
- Installs the package in a scratch org
- Runs all tests to validate the package
- Promotes the package version if tests pass
Troubleshooting Deployment Issues
Deployment Fails Due to Missing Dependencies
Ensure all required features are enabled in the target org:- Lightning Experience
- My Domain (required for LWC)
- Guest User settings (if using Experience Cloud)
Permission Set Assignment Fails
Verify the user has the necessary permissions to receive the assignment:Sample Data Import Fails
Check that required custom objects exist before importing:Components Not Visible in App
Ensure:- The Lightning app is assigned to the user’s profile
- The theme is activated
- The user has the
recipespermission set
Environment Variables
For CI/CD pipelines, configure these environment variables:DEVHUB_SFDX_URL: Dev Hub authentication URLCODECOV_TOKEN: Token for uploading code coverageBOT_ACCESS_TOKEN: GitHub token for triggering workflows
