A full-stack URL shortener application built with React, Node.js, Express, and MongoDB.
- Shorten long URLs to easily shareable links
- User authentication and registration
- User-specific link management
- Copy shortened URLs with a single click
- Dark mode support for comfortable viewing in low-light environments
- Node.js (v20 or later)
- npm
- MongoDB Atlas account
- Clone the repository:
git clone https://github.com/bjclifton/url-shortener.git
cd url-shortener
- Navigate to the backend directory:
cd back
- Install dependencies:
npm install
- Create a
.env
file in the/back
directory with the following contents:
BASE_URL=http://localhost:YOUR_BACKEND_PORT
PORT=YOUR_BACKEND_PORT
MONGODB_URI=your_mongodb_atlas_connection_string
SESSION_SECRET=your_session_secret
Replace YOUR_BACKEND_PORT
, your_mongodb_atlas_connection_string
, and your_session_secret
with your actual values.
- Start the backend server:
npm start
- Open a new terminal and navigate to the frontend directory:
cd front
- Install dependencies:
npm install
- Start the frontend development server:
npm run dev
The frontend will run onhttp://localhost:5173
by default.
- Open your browser and go to
http://localhost:5173
- Register for a new account or log in if you already have one
- Enter a long URL in the input field on the home page and click "Shorten"
- Copy and share your shortened URL
- View and manage your shortened URLs on your profile page
- Frontend: React, Material-UI
- Backend: Node.js, Express
- Database: MongoDB
- Authentication: Passport.js
Contributions are welcome! Please feel free to submit a Pull Request.