imagenUrl field of the usuario table.
Cloudinary is optional. If it is not configured, profile photo uploads will be unavailable, but all other features will continue to work.
Setup
Create a Cloudinary account
Go to cloudinary.com and sign up for a free account.
Find your credentials
In the Cloudinary dashboard, go to Settings > API Keys. You will find your Cloud Name, API Key, and API Secret there.
How it works in the app
Profile photo uploads follow this flow:- The user selects an image in the browser.
- compressorjs (
^1.2.1) compresses the image client-side before upload. - The compressed image is sent to a server API route.
- The server uses the cloudinary package (
^2.9.0) to upload the image to Cloudinary. - Cloudinary returns a URL for the uploaded image.
- The URL is saved to
usuario.imagenUrlin the database.
Security
All three Cloudinary credentials (CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, CLOUDINARY_API_SECRET) are mapped into Nuxt’s server-side runtimeConfig and are never exposed to the browser:
nuxt.config.ts
useRuntimeConfig():
server/api/upload.post.ts