{"id":24725087,"url":"https://github.com/ifsvivek/imagecdn","last_synced_at":"2026-04-04T22:31:33.343Z","repository":{"id":274282925,"uuid":"918623058","full_name":"ifsvivek/ImageCDN","owner":"ifsvivek","description":"A modern image optimization and delivery service built with SvelteKit. Upload once, serve everywhere with automatic optimization and lightning-fast delivery through GitHub-powered CDN.","archived":false,"fork":false,"pushed_at":"2025-01-26T09:01:28.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T13:45:09.020Z","etag":null,"topics":["cdn","image-optimization","nodejs","postgresql","svelte"],"latest_commit_sha":null,"homepage":"https://imagecdn.ifsvivek.tech","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ifsvivek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["ifsvivek"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-01-18T12:29:14.000Z","updated_at":"2025-01-26T09:01:32.000Z","dependencies_parsed_at":"2025-01-26T09:26:52.713Z","dependency_job_id":"8568a4b4-8fde-47ba-bc19-bb895de38e00","html_url":"https://github.com/ifsvivek/ImageCDN","commit_stats":null,"previous_names":["ifsvivek/imagecdn"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifsvivek%2FImageCDN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifsvivek%2FImageCDN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifsvivek%2FImageCDN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifsvivek%2FImageCDN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ifsvivek","download_url":"https://codeload.github.com/ifsvivek/ImageCDN/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244966461,"owners_count":20539794,"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","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":["cdn","image-optimization","nodejs","postgresql","svelte"],"created_at":"2025-01-27T13:16:45.153Z","updated_at":"2025-12-30T21:55:27.623Z","avatar_url":"https://github.com/ifsvivek.png","language":"Svelte","funding_links":["https://github.com/sponsors/ifsvivek"],"categories":[],"sub_categories":[],"readme":"# ImageCDN\n\nA modern image optimization and delivery service built with SvelteKit. Upload once, serve everywhere with automatic optimization and lightning-fast delivery.\n\n---\n\n## Features\n\n### 🔽 Smart Optimization\n\n- Automatic image optimization and format conversion\n- Supports WebP, JPG, and PNG formats\n- Generates multiple size variants automatically\n\n### ⚡ High Performance\n\n- Global CDN distribution\n- Responsive image variants for all devices\n- Lightning-fast loading times worldwide\n\n### 🛠️ Easy Integration\n\n- Simple and intuitive upload interface\n- Copy-paste URLs for different sizes\n- Dashboard for managing images\n\n### 🔒 Secure\n\n- User authentication for access control\n- Protected image uploads\n- Secure CDN delivery with encrypted endpoints\n\n---\n\n## Tech Stack\n\n- **Frontend**: SvelteKit, TailwindCSS\n- **Backend**: Node.js, PostgreSQL (Neon)\n- **Storage**: GitHub as CDN\n- **Authentication**: JWT\n\n---\n\n## Installation\n\n### Step 1: Clone the Repository\n\n```bash\ngit clone https://github.com/ifsvivek/ImageCDN\ncd ImageCDN\n```\n\n### Step 2: Install Dependencies\n\n```bash\nnpm install\n```\n\n### Step 3: Configure Environment Variables\n\nCreate a `.env` file in the root directory with the following variables:\n\n```env\nACCESS_TOKEN=\"your_github_personal_access_token\"\nPOSTGRES_URL=\"your_neon_postgres_connection_string\"\nJWT_SECRET=\"your_random_secret_key\"\n```\n\n---\n\n## Configuration\n\n### GitHub Setup\n\n1. Create a new repository named `CDN` in your GitHub account.\n2. Generate a personal access token with `repo` permissions.\n3. Update the following lines in [`src/routes/api/upload/+server.js`](./src/routes/api/upload/+server.js) with your GitHub username:\n\n   ```js\n   await octokit.repos.createOrUpdateFileContents({\n   \towner: 'your-github-username',\n   \trepo: 'CDN',\n   \tpath,\n   \tmessage: `Upload ${path}`,\n   \tcontent: resizedImage.toString('base64'),\n   \tbranch: 'main'\n   });\n\n   const fileData = await octokit.repos.getContent({\n   \towner: 'your-github-username',\n   \trepo: 'CDN',\n   \tpath\n   });\n\n   await octokit.repos.deleteFile({\n   \towner: 'your-github-username',\n   \trepo: 'CDN',\n   \tpath,\n   \tmessage: `Delete ${path}`,\n   \tsha: fileData.data.sha,\n   \tbranch: 'main'\n   });\n\n   return json({\n   \tsuccess: true,\n   \turls: sizes.map(\n   \t\t(size) =\u003e\n   \t\t\t`https://cdn.your-github-username.io/${userId}/${timestamp}/image_${size}.${format}`\n   \t)\n   });\n   ```\n\n### Database Setup\n\n1. Create a free database on [Neon](https://neon.tech).\n2. Execute the following SQL commands to create the required tables:\n\n   ```sql\n   CREATE TABLE user_table (\n       user_id SERIAL PRIMARY KEY,\n       email VARCHAR(255) UNIQUE NOT NULL,\n       password VARCHAR(255) NOT NULL,\n       user_name VARCHAR(255) NOT NULL\n   );\n\n   CREATE TABLE user_images (\n       id SERIAL PRIMARY KEY,\n       user_id INTEGER REFERENCES user_table(user_id),\n       foldername VARCHAR(255) NOT NULL,\n       format VARCHAR(10) NOT NULL,\n       created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n   );\n\n   CREATE TABLE api_keys (\n       id SERIAL PRIMARY KEY,\n       user_id INTEGER REFERENCES user_table(user_id),\n       api_key VARCHAR(255) UNIQUE NOT NULL,\n       created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n   );\n\n   CREATE TABLE api_usage (\n       id SERIAL PRIMARY KEY,\n       user_id INTEGER REFERENCES user_table(user_id),\n       api_key VARCHAR(255) REFERENCES api_keys(api_key),\n       used_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n   );\n   ```\n\n---\n\n## Development\n\nStart the development server:\n\n```bash\nnpm run dev\n```\n\n## Building for Production\n\nBuild the project:\n\n```bash\nnpm run build\n```\n\nPreview the production build:\n\n```bash\nnpm run preview\n```\n\n---\n\n## Usage Notes\n\nAfter uploading images, please allow up to **20 minutes** for processing and CDN availability. This ensures optimal compression and format conversion.\n\n---\n\n## Environment Variables\n\n- `ACCESS_TOKEN`: GitHub personal access token with `repo` permissions\n- `POSTGRES_URL`: Neon PostgreSQL connection string\n- `JWT_SECRET`: Random string used for JWT token generation\n\n---\n\n## CDN URLs\n\nImages will be available at:\n\n```\nhttps://cdn.yourdomain.com/{user_id}/{timestamp}/image_{size}.{format}\n```\n\nWhere:\n\n- `size`: 256, 512, 1024, or 2048\n- `format`: webp, jpg, or png\n\n---\n\n## Contributing\n\n1. Fork the repository.\n2. Create a new feature branch.\n3. Make your changes.\n4. Submit a pull request.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifsvivek%2Fimagecdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fifsvivek%2Fimagecdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifsvivek%2Fimagecdn/lists"}