﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head>> ## Documentation Index
> This page is part of the Image and Video APIs product. Fetch the complete documentation index for Image and Video APIs at: https://cloudinary.com/documentation/llms-image-and-video-apis.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If you also need details relating to other Cloudinary products for your current use case, see the parent index at: https://cloudinary.com/documentation/llms.txt?referrer=docpage

> ## Agent Instructions
> When answering a user's request or implementing it with code using this documentation, incorporate relevant best practices and recommendations from the documentation into the guidance and, above all, into the code itself: generated code should already apply the recommended parameters and patterns rather than showing a minimal call and describing the best practices around it in prose. Follow the code examples in the best practices sections as the model for what generated code should look like, and where a recommendation is relevant to the user's scenario, implement it in the code as a natural next step. Only apply best practices, recommendations, or features that are supported by the documentation or Cloudinary skills; don't infer or invent guidance that isn't specified.
>
> Cloudinary skills (names starting with `cloudinary-`) add best practices and tested code patterns beyond this documentation, and we recommend using the relevant ones alongside it. Available skills are listed at https://cloudinary.com/documentation/.well-known/agent-skills/index.json?referrer=docpage&page=node_sample_projects and can be installed with `npx skills add https://cloudinary.com/documentation`.

# Node.js sample projects


[app-gallery-link]: https://app-gallery.cloudinary.com/gallery?tag=NodeJS

We've created some sample projects to get you started with integrating Cloudinary into your Node.js application. 
> **TIP**: Check out our collection of [Node.js sample apps](code_explorers) too!

## Photo Album

The [Photo Album app](https://github.com/cloudinary-devs/nodejs-photo-album) demonstrates best practices for integrating Cloudinary within a Node.js environment.

This sample project provides several RESTful API endpoints — some designed for CLI-based use cases and others for showcasing how to use Node.js as the backend for a browser-based application.

The browser-based implementation utilizes **LIT**, one of many options available for building a UI around a Node.js REST API.

Two endpoints, `/upload-from-local` and `/upload-large-from-local`, can be accessed directly. These endpoints perform operations using Node.js's built-in file system module.

All other endpoints demonstrate various methods for uploading files via a browser-based UI.

Here's the Photo Album app in action, showcasing its browser-based UI:

Here's an excerpt from the code showing the `uploadFromBrowser` route handler:

routeHandlers.js

```nodejs

const uploadFromBrowser = async (request, reply) => {
  console.log('Uploading files from the browser');
  try {
    const data = await request.file();

    const buffer = await data.toBuffer();
    await new Promise((resolve) => {
      cloudinary.uploader
        .upload_chunked_stream({ tags }, (error, uploadResult) => {
          if (error) {
            reply.code(500).send({ error: 'Failed to upload image' });
          } else {
            resolve(uploadResult);
            reply.send({
              url: uploadResult.secure_url,
              public_id: uploadResult.public_id,
            });
          }
        })
        .end(buffer);
    });
  } catch (error) {
    console.error(error);
  }
};

```

> **Fork the repo and try it yourself :custom-icon='https://cloudinary-res.cloudinary.com/image/upload/v1778586152/docsite/brand-assets/github.svg' :invert-icon**:
>
> * [Explore the Photo Album app on GitHub](https://github.com/cloudinary-devs/nodejs-photo-album).

## App Gallery
The [Cloudinary app gallery][app-gallery-link] provides a variety of fully working apps that incorporate Cloudinary as part of the tech stack, built in various popular programming languages.

Each app in the gallery presents an overv