Efficiently manage and shorten URLs with our MERN stack URL Shortener. This project leverages MongoDB, Express.js, React, and Node.js to provide a streamlined solution for creating and managing shortened links. Enhance your web navigation experience with ease and simplicity.
-
Frontend (Client):
- React
- Vite
-
Backend (Server):
- Node.js
- Express.js
- Passport.js (Google OAuth 2.0 strategy)
-
Database:
- MongoDB
-
Deployment:
- Render (Live Deployment: https://ezylink.onrender.com)
-
Authentication:
- Google OAuth 2.0 using Passport.js
-
API and Data:
- IP Data from ipapi
-
Redis (Local Deployment):
- WSL (Windows Subsystem for Linux)
-
Redis (Upstash Deployment):
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/KnixSpace/EzyLink.git cd EzyLink
-
Install dependencies:
cd client npm install cd ../server npm install
-
Start the Redis server locally using WSL on Windows:
- Make sure you have WSL configured on your Windows system.
- Open WSL terminal.
- Run the following command to start the Redis server:
sudo service redis-server start
-
Configure the client:
- Update the
.env
file in theclient
folder with your local settings:
VITE_LOGIN = "http://localhost:3000/auth/api/login" VITE_LOGIN_SUCCESS = "http://localhost:3000/auth/api/login/success" VITE_LOGOUT = "http://localhost:3000/auth/api/logout" VITE_URL_FREE = "http://localhost:3000/api/url/free" VITE_URL_PAID = "http://localhost:3000/api/url/paid" VITE_SHORT_URL = "http://localhost:3000/" VITE_DASHBOARD_HOME = "http://localhost:3000/api/url/dashboard/data" VITE_DASHBOARD_ALL_LINKS = "http://localhost:3000/api/url/link/all" VITE_DASHBOARD_ANALYTICS = "http://localhost:3000/api/url/link/analytics"
- Update the
-
Configure the server:
- Update the
.env
file in theserver
folder for local Redis settings:
MONGO_CONNECTION_STRING = "mongodb://localhost:27017/your_db_name" CLIENT_DASHBOARDHBOARD = "http://localhost:5173" CLIENT_HOME = "http://localhost:5173" SERVER_HOST = "http://localhost:3000/" AUTH_CLIENT_ID = "google_oauth_client_id" AUTH_CLIENT_SECRET = "google_oauth_client_secret" IP_DATA = "https://ipapi.co/json" IP_DATA_BACKUP = "http://ip-api.com/json/?fields=status,country" NODE_ENV = "development"
- For Upstash deployment, add the following to the
.env
file:
UPSTASH_REDIS_REST_URL = "your_upstash_redis_rest_url" UPSTASH_REDIS_REST_TOKEN = "your_upstash_redis_rest_token"
- Configure
redis.js
in theserver
folder:
For local Redis, comment:
const { Redis } = require("@upstash/redis"); const redis = new Redis({ url: process.env.UPSTASH_REDIS_REST_URL, token: process.env.UPSTASH_REDIS_REST_TOKEN, });
And uncomment:
const { Redis } = require("ioredis"); const redis = new Redis();
For Upstash, comment the local Redis configuration and uncomment the Upstash configuration.
- Update the
-
Start the frontend:
cd client npm run dev
-
Start the backend:
cd ../server node index.js
Now you can access the URL Shortener locally at http://localhost:5173/.