Skip to content

๐Ÿ“ File Uploads โ€‹

KitchenAsty handles image uploads for menu items using Multer middleware.

โš™๏ธ Configuration โ€‹

Uploads are saved to the uploads/ directory at the server root. Files are served statically at /uploads/.

๐Ÿ–ผ๏ธ Accepted Formats โ€‹

MIME TypeExtension
image/jpeg.jpg, .jpeg
image/png.png
image/webp.webp
image/gif.gif

๐Ÿ“ Limits โ€‹

SettingValue
Max file size5 MB
StorageDisk (uploads/ directory)
FilenameUUID-based to avoid collisions

๐Ÿ“ค Upload API โ€‹

POST /api/menu/items/:id/image
Content-Type: multipart/form-data
Authorization: Bearer <staff-token>

Form field: image

See Image Uploads for the full API reference.

๐Ÿณ Docker Volumes โ€‹

In Docker, the uploads directory is inside the container. To persist uploads across container restarts, mount a volume in docker-compose.yml:

yaml
server:
  volumes:
    - ./uploads:/app/uploads

๐ŸŒ Serving Uploaded Files โ€‹

The Express server serves uploaded files at /uploads/:

typescript
app.use('/uploads', express.static(path.resolve(process.cwd(), 'uploads')));

In Docker, the admin and storefront nginx configs proxy /uploads/ to the server container.

๐Ÿญ Production Notes โ€‹

For production deployments, consider:

  • ๐Ÿ’พ Mounting a persistent volume for the uploads directory
  • โ˜๏ธ Using a CDN or object storage (S3) for uploaded images
  • ๐Ÿ“ Setting appropriate file size limits at the nginx level