Disco.pics – Free and open source image hosting service

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

GitHub logo

discopics
/
disco.pics

An image hosting service that uses discord’s CDN to store the images

Disco.pics

Fast image hosting made easy.

OGIMG

Main page

Embed builder

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

OGIMG

Main page

Embed builder

Collaborators

@yxsh

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
file-validation-in-python-much-easier-and-more-reliable

file validation in python Much easier and more reliable

Next Post
i-built-an-online-collaborative-canvas-using-redis-as-my-primary-database-

I Built an Online Collaborative Canvas using Redis as my Primary Database 🎨

Related Posts
5章5

5章5

このJavaコードのスニペットには、ItemクラスとMainクラスの2つのクラスが含まれています。ItemクラスにはnameというString型の変数とpriceというint型の変数があり、priceは100に初期化されています。 Mainクラスにはmainメソッドがあり、ここでプログラムが実行されます。mainメソッドはItemオブジェクトの配列itemsを作成し、その長さを3に設定します。その後、整数型の変数totalを0で初期化し、forループを使用して各Itemオブジェクトのpriceをtotalに加算します。 しかし、このコードにはItemオブジェクトを実際にitems配列に割り当てるコードがありません。つまり、items配列にはデフォルトでnullが設定されているため、Itemのインスタンスが存在せず、items[i].priceを参照しようとするとNullPointerExceptionが発生します。 そのため、選択肢E「実行時に例外がスローされる」という答えが正しいです。Itemオブジェクトがitems配列に割り当てられていないため、forループの実行時にnullのpriceにアクセスしようとして例外がスローされます。 コードにコメントを加えて説明すると以下のようになります: public class Item { String name; // 商品名を保存する変数 int price = 100; //…
Read More