TuKit handles two types of file uploads — product design files (uploaded when creating or editing products) and payment proof images (uploaded when placing an order). All files are processed with Sharp and stored in Google Cloud Storage. Multer handles the initial multipart parsing and writes files to local disk storage; from there, theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/tukit/llms.txt
Use this file to discover all available pages before exploring further.
imageGenerate() utility resizes images, converts them to WebP, uploads every variant to Google Cloud Storage, and returns the public URLs. Local temporary files are removed by deleteImages() once the upload completes.
Product File Fields
The product router configures Multer withdiskStorage pointed at storage/product and uses .fields() to accept four named file fields in a single request:
archivoUrl
The design file. Accepts non-image formats:
.pdf, .rar, .zip, .psd, .cdr, .gif. Uploaded as-is to Google Cloud Storage without Sharp processing.imageUrl
Product preview image. Accepts
.jpg, .jpeg, .png, .webp. Resized by Sharp to lg (1080×1080) and md (500×500) variants, both converted to WebP at 70% quality.shirtGif
Animated shirt preview. Treated as a non-image binary (
.gif) and uploaded directly to Google Cloud Storage without resizing.shortsGif
Animated shorts preview. Same handling as
shirtGif — uploaded directly without Sharp processing.archivoUrl and imageUrl accept exactly one file (maxCount: 1). All four fields are optional — omit any field that is not relevant to the product being created or updated.
Payment Proof Field
The shopping-cart router configures a separate Multer instance that writes tostorage/image_pay and uses .array() to accept multiple files under a single field name:
One or more images serving as proof of payment. Sent to
POST /api/shopping-cart/load/:shoppingCartId/voucher. Multer accepts any number of files under this field name.Upload Flow
Multer receives the multipart request
Multer parses the
multipart/form-data body. Files are written to the local disk under storage/product (product routes) or storage/image_pay (payment routes). Filenames are randomised with a numeric prefix to avoid collisions:imageGenerate() processes each file
For each uploaded file,
imageGenerate() checks the file extension:- Image files (
.jpg,.jpeg,.png,.webp) — Sharp resizes tolg(1080×1080) andmd(500×500), converts both to WebP at 70% quality, and writes the variants to the same destination directory. - Other files (
.pdf,.rar,.zip,.psd,.cdr,.gif) — uploaded directly to Cloud Storage without any processing.
uploadImageStorage() uploads to Google Cloud Storage
Each output file (original or Sharp variant) is uploaded to the GCS bucket configured in
config.NAMEGOOGLECLOUD via the @google-cloud/storage SDK. The public URL takes the form:Sending a Multipart Request
Usemultipart/form-data encoding when creating a new product. Pass all text fields alongside the file fields in a single request:
Uploading Payment Proof
Send payment proof images to the voucher endpoint after a shopping cart has been created. Multiple images can be attached in a single request::shoppingCartId with the _id of the shopping cart document returned when the order was created.
Files must be sent as
multipart/form-data. Do not set Content-Type: application/json on upload requests — doing so will cause Multer to skip file parsing entirely and the file fields will be empty.