⚠️ Yeah i know discord actually increased the limit to 25mb recently and thus this project is no longer relevant, but it sure was fun.⚠️
Discord bot to send powerful images
# Required
- The owner must add the bot to the server
# Once in any member can:
- Log in
- Choose the server and channel
- Select and send the image
Basically the file limit on discord prevent files bigger than 8mb to be uploaded, and that affects especially people with 4k monitors. So what ends up happening is that when i take a screenshot with half my screen size the result is usually around 10mb, thus discord blocks me from sending the image.
To work with discord i had to setup a backend due to sensitive keys that are required to work with discord api's
First the image is preprocessed with compressorJS on the frontend then it is send to the api where it is processed again and converted to webp and it's size its made sure to be less than 8mb with sharp
-Front end was made with spa in mind using viteJS, typescript and react-router
-State management and requests are handled with redux and reduxQuery
-For the UI, MaterialUI is used
Now the Real reason behind this project was to learn about infrastructure, and well i've deployed this project in three different ways that we can list here
-
- This was the first deploy, here i made it as fast as i could, so i set up a working
docker
image withexpress
running and serving every thing.
This strategy is just too expensive, but the deploy and maintenance is just too easy
- This was the first deploy, here i made it as fast as i could, so i set up a working
-
- Now it got serious, because now i had to provision and manage the vm, so still using the docker image i now also needed more stuff.
For example to open the right port with safety i usednginx
anddocker compose
But i also needed to provision and manage the machine, so for that i usedansible
, one script to provision and another to update the service.
This approach is definitely cheaper but also much much harder to do.
- Now it got serious, because now i had to provision and manage the vm, so still using the docker image i now also needed more stuff.
-
- And finally i decided to go serverless because it's simply cheap, and with the help of
serverless
, it was actually simple to deploy the api's
The webpage was also very easy to deploy using awss3
andcloudfront
combination
So considering the price that's basically free due to aws free tier, this is the deployment i choose to keep the project
- And finally i decided to go serverless because it's simply cheap, and with the help of
-
Ugly diagrammed ideas. here
-
initial spark