Visit Website
π Table of Contents
- Introduction
- Tech Stack
- Features
- UI Designs
- Setup & Installation
- Usage
- Routes & Endpoints
- Data Modeling
- Directory structure
- Deployment
π Introduction
A full-stack web application that allows users to create shortened URLs from long URLs with additional features like custom slugs, QR code generation, and link analytics. Built using React, Appwrite, and Tailwind CSS.
In todayβs digital age, individuals and businesses frequently share long, unwieldy URLs across various communication channels, such as social media, emails, and messaging platforms. These lengthy URLs can create multiple challenges.
The goal is to build a modern, user-friendly full-stack URL shortener application that empowers users to convert long URLs into concise, shareable links. This application bridges the gap between simplicity and functionality, providing a robust platform for URL shortening, analytics, and management. It is designed to focus on good UI/UX, ensuring its relevance and adaptability for evolving user needs.
π Tech Stacks
- Figma: For designing and prototyping the basic web layout for web.
- React: For building a responsive and interactive user interface.
- Tailwind CSS: For styling and layout.
- Redux Toolkit: For state management and efficient data flow.
- React Router Dom: For routing inside react app.
- React Hook Form: For building scalable forms and form validations.
- Motion: Also known as Framer motion for animating react jsx.
- Ua Parser js: The Essential Web Development Tool for User-Agent Detection.
- Recharts: For visualizing analytics data in the dashboard.
- Appwrite: For database, authentication, and API management.
π Features
- π Authentication System: A robust authentication system ensuring security and user privacy.
- π User-friendly Dashboard: User will be provided a Dashboard where he/she can manage account, created short urls and its analytics.
- π Shorten URLs: Convert long URLs into short, easy-to-share links.
- π Custom Slugs: Define custom back-halves for your links (e.g.,
https://short.ly/custom-slug). - π URL Redirect: Redirect users to the original URL when they visit the shortened link. Example: Visiting https://yourapp.com/abc123 takes the user to https://example.com/very-long-url.
- π Detailed URL Page: A detailed URL page displaying content and URL Analytics for an immersive user experience.
- π Edit & Delete Functionality: Provide users with the ability to edit and delete the existing URL at any time.
- π QR Code Generation: Automatically generate QR codes for shortened links.
- π Performence Analytics: Track user activity, including device, OS, location, and browser.
- π Best UI/UX: Focused on best UI/UX for the users.
- π Backend as a Service (BaaS) - Appwrite: Utilize Appwrite as a Backend as a Service solution for streamlined backend development, offering features like authentication, database, file storage, and more.
π UI Designs
- Node.js (v16+ recommended) and npm installed.
- An Appwrite instance running locally or hosted.
- Vercel account for deployment (optional).
git clone https://github.com/SujoyKrHaldar/Short-freely.git
cd url-shortenernpm installCreate a .env file in the root directory and add the following:
VITE_CLIENT_URL = http://localhost:5173
VITE_APPWRITE_URL = https://appwrite.io/v1
VITE_APPWRITE_PROJECT_ID=
VITE_APPWRITE_DATABASE_ID=
VITE_APPWRITE_URL_COLLECTION_ID=
VITE_APPWRITE_ANALYTIC_COLLECTION_ID=
VITE_GET_LOCATION_API_URL= "https://ipapi.co/json"npm run devThe app will run locally at http://localhost:5173.
π Usage
- Enter the long URL in the Destination URL field.
- Optionally, add a custom title or slug.
- A QR code generation will be generated based on Destination URL.
- Click the Create button to generate your shortened link.
You can prefill the Destination URL using query parameters:
- For loggedin users
/dashboard/create?longurl=https://example.com
- For Public users it will look like this for better User Experience
/login?redirectTo=/dashboard/create?longurl=https://example.com
A QR code will appear below the form after pasting Destination URL. You can download it for sharing or copy short url as well.
π Routes & Endpoints
Overview of routes and their functionality in the application.
- Public Routes (Accessible without authentication)
| Route | Description | Example URL | Features |
|---|---|---|---|
GET / |
Landing page with an overview of the app and a form for shortening URLs. | https://your-app.com/ | - Input field for entering long URLs. - Option to customize the short URL slug (if allowed). |
GET /redirect/:shortUrlSlug |
Redirects users to the original long URL. | https://your-app.com/redirect/xYz123 | - Handles redirection to the original URL. - Tracks click metrics (if implemented). |
GET /404 |
Page displayed when a user accesses an invalid route or slug. | https://your-app.com/404 | - Informs users about invalid URLs. |
GET /login |
User login page. | https://your-app.com/login | - Allows users to log in to their accounts. |
GET /register |
User registration page. | https://your-app.com/register | - Facilitates user account creation. |
- Private Routes (Accessible after authentication)
| Route | Description | Example URL | Features |
|---|---|---|---|
GET /dashboard |
Displays a user's shortened URLs, stats, and quick actions. | https://your-app.com/dashboard | - List of all created short URLs. - Options to copy, edit, or delete a URL. - View click stats. |
POST /dashboard/create |
Form for creating a new shortened URL. | https://your-app.com/dashboard/create | - Option to enter the original URL. - Custom slug or auto-generate. - Set an expiration date (optional). |
GET /dashboard/edit/:urlId |
Edit an existing shortened URL. | https://your-app.com/dashboard/edit/xYz123 | - Modify the original URL or slug. - Update the expiration date or other metadata. |
GET /dashboard/:urlId |
Displays analytics for a specific short URL. | https://your-app.com/dashboard/xYz123 | - Click count, geographic data, referral sources. |
GET /dashboard/account |
Manage account settings. | https://your-app.com/dashboard/account | - Update profile information. - Change password. |
| API Endpoint | Description | Example |
|---|---|---|
/v1/databases/{databaseId}/collections/{collectionId}/documents |
Create Short URL | - Create a document with original URL, slug, and optional metadata. |
/v1/databases/{databaseId}/collections/{collectionId}/documents |
Fetch All URLs | - Retrieve all documents representing URLs in the collection. |
/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} |
Delete URL | - Remove a specific document representing a URL by its ID. |
π Data Modeling
There will be two collection 1. URL 2. Analytics we will wonk on.
Tracks analytics data for each click on a shortened URL.
| Field | Type | Description |
|---|---|---|
_id |
ObjectId | Unique identifier for the user entry. |
name |
String | Full name of the user. |
email |
String | User's email address (unique). |
password |
String | Hashed password. |
clickedAt |
Date | Account creation timestamp.. |
updatedAt |
Date | Last profile update timestamp. |
Stores information about shortened URLs.
| Field | Type | Description |
|---|---|---|
_id |
ObjectId | Unique identifier for the shortened URL. |
originalUrl |
String | The full URL provided by the user. |
shortUrl |
String | The shortened URL slug . |
userId |
ObjectId | Reference to the user who created the URL (null if public). |
clickCount |
Number | Total number of clicks on the shortened URL. |
qrCode |
String | Path or URL to the generated QR code (auto generated). |
customSlug |
String | Custom slug for short URL (optional & unique). |
createdAt |
Date | Timestamp of URL creation. |
updatedAt |
Date | Timestamp of last modification. |
Tracks analytics data for each click on a shortened URL.
| Field | Type | Description |
|---|---|---|
_id |
ObjectId | Unique identifier for the analytics entry. |
urlId |
ObjectId | Reference to the shortened URL. |
ipAddress |
String | IP address of the user clicking the URL. |
userAgent |
String | Browser/OS/device information. |
location |
String | Geolocation data based on IP (e.g., country, state, city). |
clickedAt |
Date | Timestamp of the click. |
shortUrl |
String | Short url provided. |
| Relationship | Type | Description |
|---|---|---|
Users β URLs |
One-to-Many | A user can create multiple shortened URLs. |
URLs β Analytics |
One-to-Many | A shortened URL can have multiple analytics entries (one for each click). |
π Directory structure
Directory structure/
βββ .env.example
βββ index.html
βββ eslint.config.js
βββ public/
βββ postcss.config.js
βββ vercel.json
βββ package.json
βββ vite.config.js
βββ README.md
βββ tailwind.config.js
βββ src/
βββ api/
β βββ urlService.js
β βββ authService.js
β βββ analyticService.js
β βββ initServer.js
βββ App.jsx
βββ state/
β βββ auth/
β β βββ authSlice.js
β β βββ authAction.js
β βββ notification/
β β βββ notificationSlice.js
β β βββ notificationAction.js
β βββ rootReducer.js
β βββ index.js
β βββ store.js
βββ assets/
β βββ svgs/
β β βββ Logo.jsx
β βββ illustrations/
βββ components/
β βββ layouts/
β β βββ index.jsx
β β βββ main/
β β β βββ MobNavbar.jsx
β β β βββ MainLayout.jsx
β β β βββ Header.jsx
β β β βββ Footer.jsx
β β β βββ Navbar.jsx
β β βββ dashboard/
β β βββ DashboardLayout.jsx
β β βββ DashboardHeader.jsx
β β βββ DashboardSidebar.jsx
β βββ shared/
β β βββ index.jsx
β β βββ MetaTags.jsx
β βββ ui/
β β βββ index.jsx
β β βββ forms/
β β β βββ Input.jsx
β β β βββ SignupForm.jsx
β β β βββ LoginForm.jsx
β β βββ notification/
β β βββ NotificationCard.jsx
β β βββ NotificationUi.jsx
β βββ pages/
β βββ dashboard/
β β βββ index.jsx
β β βββ search/
β β β βββ DeshboardSearch.jsx
β β βββ short-links/
β β β βββ DashboardShortLinks.jsx
β β βββ create-url/
β β β βββ DashboardCreateShortUrl.jsx
β β βββ url-details/
β β β βββ DashboardUrlDetails.jsx
β β β βββ DashboardUrlAnalytics.jsx
β β β βββ DashboardUrlOptions.jsx
β β β βββ DashboardSingleUrlPage.jsx
β β βββ shared/
β β β βββ DashboardLinkCard.jsx
β β β βββ DashboardBreadcrumb.jsx
β β β βββ charts/
β β β β βββ LineChartComponent.jsx
β β β β βββ PieChartComponent.jsx
β β β β βββ BarChartComponent.jsx
β β β βββ ShareLinkPopup.jsx
β β β βββ NoResultFallbackUi.jsx
β β β βββ LinkDeletePopup.jsx
β β β βββ ErrorFallbackUi.jsx
β β β βββ DashbaordLinkForm.jsx
β β βββ edit-url/
β β β βββ DashboardEditUrl.jsx
β β βββ home/
β β β βββ DashboardHomeUrlLists.jsx
β β β βββ DashboardHome.jsx
β β βββ account/
β β βββ DashboardProfileEdit.jsx
β β βββ DashboardAccount.jsx
β β βββ DashboardSessions.jsx
β β βββ DashboardAccountEditTemplate.jsx
β β βββ DashboardPasswordUpdate.jsx
β βββ home/
β βββ HomeTestimonialSection.jsx
β βββ index.jsx
β βββ HomeLandingSection.jsx
β βββ HomeFeatureSection.jsx
β βββ HomeProductUsedBySection.jsx
β βββ HomeFooterSection.jsx
β βββ HomeFaqSection.jsx
β βββ HomeAboutSection.jsx
βββ styles/
β βββ index.css
βββ hooks/
β βββ index.jsx
β βββ useQueryParams.jsx
β βββ useAuth.jsx
β βββ useFetchUrlById.jsx
β βββ useLogout.jsx
β βββ useFetchUrls.jsx
β βββ useNotification.jsx
βββ main.jsx
βββ config/
β βββ index.js
βββ routes/
β βββ index.jsx
β βββ PrivateRoutes.jsx
β βββ PublicRoutes.jsx
β βββ AuthRoutes.jsx
βββ pages/
β βββ index.jsx
β βββ auth/
β β βββ Login.jsx
β β βββ Signup.jsx
β βββ public/
β β βββ RedirectUrl.jsx
β β βββ Home.jsx
β β βββ PageNotFound.jsx
β βββ private/
β βββ SearchLinks.jsx
β βββ Account.jsx
β βββ EditShortUrl.jsx
β βββ CreateShortUrl.jsx
β βββ AllShortLinks.jsx
β βββ Dashboard.jsx
β βββ UrlDetails.jsx
βββ router.jsx
βββ utils/
βββ imageUrls.js
βββ constants.js
π Deployment
- Build the React app:
npm run build
- Deploy the
buildfolder to Vercel or any static hosting service.
- Host your Appwrite instance on a platform like Render or AWS or use their cloud service for free for better experience.
- Configure your database and collection settings in Appwrite.




