@upstash/react-redis-browser 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # RedisBrowser for Upstash Redis
2
+
3
+ `@upstash/react-redis-browser` is a React component that provides a UI for browsing and editing data in your Upstash Redis instances. It’s easy to set up and integrate into your React applications. This guide will help you get started with the installation and basic usage.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Install](#1-install)
8
+ - [Configuration](#2-configuration)
9
+ - [Usage](#3-usage)
10
+
11
+ ## 1. Install
12
+
13
+ Install the databrowser component via npm:
14
+
15
+ ```sh-session
16
+ $ npm install @upstash/react-redis-browser
17
+ ```
18
+
19
+ ## 2. Configuration
20
+
21
+ ### Environment Variables
22
+
23
+ Configure your Upstash Redis REST URL and token as environment variables:
24
+
25
+ ```sh-session
26
+ NEXT_PUBLIC_UPSTASH_REDIS_REST_URL=YOUR_REDIS_REST_URL
27
+ NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN=YOUR_REDIS_REST_TOKEN
28
+ ```
29
+
30
+ ## 3. Usage
31
+
32
+ ### Creating the Data Browser Component
33
+
34
+ In your React application, create a new component that will utilize @upstash/react-redis-browser.
35
+
36
+ Here's a basic example of how to use the component:
37
+
38
+ ```tsx
39
+ import { RedisBrowser } from "@upstash/react-redis-browser"
40
+
41
+ import "@upstash/react-redis-browser/dist/index.css"
42
+
43
+ export default function RedisBrowserDemo() {
44
+ const redisUrl = process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL
45
+ const redisToken = process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN
46
+
47
+ return (
48
+ <main style={mainStyle}>
49
+ <div style={divStyle}>
50
+ <RedisBrowser token={redisToken} url={redisUrl} />
51
+ </div>
52
+ </main>
53
+ )
54
+ }
55
+
56
+ const mainStyle = {
57
+ height: "100vh",
58
+ width: "100vw",
59
+ display: "flex",
60
+ alignItems: "center",
61
+ justifyContent: "center",
62
+ flexDirection: "column",
63
+ background: "rgb(250,250,250)",
64
+ }
65
+
66
+ const divStyle = {
67
+ height: "100%",
68
+ width: "100%",
69
+ maxHeight: "45rem",
70
+ maxWidth: "64rem",
71
+ borderRadius: "0.5rem",
72
+ overflow: "hidden",
73
+ }
74
+ ```