URL Shortener is a service that shortens a long URL into a short URL which is easier to share.
- Create short URLs with optional expiration.
- Public and private short URLs.
- User authentication and role-based access.
- Validation for original URLs.
- Tracks click counts for each short URL.
Before running the application, ensure you have the following installed:
- Java 17 or higher
- Maven 3.8 or higher
- Docker and Docker Compose
- Git
git clone https://github.com/abdelrahman998/url-shortener.git
cd url-shortener
Update the src/main/resources/application.properties
file with your database configuration:
spring.datasource.url=jdbc:postgresql://db:5432/url_shortener
spring.datasource.username=your_db_username
spring.datasource.password=your_db_password
spring.jpa.hibernate.ddl-auto=update
Run the following command to build the application:
mvn clean install
Ensure the docker-compose.yml
file is present in the project root.
Start the application using Docker Compose:
docker-compose up --build
This will start the application and a PostgreSQL database container.
src/main/java/com/example/url_shortener
: Main application code.src/main/resources
: Configuration files and templates.db/migration
: SQL migration scripts.
- Java 17
- Spring Boot
- Spring Data JPA
- Maven
- PostgreSQL
- FlywayDb Migrations
- Docker
- Thymeleaf (for templates)
- Spring Security
This project is licensed under the MIT License. See the LICENSE
file for details.