Suivez votre progression
Accueil Trailhead
Accueil Trailhead

Get to Know the Sample Gallery

Learning Objectives

In this project, you’ll:

  • Get to know the sample gallery.
  • Learn why we built it.
  • Walk through the common sample apps tools.

For developers, looking at someone else's code is a tried-and-true method of learning how to make something work. The Trailhead sample gallery meets this need by providing a set of sample apps that include code examples on a variety of developer platform features. We built the sample apps to help you, our Salesforce developers, ramp up on the latest and greatest technology. 

By far the easiest way to find anything on the internet is by searching. The sample gallery is no different. Here’s how to search for the sample gallery. 

  1. Open your preferred browser.
  2. Go to www.google.com.
  3. Search for the terms: trailhead sample gallery
  4. Click the result Sample Gallery - Trailhead - Salesforce.

Google search results for Trailhead sample gallery.

If you don’t see it, the sample gallery is also prominently shown in the Salesforce developer portal. 

  1. Navigate to developer.salesforce.com.
  2. From the Learn menu, select Sample Gallery.

Sample gallery link on the developer site.

Awesome! You've now found the Trailhead sample gallery. Let's check it out. 

Note

Note

Our developer websites and sample apps are in constant development. Please note that some pictures or details (like version numbers) may be slightly different from how they are represented in this project. This will have no bearing on your ability to complete the project.

Sample gallery landing page.

The first thing you notice about the sample gallery is that it lives in Trailhead. This is because several of the sample apps feature prominently in Trailhead modules and projects. In some cases, the apps were created specifically to support Trailhead content. In others, we created the apps and they were adopted by Trailhead content writers as common use cases. Let’s get to know them better.

  1. Scroll through the sample gallery.
  2. Notice every app tile has a description and a list of features associated with it.
  3. Find the LWC Recipes app and take a moment to read the description and features on its tile.
  4. Now find the app called E-Bikes and read its description and features.

You can see that some of these apps simulate a customer use case. Others show code examples without a use case to demonstrate how certain APIs or developer features work. 

Use case apps: Use case apps are each built around a mock customer use case. They tend to focus on some subset of the Salesforce Platform developer features that a person wants to learn. Some of these include Communities, Mobile SDK, and dependency management with unlocked packages. If you look through all the apps, you can find more. 

The use case apps include E-Bikes, DreamHouse, Easy Spaces, Redwoods Insurance, and a few others. 

Two use case app tiles, E-Bikes and DreamHouse.

Code example apps: These apps show how to solve coding problems, but don't necessarily try to tell a customer story. 

Some apps use a style we call recipes. We build each recipe to solve one specific problem by distilling it down to the simplest code required to solve it. Each code artifact (such as JS file or Apex method) is named in such a way that it identifies what kind of problem that bit of code solves. For instance, in the LWC Recipes app, you'll find a Lightning web component called wireGetRecordStaticContact that uses a wire adapter to get a contact record using static field names. Besides LWC Recipes, there is also the LWC Recipes Open Source app. 

Recipes sample app tile.

We’ve also recently introduced a code pattern app called Visualforce to LWC. This app takes certain design patterns that were used in Visualforce and provides the corresponding LWC pattern to solve that problem. 

But if this is a sample app for developers, where’s the code? Let’s go find it! 

Sample App Code Repositories

The sample gallery is a directory of all of our sample apps. It makes it easy for people to see all the sample apps, and then go to the code for the sample app that interests them. But every app is actually a repository on GitHub with instructions to install the app in a Salesforce org. 

  1. Scroll to the LWC Recipes app tile.
  2. Click the View on GitHub button.
  3. You are redirected to the GitHub repository for LWC Recipes.

Note: You are now in the GitHub organization trailheadapps. Each tile in the sample gallery has a link to the underlying GitHub repository for its app. The trailheadapps organization is where the Salesforce Developer Relations sample apps live. 

The sample gallery repositories in GitHub

You explored both the landing page with the full list of sample apps and discovered how to navigate to each sample app’s source code. In the next step, you learn how we set up tooling for these apps and how to find the different artifacts involved with the tooling. 

We won’t check any of your work in this step. Click Verify step to earn 25 points to go to the next step in the project.