.mvn/wrapper | ||
logs | ||
META-INF | ||
out/artifacts/shortener_jar | ||
src | ||
test-output | ||
.gitignore | ||
create.sql | ||
docker-compose.yml | ||
Dockerfile | ||
image.png | ||
mvnw | ||
mvnw.cmd | ||
pom.xml | ||
README.md | ||
server.xml | ||
shortener.sh | ||
testng.xml |
Enterprise-Grade URL Shortener and Bio Page Application
A powerful and scalable URL shortener with integrated bio pages built using Spring Boot.
Table of Contents
Overview
This project is an enterprise-grade URL shortener and bio page application developed with Spring Boot. It provides a robust solution for shortening URLs and creating bio pages for users. The application is designed for scalability and includes features such as analytics, user management, and subscription plans.
Features
- Shorten URLs and create custom short URLs
- Integrated bio pages for users
- Analytics tracking for each shortened URL
- User management with registration, login, and profile updates
- Subscription plans for premium features
- Rate limiting to prevent abuse
- Forgot password and username recovery functionality
- ...
Getting Started
Prerequisites
Before you begin, ensure you have the following installed:
- Java (JDK 11 or later)
- Maven
- MySQL
- Your favorite IDE (IntelliJ, Eclipse, etc.)
Local Setup
-
Clone the repository:
git clone https://github.com/aamitn/URLShortener.git
-
Apply the Database Schema:
Execute the provided db_schema.sql file to set up the necessary tables and schema for the application. This script will also create the required database.
mysql -u your_username -p < path/to/db_schema.sql
-
Update the application.properties file:
Update the application.properties file in the src/main/resources directory with your database configuration.
-
Build and run the application:
cd URLShortener mvn spring-boot:run
-
Access the application at http://localhost:8080
Deployment
-
Build a deployable WAR:
mvn clean install
-
Deploy the WAR:
-
Option 1: Manual Deployment
Deploy the generated WAR file to your Tomcat server. Copy the WAR file to the
webapps
directory of your Tomcat installation.cp target/shorten.war /path/to/tomcat/webapps/
-
Option 2: Web Interface Upload
Alternatively, if your Tomcat server provides a web interface for WAR file deployment, follow these steps:
- Access the Tomcat Manager web interface at
http://localhost:8080/manager/html
(replace with your Tomcat server address). - Log in with your Tomcat manager credentials.
- Navigate to the "WAR file to deploy" section.
- Choose the
shorten.war
file using the file upload button. - Click the "Deploy" button.
- Access the Tomcat Manager web interface at
-
-
Configure environment variables:
Set environment variables for cloud-specific settings.
-
Adjust Tomcat Configuration (Important):
To ensure proper functionality, it's important to run the application on the root of the servlet container. If you're using Tomcat, add the following line to your
server.xml
configuration file within the<Host>
section:<Context path="" docBase="shorten" reloadable="true"></Context>
This ensures that the application runs on the root context path. Adjust the
docBase
attribute according to your deployment directory. -
Start Tomcat:
Start your Tomcat server.
/path/to/tomcat/bin/startup.sh # for Linux /path/to/tomcat/bin/startup.bat # for Windows
Access the application at
http://localhost:8080/
. -
Adjust Configuration (Optional): If you need to customize the application configuration after deployment, you can find the application.properties file within the deployed WAR file. THe file can be accesses as :
vi /path/to/tomcat/webapps/your-app/WEB-INF/classes/application.properties
Usage
- Shorten URLs by visiting the URL Shortener page.
- Access analytics for each shortened URL.
- Create and manage bio pages in the Bio section.
Contributing
Contributions are welcome! Please follow the contribution guidelines.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.