{"id":25640458,"url":"https://github.com/iron-m4n/megacdn","last_synced_at":"2025-10-14T12:56:52.460Z","repository":{"id":278898964,"uuid":"937114816","full_name":"IRON-M4N/MegaCDN","owner":"IRON-M4N","description":"A lightweight and serverless CDN utilizing MEGA for file storage and delivery.  ","archived":false,"fork":false,"pushed_at":"2025-10-01T02:50:21.000Z","size":235,"stargazers_count":10,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-01T04:25:16.703Z","etag":null,"topics":["api","cdn","fastify","mega","megajs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IRON-M4N.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-22T11:22:23.000Z","updated_at":"2025-10-01T02:50:24.000Z","dependencies_parsed_at":"2025-10-01T04:19:37.207Z","dependency_job_id":"e4494229-c122-4f0b-a665-153341e179da","html_url":"https://github.com/IRON-M4N/MegaCDN","commit_stats":null,"previous_names":["iron-m4n/megacdn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IRON-M4N/MegaCDN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IRON-M4N%2FMegaCDN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IRON-M4N%2FMegaCDN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IRON-M4N%2FMegaCDN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IRON-M4N%2FMegaCDN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IRON-M4N","download_url":"https://codeload.github.com/IRON-M4N/MegaCDN/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IRON-M4N%2FMegaCDN/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018582,"owners_count":26086583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cdn","fastify","mega","megajs"],"created_at":"2025-02-23T04:39:33.461Z","updated_at":"2025-10-14T12:56:52.456Z","avatar_url":"https://github.com/IRON-M4N.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  $\\textcolor{red}{Mega}\\textcolor{white}{CDN}$\n\u003c/h1\u003e\n\nA lightweight and serverless CDN utilizing MEGA for file storage and delivery.\n\n---\n\n## Features\n\n- Stores in mega.nz cloud \n- Multi-account load balancing\n- PostgreSQL, MongoDB, SQLite support\n- Auto-delete \u0026 auth token\n- Rate limit \u0026 size check\n- Shortened filenames\n---\n\n#### DEPLOY TO HEROKU\n\n1. If you don’t have an account on Heroku, create one.  \n   \u003cbr\u003e\n   \u003ca href=\"https://signup.heroku.com/\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Create Heroku\" src=\"https://img.shields.io/badge/-Create-black?style=for-the-badge\u0026logo=heroku\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n2. Now deploy:  \n   \u003cbr\u003e\n   \u003ca href=\"https://heroku.com/deploy?template=https://github.com/IRON-M4N/MegaCDN\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Deploy Heroku\" src=\"https://img.shields.io/badge/-Deploy-black?style=for-the-badge\u0026logo=heroku\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n#### DEPLOY TO VERCEL\n\n1. If you don’t have an account on Vercel, create one.  \n   \u003cbr\u003e\n   \u003ca href=\"https://vercel.com/signup\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Create Vercel\" src=\"https://img.shields.io/badge/-Create-black?style=for-the-badge\u0026logo=vercel\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n2. Now deploy:  \n   \u003cbr\u003e\n   \u003ca href=\"https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FIRON-M4N%2FMegaCDN\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Deploy Vercel\" src=\"https://img.shields.io/badge/-Deploy-black?style=for-the-badge\u0026logo=vercel\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n#### DEPLOY TO RAILWAY\n\n1. If you don’t have an account on Railway, create one.  \n   \u003cbr\u003e\n   \u003ca href=\"https://railway.app\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Create Railway\" src=\"https://img.shields.io/badge/-Create-black?style=for-the-badge\u0026logo=railway\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n2. Now deploy:  \n   \u003cbr\u003e\n   \u003ca href=\"https://railway.app/new\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Deploy Railway\" src=\"https://img.shields.io/badge/-Deploy-black?style=for-the-badge\u0026logo=railway\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n#### DEPLOY TO RENDER\n\n1. If you don’t have an account on Render, create one.  \n   \u003cbr\u003e\n   \u003ca href=\"https://dashboard.render.com/register\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Create Render\" src=\"https://img.shields.io/badge/-Create-black?style=for-the-badge\u0026logo=render\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n2. Now deploy:  \n   \u003cbr\u003e\n   \u003ca href=\"https://render.com/deploy?repo=https://github.com/IRON-M4N/MegaCDN\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Deploy Render\" src=\"https://img.shields.io/badge/-Deploy-black?style=for-the-badge\u0026logo=render\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n#### DEPLOY TO KOYEB\n\n1. If you don’t have an account on Koyeb, create one.  \n   \u003cbr\u003e\n   \u003ca href=\"https://app.koyeb.com/auth/signup\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Create Koyeb\" src=\"https://img.shields.io/badge/-Create-black?style=for-the-badge\u0026logo=koyeb\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n2. Now deploy:  \n   \u003cbr\u003e\n   \u003ca href=\"https://app.koyeb.com/deploy?type=git\u0026repository=github.com/IRON-M4N/MegaCDN\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Deploy Koyeb\" src=\"https://img.shields.io/badge/-Deploy-black?style=for-the-badge\u0026logo=koyeb\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n#### DEPLOY TO REPLIT\n\n1. If you don’t have an account on Replit, create one.  \n   \u003cbr\u003e\n   \u003ca href=\"https://replit.com/signup\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Create Replit\" src=\"https://img.shields.io/badge/-Create-black?style=for-the-badge\u0026logo=replit\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n2. Now deploy:  \n   \u003cbr\u003e\n   \u003ca href=\"https://replit.com/github/IRON-M4N/MegaCDN\" target=\"_blank\"\u003e\n     \u003cimg alt=\"Deploy Replit\" src=\"https://img.shields.io/badge/-Deploy-black?style=for-the-badge\u0026logo=replit\u0026logoColor=white\"/\u003e\n   \u003c/a\u003e\n\n## Installation\n\n```bash\ngit clone https://github.com/IRON-M4N/MegaCDN.git\ncd MegaCDN\nnpm install\ncp .env.example .env\nnpm run build\nnpm start\n````\n\n---\n\n## API Endpoints\n\n| Method | Endpoint       | Description                  |\n| ------ | -------------- | ---------------------------- |\n| `POST` | `/upload`      | Upload files                 |\n| `GET`  | `/file/:name`  | Serve file by custom CDN URL |\n| `GET`  | `/media/:name` | Original MEGA URL            |\n| `GET`  | `/info`        | Server info                  |\n| `GET`  | `/health`      | Health check                 |\n\n**Example:**\n\n```bash\ncurl -X POST -F \"file=@image.jpg\" http://cdn.yourdomain.com/upload\n```\n\n---\n\n## Upload Modes\n\n```bash\n# Single mode (default)\ncurl -X POST -F \"file=@file.jpg\" http://cdn.yourdomain.com/upload\n\n# Dual mode (specify MEGA email)\ncurl -X POST -F \"file=@file.jpg\" -F \"mode=dual\" -F \"email=user@mega.com\" http://cdn.yourdomain.com/upload\n\n# With Auth\ncurl -H \"Authorization: Bearer YOUR_TOKEN\" ...\n```\n\n---\n\n## Example Response\n\n```json\n{\n  \"success\": true,\n  \"files\": [\n    {\n      \"url\": \"https://cdn.yourdomaincom/media/abcDEF123.png\",\n      \"name\": \"skirk.png\",\n      \"size\": 1523200,\n      \"formattedSize\": \"1.45 MB\",\n      \"mime\": \"image/png\",\n      \"expires\": \"1800s\",\n      \"formattedExpires\": \"30 minutes\"\n    }\n  ]\n}\n\n```\n\n---\n\n## Security\n\n* Optional Bearer token auth\n* Rate limit per window\n* File size/type validation\n* Auto-delete with TTL\n\n---\n\n## Contributing\n\n1. Fork this repo\n2. Create a branch `feature-xyz`\n3. Commit \u0026 push\n4. Open a pull request\n---\n\n\u003cdiv align=\"center\"\u003e\n\n\\$\\frac{\\text{Made with } \\heartsuit \\text{ by IRON-M4N}}{\\text{2025 - 6969}}\\$\n\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firon-m4n%2Fmegacdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firon-m4n%2Fmegacdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firon-m4n%2Fmegacdn/lists"}