> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# List images in Next.js (video tutorial)

## Overview

Learn how to list images using the Next.js app router and the [Cloudinary Node.js SDK](node_integration). Search for assets using queries or by tag, and display them in a Next.js application rendered using React Server Components (RSC).

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.

## Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
### Introduction
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=00 :player=cld} | Getting images into Cloudinary is easy but what about getting them out? You can use the [Search API](search_method) and [Cloudinary Node.js SDK](node_integration) to display them in your Next.js app router application.
|

### Intro to App router in Next.js
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=24 :player=cld} | The Next.js app router brings some big changes and improvements to developer experience. The introduction of server vs client components is a key part of this. Client components behave like a typical React component, whereas server components offer the ability to do data fetching from within the component.
|

### Configure Home page for data fetching
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=50 :player=cld} | By default, pages and components will be server components. You can turn the `Home` page into an asynchronous component by adding the `async` tag in front of the function name, making it possible to use `await` for data fetching.
|

```js
async function Home() {
  await ...
}
```

### Add search requests using the Cloudinary Node.js SDK
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=1 :sec=17 :player=cld} | Install and configure the [Cloudinary Node.js SDK](node_integration) to be able to use it from your server designated React component. Add your SDK code inside your asynchronous page component to perform a search. For example to find all images with "converse" in the name:
|

```js
const resources = await cloudinary.search.expression('converse').execute();
```

### Search for images by tag
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=2 :sec=10 :player=cld} | Instead of returning all images or images by name, you can also search for images by tag. For example to find images with the tag "sneakers":

```js
const resources = await cloudinary.search.expression('tags=sneakers').execute();
```

### Use returned images on your page
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=2 :sec=24 :player=cld} | Use the returned Cloudinary images on your page by looping through the returned images. First, destructure the returned `resources` to get the resources array from the JSON. Use map to iterate through the `resources` array. If using typescript, reference the `CloudinaryResource` and define this as an interface with `public_id` and `secure_url` as strings. Update your list items to reference the `public_id` as the key and `secure_url` as the image src.

```js

interface CloudinaryResource {
  public_id: string;
  secure_url: string;
}

...

const { resources } = await cloudinary.search.expression('tags=sneakers').execute();

...

{resources.map((product: CloudinaryResource) => {
  return(
    <li key={product.public_id}>
      <img 
        src={product.secure_url}
      />
    </li>
  )
}
)}

```

### Take it further
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=3 :sec=27 :player=cld} | Take it further by learning all about how to add Cloudinary optimizations and transformations using the [Next.js SDK](nextjs_integration).

## Keep learning

> **READING**:
>
> * Find out more about [image](image_transformations) and [video](video_manipulation_and_delivery) transformations.

> * Watch more [Dev Hints videos](https://www.youtube.com/playlist?list=PL8dVGjLA2oMpaTbvoKCaRNBMQzBUIv7N8) on the [Cloudinary YouTube channel](https://www.youtube.com/cloudinary).

#### If you like this, you might also like...

  
  
  
    Optimization Tips
    Tips for delivering optimized images 
  

  
  
  
    Upload Assets with Server Actions
    Upload assets to Cloudinary using Next.js Server Actions 
  

  
  
  
    Optimize Videos in Next.js
    Optimize delivery of videos in a Next.js app 
  

&nbsp;

&nbsp;Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.
&nbsp;

