Skip to content

themysterysolver/TINY-URL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TINY-URL

  • TINY-URL is a simple URL shortening service that allows users to convert long URLs into short, easily shareable links.
  • This is inspired from the idea of actual tinyurl website.

WORKING

image

Tech Stack

  • Backend: Node.js,Express.js
  • Database: Postgres using supabase
  • Frontend: React(vite),Bootstarp using CDN
  • Testing is done with help of postman

Installation and setup

  1. Clone the repository:
    git clone https://github.com/themysterysolver/TINY-URL.git
    cd TINY-URL
  2. Install dependecy
    npm install
    cd frontend
    npm install
    
  3. Connect to supabase which is a BaaS(backend as a service),create a table with below schema
create table public.urls (
  id bigint generated by default as identity not null,
  long_url character varying null,
  short_url character varying null,
  created_at timestamp with time zone not null default now(),
  last_used timestamp with time zone null default now(),
  constraint urls_pkey primary key (id)
) TABLESPACE pg_default;
  1. Create a .env file,fill the .env variables with help of supabase connection.
  • Go to Database > connect > click the connection type to **Node.js** > copy parameters
  • env variables should match db.js
  1. Run the program
node index.js
cd frontend
npm run dev

REPO STRUCTRE

nerd1910@DESKTOP-LOVHKH2:/mnt/d/Desktop/TINY-URL$ tree
.
├── db.js
├── frontend
│   ├── README.md
│   ├── eslint.config.js
│   ├── index.html
│   ├── package-lock.json
│   ├── package.json
│   ├── public
│   │   └── vite.svg
│   ├── src
│   │   ├── App.css
│   │   ├── App.jsx
│   │   ├── assets
│   │   │   └── react.svg
│   │   ├── index.css
│   │   └── main.jsx
│   └── vite.config.js
├── index.js
├── package-lock.json
└── package.json
  • index.js - Has the complete backend api logic
  • db.js - helps to make connection
  • /frontend/src/App.jsx - complete frontend logic with usestates

BACKEND API

Endpoint Method Description
/shorten POST Accepts a long URL and returns a unique short URL.
/urls GET Returns a list of all stored long and short URLs.
/r/:short_url GET Redirects the short URL to its corresponding long URL.

Issues

NOTE: supabase connection is detailed in issues #4

Issue #1 talks about backend

Issue #2 talks about frontend

Issue #3 talks about exposed keys

About

A website idea inspired from tinyurl.com

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors