Logo

Sharing Excess

Food Rescue Platform
For DevelopersServices

Storage Service (apps/storage)

S3 file host proxy and admin interface. Serves as both a file hosting service and an administrative tool for exploring and managing S3 storage.

What it does

  • File Hosting: Proxies S3 files with proper permissions (public for partner/user images, private for backups)
  • Admin Interface: Directory exploration, file previewing, downloading, and deletion
  • S3 Management: Direct S3 client integration for file operations

Key features

  • Directory browsing with folder navigation
  • File preview for images and text files
  • Direct file download capabilities
  • File deletion with confirmation
  • Permission-based access (public vs private files)

Environment (src/env.ts)

  • S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_REGION, S3_BUCKET, S3_ENDPOINT
  • STORAGE_BASE_URL (used by other services to reference storage)

Implementation (src/index.ts)

  • Hono-based server with S3 client integration
  • Route handlers for file serving, directory listing, and admin operations
  • Proper CORS and security headers

Docker image (apps/storage/Dockerfile)

  • Bun base image with production dependencies
  • Runs as non-root user for security

Railway (apps/storage/railway.json)

  • Deployed as a web service (not a cron)
  • Custom resource allocation based on usage needs

URLs

  • Local: localhost:4000
  • Staging: storage.staging.sharingexcess.com
  • Production: storage.sharingexcess.com

Integration

  • Referenced by STORAGE_BASE_URL and VITE_STORAGE_BASE_URL environment variables
  • Used by client and server for file access and management
  • Replaces previous Vercel Blob integration