LinkVault is a versatile web application designed to provide users with efficient URL shortening and secure file storage services. It offers a seamless experience for managing and sharing links and files, ensuring convenience and reliability for both personal and professional use.
-
File Storage Service:
- Upload files securely and retrieve download links.
- Authenticate users via Google OAuth2 tokens.
- Support for multiple file uploads.
-
URL Shortener Service:
- Shorten long URLs and generate custom short links.
- Redirect users to the original URLs using short links.
- Track analytics for shortened URLs.
To build and run the Link Vault application locally, follow these steps:
-
Clone this repository to your local machine:
git clone https://github.com/NoahH99/link-vault.git
-
Navigate to the project directory:
cd link-vault -
Edit the Docker Compose configuration file:
cp docker-compose.example.yaml docker-compose.yaml
Edit
docker-compose.yamlwith the necessary information for your setup. -
Set Google Client ID:
- Obtain a Google Client ID from the Google Cloud Console.
- Open the
docker-compose.yamlfile and set theGOOGLE_CLIENT_IDvariable to the obtained Google Client ID.
-
Edit the url-shortener-service application configuration file:
cp url-shortener-service/src/main/resources/application.properties.example url-shortener-service/src/main/resources/application.properties
Edit
url-shortener-service/src/main/resources/application.propertieswith the appropriate configurations for your environment. -
Edit the url-shortener-service test configuration file:
cp url-shortener-service/src/test/resources/application.properties.example url-shortener-service/src/test/resources/application.properties
Edit
url-shortener-service/src/test/resources/application.propertieswith the necessary configurations for your testing environment. -
Run Docker Compose to build and start the containers:
docker-compose up --build
-
Once the containers are up and running, you can access the application at
http://localhost.
Contributions to the Link Vault application are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
The Link Vault application exposes the following API endpoints:
- Method:
POST - Description: Upload one or multiple files securely.
- Authorization: Bearer token obtained from Google OAuth2.
- Request Body: Form-data with
filesto be uploaded. - Response Body:
{ "uploaded_files": [ { "original_filename": "Example1.jpg", "filename": "7b7624f1-7b94-4824-a039-3e49000a8918.jpg", "file_url": "http://localhost/files/c504fe011c2e0f625441bc0b9f1469d67193e5626ab1fc7de7460feac1e8181e/7b7624f1-7b94-4824-a039-3e49000a8918.jpg", "raw_file_size": 786097, "file_size": "767.67 KB" }, { "original_filename": "Example2.jpg", "filename": "48a6f6ce-0ae7-414e-b8a6-1e73fd8a3255.jpg", "file_url": "http://localhost/files/c504fe011c2e0f625441bc0b9f1469d67193e5626ab1fc7de7460feac1e8181e/48a6f6ce-0ae7-414e-b8a6-1e73fd8a3255.jpg", "raw_file_size": 80701, "file_size": "78.81 KB" }, { "original_filename": "Example3.jpg", "filename": "a4148ff8-6f78-43d9-893b-2c1d4d1ffb1d.jpg", "file_url": "http://localhost/files/c504fe011c2e0f625441bc0b9f1469d67193e5626ab1fc7de7460feac1e8181e/a4148ff8-6f78-43d9-893b-2c1d4d1ffb1d.jpg", "raw_file_size": 60573, "file_size": "59.15 KB" } ] }
- Method:
GET - Description: Check the health status of the file storage service.
- Response Body:
{ "status": 200 }
- Method:
POST - Description: Shortens a long URL and returns the shortened link.
- Request Body:
{ "originalUrl": "https://example-long-url.com", "shortCode": "example", "expirationDate": "2024-04-10T12:00:00Z" } - Response Body:
{ "originalUrl": "https://example-long-url.com", "shortCode": "example", "expirationDate": "2024-04-10T12:00:00Z" }
- Method:
GET - Description: Redirects to the original URL associated with the provided short link.
- Path Parameter:
shortCode- Short code generated for the original URL.
- Method:
GET - Description: Get global analytics for all shortened URLs.
- Method:
GET - Description: Get analytics for a specific shortened URL.
- Path Parameter:
shortCode- Short code generated for the original URL.
- Method:
GET - Description: Check the health status of the url shortener service.
- Response Body:
{ "status": 200 }
- Method:
GET - Description: Creates or modifies the state of {switchName} via modifier {state}.
{switchName} can be any string (excluding spaces and forward slashes.
{state} must be an number 0-4, which perform the following actions:
- ( 0 ) Set the {switchName} to False.
- ( 1 ) Set the {switchName} to True.
- ( 2 ) Toggle the {switchName} state.
- ( 3 ) Queries the {switchName} state, changing nothing.
- ( 4 ) Deletes the {switchName} switch
- Response Body:
Success:
Failure:
{ "Status": 200 , "State": flipSwitch_state }{ "Status": 406, "Issue": "/api/flipswitch/[flipswitch]/[state]: state must be a number 0-4" }
This project is licensed under the MIT License.
MIT License
Copyright (c) 2024 Noah Hendrickson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.