Overview of My Submission
I’m a huge fan of discord, and use it to communicate with my friends, family and teammates.
One day, a friend of mine told me how he has made a channel just to store and organize his images at one place.
All attachments uploaded to discord have a link automatically generated. These links are shareable, but they are really long.
Discord has a very high-speed content delivery network (CDN) powered by Cloudflare.
All of this made us think, “Why not create an image hosting that uses discord’s CDN?”
And that’s exactly what we did!
But this needed to be BLAZINGLY fast. We wanted to make a good image hosting, with custom embed support, an API, etc.
This would mean, we have to fetch from the database every time someone loads an image. Redis was the perfect choice for us.
Submission Category:
Wacky Wildcards!
Overview video
Language Used
Typescript
Link to Code

discopics
/
disco.pics
An image hosting service that uses discord’s CDN to store the images
Disco.pics
Fast image hosting made easy.
How it works
How the data is stored
There are two different schemas, the User and Image schema.
For each user, this is the information that is stored:
- id: string
- email: string
- created_at: date
- token_number: number
- embed_title: string
- embed_site_name: string
- embed_site_url: string
- embed_colour: string
- embed_author_name: string
- embed_desc: string
here, the ID is indexed, so we can find users by their ID.
The Image schema is the information that is stored for each image:
- uploaded_by: string
- slug: string
- img_url: string
- uploaded_at: date
Here, slug and uploaded_by are indexed.
Whenever someone visits the /[slug] route, the Image schema is queried for the image with the slug.
Then, using the uploaded_by, embed information is queried from the User schema.
How the data is accessed
All data is retrieved using redis-om package. The frontend makes requests through the /api routes. Then, the backend accesses functions from lib/redis.ts…
Additional Resources / Info
Collaborators
- Check out Redis OM, client libraries for working with Redis as a multi-model database.
- Use RedisInsight to visualize your data in Redis.
- Sign up for a free Redis database.


