Skip to content

ShortLink is a web application that allows users to generate short URLs for their long links. The app provides additional features such as password protection for private links and an info page to track the number of clicks and the link's visibility status (public or private)

Notifications You must be signed in to change notification settings

iheb15M/shortlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShortLink

ShortLink Logo

Overview

ShortLink is a web application that allows users to generate short URLs for their long links.

The app provides additional features such as password protection for private links and an info page to track the number of clicks and the link's visibility status (public or private)

Features

  1. Short Link Generation: Convert long URLs into short, easy-to-share links
  2. Private Links: Protect your short links with a password for added security
  3. Link Analytics: Use the info page to track the number of clicks

Project Structure

The project is divided into two main folders:

  • short-link-backend: Contains the backend code built with Node.js, TypeScript, and MongoDB.
  • short-link-frontend: Contains the frontend code built with Vite, React, and TailwindCSS.

Technology Stack

Frontend

  • Vite Vite
  • React React
  • TailwindCSS TailwindCSS

Backend

  • Node.js Node.js
  • TypeScript TypeScript
  • MongoDB MongoDB

Running the Project

This project includes a docker-compose.yml file to easily run the entire project with Docker. Additionally, each folder has its own Dockerfile to run the backend and frontend separately.

Docker Compose

To run the entire project (both frontend and backend) using Docker Compose, follow these steps:

  1. Ensure Docker are installed on your machine.

  2. Clone the repository:

    git clone https://github.com/iheb15M/shortlink
    cd shortlink
  3. Run the following command:

    docker compose up --build
  4. now the project is runing on http://localhost:8080/

Running the Project in DevMode

Requirements

  • Node.js: Ensure that Node.js version >= 22 is installed on your machine. You can download it from here
  • Docker: Make sure Docker is installed. You can download it from here
  • MongoDB Compass (optional): To inspect and interact with the MongoDB database, you can use MongoDB Compass. Download it from here

To run the project in devMode, follow these steps:

1. Run Database

First, start the MongoDB container using Docker Compose:

docker compose up shortlink.db

This will start the MongoDB container, which is required for the backend to function.

2. Run Backend

Navigate to the short-link-backend directory:

cd ./short-link-backend

Install the required dependencies:

npm install  # or npm i

Run the backend in development mode:

npm run start:dev

3. Run Frontend

Navigate to the short-link-frontend directory:

cd ./short-link-frontend

Install the required dependencies:

npm install  # or npm i

Run the frontend in development mode:

npm run dev

Optional: Connect to MongoDB using MongoDB Compass

If you want to inspect the MongoDB database using MongoDB Compass, follow these steps:

  1. Open MongoDB Compass.

  2. In the connection string field, use the following URI to connect to your local MongoDB instance: mongodb://root:azerty@localhost:27017/shortlink?authSource=admin This connects to the MongoDB instance running in the Docker container.

  3. Click Connect to access the database



Connect with Me

LinkedIn Website Behance Medium

About

ShortLink is a web application that allows users to generate short URLs for their long links. The app provides additional features such as password protection for private links and an info page to track the number of clicks and the link's visibility status (public or private)

Topics

Resources

Stars

Watchers

Forks