DEV Community

Cover image for Disco.pics - Free and open source image hosting service
Dhravya
Dhravya

Posted on

Disco.pics - Free and open source image hosting service

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

GitHub logo discopics / disco.pics

An image hosting service with all the customisation you need

This project has been discontinued. Use at your own risk


Disco.pics

Fast image hosting made easy.

Main page

Embed builder

Overview video

Here's a short video that explains the project and how it uses Redis:

[Insert your own video here, and remove the one below]

Disco.pics

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

Additional Resources / Info

OGIMG

Main page

Embed builder

Collaborators

@yxsh


Top comments (0)