Skip to content

lazaropower/url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener

This is a simple URL shortener made with Laravel 10, Vue.js 3 and MySQL.

Requirements

You need to have the following things intalled on your machine:

How it works?

You can introduce any URL you want, your desired folder and click on submit. Afer that we will check if there is any folder and url saved already in the database and just return it. If the url is new, we will make a request to the Google Safe Browsing API to make sure the URL does not contains any malware.

In case of malware, we will not save or provide any shortened url. If the url is clean, we will proceed saving in the database the original url, the generated 6 characters hash and the folder and returning the shortened url to the Front-End.

Home page:

image image image

Loading page:

image

404 Not Found:

image

Architecture

Untitled-2024-02-19-1854

How to launch the project?

Back-End

Copy the .env.example file and rename it to .env. You can configure the following parameters and Docker container will automatically detect them, for example:

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=backend
DB_USERNAME=user
DB_PASSWORD=user
DB_ROOT_PASSWORD=user

Also you must enter your Google Safe Browser API Key:

GOOGLE_API_KEY=your-google-api-key

After that, you can run the following commands:

composer install       # Thiw will install the required composer dependencies.
docker-compose up -d   # This will launch the docker container with the MySQL database.
php artisan migrate    # This will apply all the required Laravel migrations.
php artisan serve      # This will launch the Back-End.

Front-End

Copy the .env.example file and rename it to .env. You can configure the following parameters and Docker container will automatically detect them, for example:

VITE_BACKEND_URL='http://127.0.0.1:8000/'   # By default this is the localhost url.

If you don't know how to get the Google Safe Browsing API key check here.

After that, you can run the following commands:

npm install   # This will install the required dependencies. 
npm run dev   # This will launch the Front-End.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

Simple URL shortener made with Laravel and Vue.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published