This is a simple URL shortener made with Laravel 10, Vue.js 3 and MySQL.
You need to have the following things intalled on your machine:
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:
Loading page:
404 Not Found:
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.
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.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.