Share your repls and programming experiences

← Back to all posts
URL Shortener!
ExplosionScratc (507)

Super easy to use URL shortener with Mongodb, url caching (to make it like way faster), typo support (if you mistype a URL it'll redirect you), a bookmarklet to easily create a URL, no tracking, custom ID, pretty much anything else you can think of!


(It fetches using a POST request and sends the window location, also asks for a prompt and generates a short ID client side as the prompt placeholder, then alerts the user if there was an error, and copies it to clipboard if it was successful.)

javascript:(async()=>{var e=await fetch("",{method:"POST",body:JSON.stringify({url:window.location.href,id:prompt("ID",function(){var t=46656*Math.random()|0,e=46656*Math.random()|0;return t=("000"+t.toString(36)).slice(-3),e=("000"+e.toString(36)).slice(-3),t+e}())})}).then(t=>t.json());e.url?(t=document.createElement("textarea"),document.body.appendChild(t),t.value=e.url,,document.execCommand("copy"),t.remove()):alert(e.error||e.message)})();
ch1ck3n (2027)

what a coincedence because i made one too :|