Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move to (io)redis #385

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ NEXT_PUBLIC_CLERK_SIGN_UP_URL='/sign-up'
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL='/app'
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL='/app'

# Upstash Redis
UPSTASH_REDIS_REST_URL=<your-upstash-rest-url>
UPSTASH_REDIS_REST_TOKEN=<your-upstash-rest-token>
# Redis URL
# Example: redis://localhost:6379
REDIS_URL=

# Resend
RESEND_API_KEY=<your-resend-api-key>
5 changes: 2 additions & 3 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ jobs:
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL: '/app'
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL: '/app'

# Upstash
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
# Redis
REDIS_URL: ${{ secrets.REDIS_URL }}

# Resend
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ jobs:
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL: '/app'
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL: '/app'

# Upstash
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
# Redis
REDIS_URL: ${{ secrets.REDIS_URL }}

# Resend
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The Tech Stack:
- [ShadCN UI](https://ui.shadcn.com)
- [NeonDB](https://neon.tech)
- [Clerk Auth](https://clerk.dev/)
- [Upstash](https://upstash.com)
- [Redis](https://redis.io/)
- [Resend](https://resend.com)

Development stuff:
Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ words:
- tseslint
- typecheck
- Uploadthing
- Upstash
- healthcheck
- timeago
- usehooks
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"@trpc/client": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
"@upstash/redis": "^1.34.0",
"@vercel/analytics": "^1.3.1",
"@vercel/speed-insights": "^1.0.12",
"class-variance-authority": "^0.7.0",
Expand All @@ -85,6 +84,7 @@
"drizzle-zod": "^0.5.1",
"framer-motion": "^11.5.2",
"geist": "^1.3.1",
"ioredis": "^5.4.1",
"jiti": "^1.21.6",
"lucide-react": "^0.438.0",
"next": "14.2.8",
Expand Down
5 changes: 2 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ export const env = createEnv({
// Neon DB
DATABASE_URL: z.string().url(),

// Upstash
UPSTASH_REDIS_REST_URL: z.string(),
UPSTASH_REDIS_REST_TOKEN: z.string(),
// Redis
REDIS_URL: z.string(),

// Resend
RESEND_API_KEY: z.string(),
Expand Down
8 changes: 2 additions & 6 deletions src/lib/redis.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { Redis } from '@upstash/redis';

import { env } from '@/env';
import Redis from 'ioredis';

export const redis = new Redis({
url: env.UPSTASH_REDIS_REST_URL,
token: env.UPSTASH_REDIS_REST_TOKEN,
});
export const redis = new Redis(env.REDIS_URL);
7 changes: 3 additions & 4 deletions src/server/trpc.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { db } from '@/db';
import { redis } from '@/lib/redis';
import { resend } from '@/lib/resend';
import { currentUser } from '@clerk/nextjs/server';
import { initTRPC, TRPCError } from '@trpc/server';
import superjson from 'superjson';
import { ZodError } from 'zod';

import { db } from '@/db';
import { resend } from '@/lib/resend';
import { redis } from '@/lib/redis';

export const createTRPCContext = (opts: { headers: Headers }) => {
return {
db,
Expand Down
Loading