Skip to content

dnesbala/node-url-shortener

Repository files navigation

URL Shortener

A simple Node.js application that shortens long URLs and keeps track of usage analytics, such as click count, IP address, and user agent information for each URL.

Screenshot

Features

  • URL Shortening: Converts long URLs into short, easy-to-share links.
  • Analytics Tracking: Records data for each click, including:
    • Date and time of click
    • User's IP address
    • User agent information
  • Dashboard: Displays a table of shortened URLs, click counts, creation dates, and optional expiration dates.

Installation

  1. Clone the repository:

    git clone https://github.com/dnesbala/node-url-shortener.git
    cd node-url-shortener
  2. Install dependencies:

  npm install
  1. Environment Setup: Create a .env file in the root directory and set the required environment variables:
  PORT=8000
  MONGO_DB_URL=your_mongodb_connection_string
  1. Run the application:
  npm start
  1. Access the app: Go to http://localhost:8000 in your browser.

Usage

  • Shorten a URL: Use the form on the homepage to shorten a URL.
  • View Analytics: See click analytics for each URL in a table format on the dashboard.

Future Enhancements

  • User Authentication: Secure access for analytics and URL management.
  • Custom Short URL: Allows users to specify custom URLs for their shortened links.
  • Expiration Logic: Optionally set expiration dates for shortened URLs.
  • Enhanced Analytics: Include geographic data and device types.
  • API Access: Provide API endpoints for creating and managing shortened URLs.

Technologies Used

  • Node.js & Express: Backend server and routing.
  • MongoDB: Database for storing URL and analytics data.
  • EJS: Template engine for rendering dynamic HTML pages.
  • CSS: Styling for the frontend.

About

URL Shortener App with Express and MongoDB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published