A simple url shortener application with a Svelte and p5 front-end that you can stare at for hours. The post endpoints are protected by Google's OAuth, but anyone can access already created slugs.
refresh to see all 3 ship variations!
A Mongo DB
Here are a few options for your mongo DB. You can either run it locally on your system by installing it from mongodb, spin up a docker container from docker, or have some cloud mongo service such as atlas.
A Google Developer API
This is perhaps a bit more complicated, but if you work through the google documentation here then you will finish with a google client ID, google client secret. Use
[YOUR SERVER DOMAIN HERE]/oauth/google/callback
for your callback url.
A secure Cookie Key
I won't get into choosing how to generate your cookie key here, as there is a lot of easily accessible information. Just make sure that this is not an easily guessed word/key, because it could allow complete access to unauthorized users if they have this.
A static site host
You can either self-host the static files or use one of the many CDN/other services that allow you to host these static files. I find that utilizing the global network that these organizations have allows greater speed from anywhere in the world.
Fill out the .env-sample
with all the relevant data, rename it to .env
and run the server. There is also an included docker package if you prefer to containerize it.
Run the static files on your host.
You will need to seed your mongoDB with an initial user. If you don't know your Google ID then perhaps the easiest way to find it is utilize the failedRequests collection. Try and connect to your server(fail because you aren't authorized yet) and then transfer that information over to your users collection.
Enjoy the show!
Of course you can! I initially made this tool primarily for myself, but have released it to the wild to help anyone. Take it, change it, morph it and squash it to your heart's desire.