{"id":46597887,"url":"https://github.com/ozzie-code-alt/link-shortner-dockerized","last_synced_at":"2026-03-07T15:06:00.878Z","repository":{"id":308285890,"uuid":"1032264026","full_name":"Ozzie-code-alt/link-shortner-dockerized","owner":"Ozzie-code-alt","description":"Link shortener and analytics dashboard built with Next.js, TypeScript, Prisma, and Docker. Features click tracking, geolocation analytics, and a one-command setup.","archived":false,"fork":false,"pushed_at":"2025-08-05T04:26:55.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-05T06:22:12.735Z","etag":null,"topics":["analytics","docker","fullstack","link-shortener","nextjs","postgresql","prisma","rest-api","tailwindcss","typescript","url-shortener"],"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/Ozzie-code-alt.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}},"created_at":"2025-08-05T04:13:10.000Z","updated_at":"2025-08-05T04:35:21.000Z","dependencies_parsed_at":"2025-08-05T06:32:39.073Z","dependency_job_id":null,"html_url":"https://github.com/Ozzie-code-alt/link-shortner-dockerized","commit_stats":null,"previous_names":["ozzie-code-alt/link-shortner-dockerized"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Ozzie-code-alt/link-shortner-dockerized","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ozzie-code-alt%2Flink-shortner-dockerized","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ozzie-code-alt%2Flink-shortner-dockerized/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ozzie-code-alt%2Flink-shortner-dockerized/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ozzie-code-alt%2Flink-shortner-dockerized/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ozzie-code-alt","download_url":"https://codeload.github.com/Ozzie-code-alt/link-shortner-dockerized/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ozzie-code-alt%2Flink-shortner-dockerized/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30219426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T14:02:48.375Z","status":"ssl_error","status_checked_at":"2026-03-07T14:02:43.192Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["analytics","docker","fullstack","link-shortener","nextjs","postgresql","prisma","rest-api","tailwindcss","typescript","url-shortener"],"created_at":"2026-03-07T15:05:59.972Z","updated_at":"2026-03-07T15:06:00.865Z","avatar_url":"https://github.com/Ozzie-code-alt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Link Shortener \u0026 Analytics Dashboard\n\n![Next.js](https://img.shields.io/badge/Next.js-000000?style=for-the-badge\u0026logo=nextdotjs\u0026logoColor=white)\n![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n![Prisma](https://img.shields.io/badge/Prisma-2D3748?style=for-the-badge\u0026logo=prisma\u0026logoColor=white)\n![PostgreSQL](https://img.shields.io/badge/PostgreSQL-4169E1?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n![TailwindCSS](https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge\u0026logo=tailwind-css\u0026logoColor=white)\n\nA full-stack link shortening service built with Next.js, TypeScript, and Prisma. This application allows users to convert long URLs into short, manageable links and provides a detailed analytics dashboard to track click-through performance. The entire application is containerized with Docker for easy setup and deployment.\n\n---\n\n## Features\n\n-   **Shorten URLs:** Convert any long URL into a unique, 6-character short link.\n-   **Link Redirection:** Fast and reliable redirection from the short link to the original URL.\n-   **Click Analytics:** Every click is tracked and recorded.\n-   **Analytics Dashboard:** A detailed view for each link, showing:\n    -   Total click count.\n    -   Timeline of click events.\n    -   Geographical data (clicks by country).\n    -   Referrer information (user agent).\n-   **Fully Typed:** Built with TypeScript from end to end for robust, error-free code.\n-   **Containerized:** Includes `Dockerfile` and `docker-compose.yml` for a one-command setup.\n\n## Tech Stack\n\n-   **Framework:** [Next.js](https://nextjs.org/) (App Router)\n-   **Language:** [TypeScript](https://www.typescriptlang.org/)\n-   **Styling:** [Tailwind CSS](https://tailwindcss.com/)\n-   **Database ORM:** [Prisma](https://www.prisma.io/)\n-   **Database:** [PostgreSQL](https://www.postgresql.org/)\n-   **Containerization:** [Docker](https://www.docker.com/) \u0026 Docker Compose\n\n## Getting Started\n\nFollow these instructions to get the project up and running on your local machine for development and testing.\n\n### Prerequisites\n\nYou must have the following software installed:\n-   [Node.js](https://nodejs.org/) (v18 or later)\n-   [Docker](https://www.docker.com/products/docker-desktop/) and Docker Compose\n\n### 1. Running with Docker (Recommended)\n\nThis is the easiest way to get the entire stack (Next.js app + PostgreSQL database) running.\n\n1.  **Clone the repository:**\n    ```bash\n    git clone [https://github.com/your-username/link-shortener.git](https://github.com/your-username/link-shortener.git)\n    cd link-shortener\n    ```\n\n2.  **Create an environment file:**\n    Copy the example environment file. The default values are configured to work with Docker Compose out of the box.\n    ```bash\n    cp .env.example .env.local\n    ```\n\n3.  **Build and run the containers:**\n    ```bash\n    docker-compose up --build\n    ```\n    This command will build the Next.js image, pull the official Postgres image, and start both services. The app will be available at `http://localhost:3000`.\n\n### 2. Running Locally (Without Docker)\n\n1.  **Clone the repository:**\n    ```bash\n    git clone [https://github.com/your-username/link-shortener.git](https://github.com/your-username/link-shortener.git)\n    cd link-shortener\n    ```\n\n2.  **Install dependencies:**\n    ```bash\n    npm install\n    ```\n\n3.  **Set up the Database:**\n    Make sure you have a PostgreSQL server running. Create an `.env.local` file and add your database connection string:\n    ```env\n    # .env.local\n    DATABASE_URL=\"postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=public\"\n    ```\n\n4.  **Run Prisma migrations:**\n    This will create the necessary tables (`Link`, `Click`) in your database.\n    ```bash\n    npx prisma migrate dev\n    ```\n\n5.  **Run the development server:**\n    ```bash\n    npm run dev\n    ```\n    The application will be available at `http://localhost:3000`.\n\n---\n\n## Future Scope \u0026 AI Integrations\n\nThis project has a solid foundation that can be extended with many powerful features.\n\n### Standard Features\n\n-   **User Authentication:** Implement NextAuth.js or Clerk to allow users to sign up, log in, and manage their own links.\n-   **Custom Slugs:** Allow authenticated users to choose their own custom slugs (e.g., `sh.rt/my-portfolio`).\n-   **QR Code Generation:** Automatically generate a downloadable QR code for every shortened link.\n-   **Link Expiration:** Allow users to set an expiration date for their links.\n\n### AI-Powered Integrations\n\n-   **🤖 Malicious Link Detection:**\n    -   Integrate an AI service (or a custom-trained model) that analyzes the `originalUrl` upon submission.\n    -   The model could classify URLs as \"safe,\" \"suspicious,\" or \"malicious\" based on patterns and known threats, preventing the platform from being used for phishing or malware distribution.\n\n-   **📈 Predictive Click Analytics:**\n    -   Use the historical click data to train a time-series forecasting model.\n    -   The dashboard could display predictions like, \"This link is projected to receive **~200 more clicks** in the next 7 days,\" providing valuable insights for marketing campaigns.\n\n-   **📝 AI-Generated Link Summaries:**\n    -   When a user pastes a link, an AI agent could crawl the destination page in the background.\n    -   Using a Large Language Model (LLM) like Gemini, it could generate a concise, one-sentence summary of the page's content. This summary would be stored and displayed on the dashboard, reminding the user what the link is about.\n\n-   **🚨 Anomaly Detection for Bot Traffic:**\n    -   Develop a system that analyzes incoming click patterns in real-time.\n    -   An AI model could learn what \"normal\" traffic looks like for a link and automatically flag anomalies—such as thousands of clicks from a single IP address in a few seconds—as likely bot activity, helping to keep analytics clean and accurate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozzie-code-alt%2Flink-shortner-dockerized","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozzie-code-alt%2Flink-shortner-dockerized","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozzie-code-alt%2Flink-shortner-dockerized/lists"}