Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vishal-raj-1/url-shortner


https://github.com/vishal-raj-1/url-shortner

Last synced: about 16 hours ago
JSON representation

Awesome Lists containing this project

README

        

Here's a sample README for your URL shortener application:

---

# URL Shortener Application

This URL Shortener is a web application that allows users to shorten long URLs, making them easier to share and manage. The application is built using Node.js, Express, MongoDB, and EJS templating.

## Features

- **User Authentication:** Users can sign up and log in to manage their shortened URLs.
- **URL Shortening:** Authenticated users can shorten long URLs and retrieve the shortened versions.
- **URL Management:** Users can view and manage their shortened URLs.
- **Secure Access:** Only logged-in users can access the URL shortening and management features.

## Project Structure

```
├── src
│ ├── controller
│ │ └── auth.js # Handles user authentication (login, signup)
│ ├── middleware
│ │ └── auth.js # Middleware to restrict access to logged-in users
│ ├── routes
│ │ └── url.js # Routes for URL-related operations
│ ├── views
│ │ ├── login.ejs # Login page view
│ │ ├── signup.ejs # Signup page view
│ │ └── ... # Other views
│ └── ...
├── .env # Environment variables (e.g., MONGO_URI, PORT)
├── app.js # Main application file
├── package.json # Dependencies and scripts
└── README.md # Project documentation
```

## Prerequisites

- **Node.js**: Make sure Node.js is installed on your system.
- **MongoDB**: Ensure that MongoDB is installed and running, or use a MongoDB Atlas connection URI.

## Installation

1. **Clone the repository:**
```bash
git clone https://github.com/yourusername/url-shortener.git
cd url-shortener
```

2. **Install dependencies:**
```bash
npm install
```

3. **Set up environment variables:**
Create a `.env` file in the root directory and add the following variables:
```
MONGO_URI=your_mongodb_uri
PORT=your_preferred_port
```

4. **Start the application:**
```bash
npm start
```

5. **Access the application:**
Open your browser and navigate to `http://localhost:`.

## Usage

1. **Signup:** Navigate to `/signup` to create a new account.
2. **Login:** Navigate to `/login` to log into your account.
3. **Shorten URLs:** Once logged in, use the interface to shorten long URLs.
4. **Manage URLs:** View and manage your shortened URLs from your dashboard.

## Contributing

If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are welcome.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

Feel free to adjust the sections according to your project's specifics!