MediHoss is a modern media hosting web application built with Next.js, designed for secure and efficient file uploads. It integrates with Keyshade for cryptographic operations and Cloudinary for scalable media storage and delivery.
This project uses Keyshade for secure secret management. All sensitive credentials (such as Cloudinary API keys) are accessed at runtime using a single Keyshade-managed private key. To run this project, you must have your Keyshade private key file located at ~/.keyshade/private-keys.json.
How it works:
- The backend loads the private key from your local file system.
- All required secrets (e.g., Cloudinary credentials) are fetched securely from Keyshade as needed.
- This approach avoids hardcoding secrets or storing them in environment files.
Setup (only if not already configured):
If your system already has the Keyshade private key and required secrets in place, no further setup is needed.
Otherwise, follow these steps:
- Sign up for Keyshade and add your secrets to your Keyshade vault.
- Download your private key and place it at
~/.keyshade/private-keys.json. - The app will automatically use this key to access secrets at runtime.
This project uses the free Cloudinary plan for media uploads and transformations.
Free Plan Features:
- 3 users
- 1 product environment
- 25 monthly credits
- 500 admin API limit
- 10 MB max image file size
- 100 MB max video file size
- 10 MB max raw file size
- 100 MB max image transformation size
- 40 MB max video transformation size
- 25 MP max image megapixel
- 50 MP max megapixel in all frames
See the Cloudinary pricing page for more details.
To ensure fair usage and prevent abuse, this project implements automatic rate limiting for user uploads. Each user (by IP address) is limited to a certain number of uploads per minute. This helps stay within the limits of the free Cloudinary plan and protects the service from excessive use.
You can adjust the rate limiting settings in the API route code as needed.
- Upload images and media files via a simple web interface
- Files are processed with Keyshade for enhanced security (encryption, hashing, or similar)
- Media is stored and served using Cloudinary
- Built-in error handling and clean UI
- Node.js (v18 or newer recommended)
- Yarn or npm
- Cloudinary account (for media storage)
- Keyshade credentials/configuration
-
Clone the repository:
git clone <your-repo-url> cd medihoss
-
Install dependencies:
npm install # or yarn install -
Set up environment variables:
-
Copy
.env.local.exampleto.env.local(if example exists) or create.env.localmanually. -
Add your Cloudinary and Keyshade credentials:
CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret KEYSHADE_SECRET=your_keyshade_secret # Add any other required variables
-
npm run dev
# or
yarn devVisit http://localhost:3000 to use the app.
- Go to the Upload page (
/upload) - Select a file to upload
- The file will be processed and securely uploaded to Cloudinary
- You will receive a link to the hosted media
src/app/— Main application pages and API routessrc/lib/keyshade.ts— Keyshade integration and cryptographic utilitiespublic/— Static assets and icons
-
Ensure all environment variables are set in your production environment
-
Build the app:
npm run build # or yarn build -
Start the production server:
npm start # or yarn start
MIT
For more details, see the code and comments in each file. Contributions are welcome!