Thanks to visit codestin.com
Credit goes to github.com

Skip to content

d135-1r43/sn0rt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

49 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

sn0rt logo

sn0rt

The World's Best URL Snortenerβ„’ 🐷

Why have long URLs when you can have short ones? We snort 'em down to size! Because nobody has time for 47-character URLs when 8 will do.

Built with Quarkus Java 21 PostgreSQL


✨ Features (aka Snort Powers)

Feature Description
⚑ Snort Speed Faster than a pig finding truffles. URL snorting in milliseconds!
🎯 Custom Snorts Name your links whatever you want. Go wild! Be creative! Snort responsibly.
πŸ“Š Snort Analytics See how many times your link got snorted. Yes, we count every single snort.
πŸ“± QR Snorts Auto-magical QR codes! Point, scan, snort. It's that easy.
πŸ”’ Secure Snorting Your URLs are safe with us. We take our snorting very seriously.
🎨 Pretty Snorts Because if you're gonna snort URLs, they better look fabulous doing it.

πŸš€ Quick Start (Get Snorting!)

What You'll Need

  • JDK 21 - Because we're fancy like that
  • PostgreSQL - For storing all your glorious snorts (or use Docker Compose)
  • Maven - The wrapper is included, you're welcome

Fire It Up! πŸ”₯

Start the application with live reload (snort reloading?):

./mvnw quarkus:dev

Boom! πŸ’₯ Your snortener is now running at:

βš™οΈ Configuration (Make It Yours)

Pro tip: Don't use the default admin/admin credentials in production. That's just asking for trouble. πŸ™ˆ

Set your admin credentials via environment variables:

export ADMIN_USERNAME=your-username
export ADMIN_PASSWORD=super-secret-password

Or configure in application.properties:

sn0rt.admin.username=your-username
sn0rt.admin.password=super-secret-password
sn0rt.base-url=https://your-domain.com

🐳 Docker Deployment (Containerized Snorting)

Build Your Snort Container

./mvnw package
docker build -f src/main/docker/Dockerfile.jvm -t sn0rt:latest .

Run with Docker

docker run -p 8080:8080 \
  -e ADMIN_USERNAME=admin \
  -e ADMIN_PASSWORD=secure-password \
  -e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://host.docker.internal:5432/sn0rt \
  -e QUARKUS_DATASOURCE_USERNAME=postgres \
  -e QUARKUS_DATASOURCE_PASSWORD=postgres \
  sn0rt:latest

πŸ“¦ GitHub Container Registry

We've got CI/CD! Every push to main automatically builds and publishes a fresh Docker image:

docker pull ghcr.io/d135-1r43/sn0rt:latest

πŸ”¨ Building and Testing

Run Tests (Make Sure Nothing's Broken)

./mvnw test

All tests follow the Given-When-Then pattern. We're civilized here. 🎩

Build Package

./mvnw package

Build Uber-JAR (The Chonky Boi)

./mvnw package -Dquarkus.package.jar.type=uber-jar
java -jar target/*-runner.jar

⚑ Native Executable (For Speed Demons)

Want blazing-fast startup and tiny memory footprint? Go native!

./mvnw package -Dnative

No GraalVM? No problem! Build in a container:

./mvnw package -Dnative -Dquarkus.native.container-build=true

Run your lightning-fast native snortener:

./target/sn0rt-1.0.0-SNAPSHOT-runner

Note: Native builds can take a while. Perfect time for a coffee break β˜•

🎯 API Usage (For the Programmers)

Create a Short URL

Option 1: The Clicky Way πŸ–±οΈ Just go to http://localhost:8080/admin and use the fancy web form.

Option 2: The Cool Way 😎

# Let us pick a random code for you
curl -X POST http://localhost:8080/shorten \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/very/long/url"}'

# Be fancy with a custom code
curl -X POST http://localhost:8080/shorten \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/very/long/url", "customCode": "my-awesome-link"}'

Use Your Snorted URL

curl -L http://localhost:8080/{shortCode}

It redirects! Like magic! ✨

Get Stats

curl http://localhost:8080/stats/{shortCode}

Download QR Code PDF

curl -u admin:admin http://localhost:8080/admin/qr/{shortCode}/pdf -o qr-code.pdf

Perfect for printing and sticking on everything! πŸ“„

πŸ› οΈ Tech Stack (The Good Stuff)

Built with love and these awesome technologies:

Technology What It Does
Quarkus 3.28.4 The supersonic, subatomic Java framework
Java 21 Because we like our Java fresh and modern
PostgreSQL Where all the snorts are stored
Hibernate ORM Panache Makes database stuff not painful
Qute Templating that doesn't make you cry
Quarkus QR Code For those fancy scannable squares
Quarkus PDFBox PDF generation without the headache
Quarkus Security JPA Keeps the bad guys out with BCrypt
GitHub Actions Automatic builds because manual is for chumps

🀝 Contributing

Found a bug? Want to add a feature? Have a hilarious idea for the copy?

Contributions are welcome! Please feel free to submit a Pull Request. Just remember:

  • Keep it snorty 🐷
  • Follow the Given-When-Then test pattern
  • Make it fabulous ✨

πŸ“ License

This project uses the Quarkus framework under the Apache License 2.0.


Made with πŸ’– and 🐷 snorts

⭐ Star us on GitHub β€’ πŸ› Report Bug β€’ ✨ Request Feature

About

sn0rt is a selfhostable URL shortener

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •