A quick start sample project demonstrating how to integrate Cloudinary's image and video management capabilities into a Next.js application using the next-cloudinary SDK.
- 🖼️ Image upload with Cloudinary Upload Widget
- 🎨 On-the-fly image transformations
- ⚡ Optimized image delivery
- 🔧 TypeScript support
- Node.js 18+ installed
- A Cloudinary account (sign up for free)
- Your Cloudinary credentials:
- Cloud Name
- Upload Preset (unsigned)
- Clone the repository
git clone <repository-url>
cd cld-nextjs-sdk-quick-start- Install dependencies
npm install- Configure environment variables
Create a .env.local file in the root directory:
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloud_nameReplace your_cloud_name with your actual Cloudinary cloud name from your Cloudinary Console.
- Create an Upload Preset
- Go to your Cloudinary Console
- Navigate to Settings → Upload
- Scroll to "Upload presets" and click "Add upload preset"
- Set the signing mode to "Unsigned"
- Save the preset and note the preset name
- Update the
uploadPresetvalue inapp/page.tsxwith your preset name
Start the development server:
npm run devOpen http://localhost:3000 in your browser.
cld-nextjs-sdk-quick-start/
├── app/
│ ├── page.tsx # Main upload demo page
│ └── layout.tsx # Root layout
├── .env.local # Environment variables (not in git)
├── next.config.ts # Next.js configuration
└── package.json # Dependencies
- Uses
CldUploadButtoncomponent for easy file uploads - Handles upload success with TypeScript type safety
- Displays uploaded image information
- Uses
CldImagecomponent for optimized delivery - Demonstrates crop transformation (
crop="fill") - Automatic format and quality optimization
- Verify your cloud name is correct in
.env.local - Ensure your upload preset is set to "unsigned"
- Check browser console for errors
- Confirm the public ID is correct
- Verify your cloud name is properly configured
- Check that the image was successfully uploaded to Cloudinary
Explore more Cloudinary features:
- Video upload and transformation
- AI-powered image enhancements
- Responsive images with automatic breakpoints
- Advanced transformations (filters, effects, overlays)
- Media library integration