Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Updates

Copple800e7fbd627f
diff --git a/web/blog/basic-slack-clone-react-hooks.mdx b/web/blog/basic-slack-clone-react-hooks.mdx
index 3d5dc81224a..bab3fd42db9 100644
--- a/web/blog/basic-slack-clone-react-hooks.mdx
+++ b/web/blog/basic-slack-clone-react-hooks.mdx
@@ -35,7 +35,7 @@ We won't go over how to use Docker, but as long as you have it installed and run
This is a thorough guide that will step you through four useful technologies which can scale up to production-ready realtime applications:
- [PostgreSQL](https://www.postgresql.org) - an extremely scalable relational database
-- [Supabase](https://supabase.io) - a JS wrapper for Postgres that brings realtime functionality and instant RESTful APIs
+- [Supabase](https://supabase.io) - a JS wrapper for Postgres for instant realtime and RESTful APIs
- [Next.js](https://nextjs.org/) - a JS framework for building server-rendered React apps
- [Tailwind](https://tailwindcss.com/) - a CSS framework for quickly styling our frontend app
@@ -48,16 +48,14 @@ NextJs(Next.js)
Tailwind(Tailwind)
Supabase-->NextJs-->Supabase
Postgres-->Supabase-->Postgres
-NextJs---Tailwind
+NextJs-.-Tailwind
subgraph Frontend
NextJs
Tailwind
end
-subgraph Middleware
-Supabase
-end
-subgraph Data Layer
+subgraph Backend
Postgres
+Supabase
end
`}
/>
@@ -65,6 +63,12 @@ end
## Initialising the app
+
+<div className="alert alert--warning" role="alert">
+All the code for this section can be found in ...
+</div>
+
+
### Create the application
We will create a new Next.js app called `slack-clone-basic`, using the [Next.js SASS example](https://github.com/zeit/next.js/tree/master/examples/with-next-sass) to get us started:
@@ -100,12 +104,43 @@ language="bash"
### Setup all the files
+```bash
+mkdir components && touch components/{Layout.js,Message.js,MessageInput.js} && \
+mkdir db && touch db/schema.sql && \
+mkdir lib && touch lib/{Store.js,UserContext.js} && \
+touch pages/{_app.js,[channelId].js} && \
+touch docker-compose.yml
```
-mkdir -p lib/2 && touch lib/{store.js,helpers.js}
+
+You will now have the following boilerplate, ready to fill in with code.
+
+```bash
+├── components
+│   ├── Layout.js # Page Layout
+│   ├── Message.js # Individual Messages
+│   └── MessageInput.js # The text input for writing new messages
+├── db
+│   └── schema.sql # Basic schema and dummy data
+├── lib
+│   ├── Store.js # A basic data store using React Hooks
+│   └── UserContext.js # Passes the logged in user to the App
+├── next.config.js
+├── pages
+│   ├── _app.js # We will wrap our app with the logged in user
+│   ├── [channelId].js # Page for showing all the messages in a channel
+│   └── index.js # Login page
+├── styles
+│   └── style.scss # SASS file for styling our app
+└── docker-compose.yml # Docker compose for Postgres and Supabase
```
+By now you can get a simle app running
+
+```
+npm install && npm run dev
+```
-## Creating the database and APIs
+## Creating the Backend
### Setting up Postgres
@@ -148,7 +183,7 @@ language="sql"
This is the easiest step of all - you don't have to do anything. Supabase will introspect your database and provide you with APIs and websockets.
-### Fire up the backend
+### Fire up the Backend
Create the following file:
@@ -160,13 +195,15 @@ language="yml"
Now run `docker-compose up`
-----
+## Setting up the front end
-## Setting up the front end
+<div className="alert alert--warning" role="alert">
+All the code for this section can be found in ...
+</div>
```bash
@@ -190,15 +227,25 @@ code={Snippets.store1}
language="js"
/>
+## Adding basic logins
+
+<div className="alert alert--warning" role="alert">
+All the code for this section can be found in ...
+</div>
## Making it look like Slack
-Tailwind
-## Adding basic login
+<div className="alert alert--warning" role="alert">
+All the code for this section can be found in ...
+</div>
-React context
+
+Tailwind
## Wrapping up
+You now have a realtime application. The combination of Docker + Postgres + Supabase made it quick and easy to get going on our local machines so that we could spend most of the time building the product.
+If you liked this tutorial, make sure to sign up for [Supabase](http://supabase.io) as we continue to bring all the functionality of Firebase to Postgres.
+
diff --git a/web/package-lock.json b/web/package-lock.json
index 35c21cc3e65..1e0ef1c0ae1 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -4993,7 +4993,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -5011,11 +5012,13 @@
},
"balanced-match": {
"version": "1.0.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -5028,15 +5031,18 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -5139,7 +5145,8 @@
},
"inherits": {
"version": "2.0.4",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -5149,6 +5156,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -5161,17 +5169,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -5188,6 +5199,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -5268,7 +5280,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -5278,6 +5291,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -5353,7 +5367,8 @@
},
"safe-buffer": {
"version": "5.1.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -5383,6 +5398,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -5400,6 +5416,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -5438,11 +5455,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
},
@@ -12541,7 +12560,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -12559,11 +12579,13 @@
},
"balanced-match": {
"version": "1.0.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -12576,15 +12598,18 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -12687,7 +12712,8 @@
},
"inherits": {
"version": "2.0.4",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -12697,6 +12723,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -12709,17 +12736,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -12736,6 +12766,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -12816,7 +12847,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -12826,6 +12858,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -12901,7 +12934,8 @@
},
"safe-buffer": {
"version": "5.1.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -12931,6 +12965,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -12948,6 +12983,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -12986,11 +13022,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
},
@@ -13540,7 +13578,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -13558,11 +13597,13 @@
},
"balanced-match": {
"version": "1.0.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -13575,15 +13616,18 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -13686,7 +13730,8 @@
},
"inherits": {
"version": "2.0.4",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -13696,6 +13741,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -13708,17 +13754,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -13735,6 +13784,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -13815,7 +13865,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -13825,6 +13876,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -13900,7 +13952,8 @@
},
"safe-buffer": {
"version": "5.1.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -13930,6 +13983,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -13947,6 +14001,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -13985,11 +14040,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
},