A simple URL shortener application built with Kotlin and Ktor.
Try the application live here Note: The application is hosted on a free hosting service, so it may take up to 50 seconds to respond on the first access. Please be patient while it loads.
- Shorten long URLs to easy-to-share short links
- Redirect from short links to original URLs
- Simple and clean user interface
- In-memory H2 database for URL storage
- Kotlin
- Ktor framework
- Thymeleaf for templates
- H2 in-memory database
- Exposed ORM
- Docker for containerization
- Clone the repository:
git clone https://github.com/j4v1ng/urlshortener.git
cd urlshortener
- Make sure you have Java 11+ installed
- Run the application using Gradle:
./gradlew run
- Open your browser and navigate to
http://localhost:8080
- Build the Docker image:
docker build -t urlshortener .
- Run the container:
docker run -p 8080:8080 urlshortener
- Open your browser and navigate to
http://localhost:8080
- Enter a URL in the input field
- Click "Shorten URL"
- Copy the shortened URL and share it
- When someone visits the shortened URL, they will be redirected to the original URL
src/main/kotlin/Application.kt
- Main application setupsrc/main/kotlin/Routing.kt
- HTTP routes definitionsrc/main/kotlin/Database.kt
- Database models and servicesrc/main/resources/templates/index.html
- Thymeleaf template for the UI
MIT