{"id":26614469,"url":"https://github.com/shreyasganesh911/swifturl","last_synced_at":"2026-04-05T21:02:44.850Z","repository":{"id":284001106,"uuid":"950613037","full_name":"ShreyasGanesh911/SwiftURL","owner":"ShreyasGanesh911","description":"SwiftURL - A high-performance URL shortener built with Node.js, Fastify, Redis, and MongoDB. It features fast redirects, rate limiting, QR code generation, and analytics tracking. Perfect for managing and analyzing short links efficiently! ","archived":false,"fork":false,"pushed_at":"2025-03-23T15:08:38.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T16:23:09.364Z","etag":null,"topics":["cloudinary","fastify","jwt","mongodb","nodejs","redis","typescript"],"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/ShreyasGanesh911.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}},"created_at":"2025-03-18T12:34:49.000Z","updated_at":"2025-03-23T15:11:51.000Z","dependencies_parsed_at":"2025-03-23T16:33:21.279Z","dependency_job_id":null,"html_url":"https://github.com/ShreyasGanesh911/SwiftURL","commit_stats":null,"previous_names":["shreyasganesh911/swifturl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyasGanesh911%2FSwiftURL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyasGanesh911%2FSwiftURL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyasGanesh911%2FSwiftURL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyasGanesh911%2FSwiftURL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShreyasGanesh911","download_url":"https://codeload.github.com/ShreyasGanesh911/SwiftURL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245212547,"owners_count":20578484,"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":["cloudinary","fastify","jwt","mongodb","nodejs","redis","typescript"],"created_at":"2025-03-24T05:19:51.005Z","updated_at":"2025-12-30T21:42:34.936Z","avatar_url":"https://github.com/ShreyasGanesh911.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftURL\n\nSwiftURL is a high-performance URL shortening service built with **Node.js, Fastify, Redis, and MongoDB**. It provides fast and reliable URL shortening, analytics tracking, and rate-limiting features.\n\n## Features\n- 🔗 **Shorten Long URLs**: Convert long URLs into short, easily shareable links.\n- 🚀 **Fast Performance**: Uses Redis caching for quick lookups.\n- 📊 **Analytics Tracking**: Tracks click counts, first/last click timestamps, and device types.\n- ⚡ **Rate Limiting**: Prevents abuse using a Redis-based rate limiter.\n- 🔐 **User Authentication**: Secure JWT-based authentication.\n- 📦 **QR Code Generation**: Generates QR codes for each shortened URL.\n\n## Tech Stack\n- **Backend:** Node.js, Fastify\n- **Database:** MongoDB (stores user and URL data)\n- **Cache:** Redis (stores frequently accessed short URLs \u0026 rate limiting data)\n- **Authentication:** JWT\n- **Storage:** Cloudinary (for QR codes)\n\n## Flowchart: Redis Cache and MongoDB Query (How It Works)\n\n```plaintext\n+----------------+        \n|  User Request  |        \n+----------------+        \n        |                   \n        V      \n+----------------------+\n|  Rate Limit Check   |\n+----------------------+\n    Allowed? (Yes/No)\n    |        |\n   YES       | NO\n    |        |         +--------------------+\n    |        |-----\u003e   | Block Request (429)|  ------\u003e  END\n    |                  +--------------------+\n    V\n+--------------------+     \n|  Check Redis Cache |     \n+--------------------+     \n        |                   \n        V                   \n+----------------+      No       +--------------------+\n|  Cache Hit?    | ------------\u003e | Query MongoDB for  |\n+----------------+               |        Data        |\n        |                        +--------------------+\n       Yes                         |          |         \n        |                          V          V        \n        V                    +---------------------+   \n+--------------------+       | Store Data in Redis |   \n| Return Cached Data |       |       Cache         |   \n+--------------------+       +---------------------+   \n           |                        |               \n           V                        V               \n        +----------------------------------------+   \n        |           Return Data to User          |  \n        +----------------------------------------+  \n\n```\n## Installation\n\n### Prerequisites\n- Node.js (v16+ recommended)\n- MongoDB\n- Redis\n\n### Steps\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/ShreyasGanesh911/SwiftURL.git\n   cd SwiftURL\n   ```\n2. Install dependencies:\n   ```sh\n   npm install\n   ```\n3. Create a `.env` file and configure your environment variables:\n\n   ```env\n    PORT = 8000\n    MONGO_URI = mongodb://localhost:27017/db_name\n    SALT_ROUNDS = XXXX\n    JWT_KEY = \"someKeyHere\"\n    CLOUDINARY_NAME = \"xxxxx\"\n    CLOUDINARY_API_SECRET = \"xxxxx\"\n    CLOUDINARY_API_KEY = \"xxxxx\"\n    END_POINT = \"http://localhost:8000\"\n   ```\n4. Build TypeScript Files:\n   ```sh\n   npm run build\n   ```\n5. Start the server:\n   ```sh\n   npm run dev\n   ```\n\n## API Endpoints\n\n### Authentication\n- `POST /api/v1/user/register` – Register a new user\n- `POST /api/v1/user/login` – Log in a user\n- `POST /api/v1/user/logout` – Log out a user\n\n### URL Shortening\n- `POST /api/v1/url` – Generate short URL\n- `GET /api/v1/url`  – Get all URLs\n- `GET /api/v1/url/:id` – Get analytics for a short URL\n- `DELETE /api/v1/url/:id` – Delete a URL\n\n### Short URL check\n- `GET /{short}` - Redirect to long URL\n\n## Documentation\nPostman API documentation\n\n## ToDo\n- Frontend 📊\n   - Build a simple dashboard using Next.js\n   - Show analytics\n   - Implement user authentication for managing URLs\n- Backend 🔐\n    - Track country \u0026 region of users\n    - Enable user-defined expiry for short URLs\n    \n   \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshreyasganesh911%2Fswifturl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshreyasganesh911%2Fswifturl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshreyasganesh911%2Fswifturl/lists"}