Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

discopics/disco.pics

Repository files navigation

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, 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 to add/retrieve the data.

How to run it locally?

Prerequisites

  • Node - v16.14.0
  • pnpm (7.3.0) / NPM

Local installation

Clone the repository, install packages and enter the environment variables.

git clone https://github.com/discopics/disco.pics

pnpm i 
// or
npm i

pnpm dev

Environment variables:

All these environment variables are required to run the app.

NEXTAUTH_SECRET
NEXTAUTH_URL
# Next Auth Discord Provider
DISCORD_CLIENT_ID
DISCORD_CLIENT_SECRET
DISCORD_TOKEN
DISCORD_IMAGES_CHANNEL_ID
# Redis credentials
REDIS_URL

Deployment

Deploy with Vercel

LICENSE

This project is licensed under the MIT license.

More Information about Redis Stack

Here some resources to help you quickly get started using Redis Stack. If you still have questions, feel free to ask them in the Redis Discord or on Twitter.

Getting Started

  1. Sign up for a free Redis Cloud account using this link and use the Redis Stack database in the cloud.
  2. Based on the language/framework you want to use, you will find the following client libraries:

The above videos and guides should be enough to get you started in your desired language/framework. From there you can expand and develop your app. Use the resources below to help guide you further:

  1. Developer Hub - The main developer page for Redis, where you can find information on building using Redis with sample projects, guides, and tutorials.
  2. Redis Stack getting started page - Lists all the Redis Stack features. From there you can find relevant docs and tutorials for all the capabilities of Redis Stack.
  3. Redis Rediscover - Provides use-cases for Redis as well as real-world examples and educational material
  4. RedisInsight - Desktop GUI tool - Use this to connect to Redis to visually see the data. It also has a CLI inside it that lets you send Redis CLI commands. It also has a profiler so you can see commands that are run on your Redis instance in real-time
  5. Youtube Videos