Fast image hosting made easy.
Here's a short video that explains the project and how it uses Redis:
[Insert your own video here, and remove the one below]
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.
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.
- Node - v16.14.0
- pnpm (7.3.0) / NPM
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
This project is licensed under the MIT license.
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.
- Sign up for a free Redis Cloud account using this link and use the Redis Stack database in the cloud.
- Based on the language/framework you want to use, you will find the following client libraries:
- Redis OM .NET (C#)
- Watch this getting started video
- Follow this getting started guide
- Redis OM Node (JS)
- Watch this getting started video
- Follow this getting started guide
- Redis OM Python
- Watch this getting started video
- Follow this getting started guide
- Redis OM Spring (Java)
- Watch this getting started video
- Follow this getting started guide
- Redis OM .NET (C#)
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:
- Developer Hub - The main developer page for Redis, where you can find information on building using Redis with sample projects, guides, and tutorials.
- 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.
- Redis Rediscover - Provides use-cases for Redis as well as real-world examples and educational material
- 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
- Youtube Videos
- Official Redis Youtube channel
- Redis Stack videos - Help you get started modeling data, using Redis OM, and exploring Redis Stack
- Redis Stack Real-Time Stock App from Ahmad Bazzi
- Build a Fullstack Next.js app with Fireship.io
- Microservices with Redis Course by Scalable Scripts on freeCodeCamp