You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-18Lines changed: 31 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Building a Realtime Chat App with Next.js, Ably, and Vercel
1
+
# Building a Realtime Chat App with Next.js, Ably, and Netlify
2
2
3
3
Live example at: <https://next-js-chat-app.vercel.app>
4
4
@@ -18,20 +18,22 @@ It demonstrates the use of:
18
18
19
19
The project uses the following components:
20
20
21
-
-[Next.js](https://nextjs.org/) is a React framework from [Vercel](https://vercel.com/). It is used to build static web applications with server side rendering, serverless functions and seamless hosting. It's a framework that takes the React knowledge you already have, and puts some structure and conventions in place.
21
+
-[Next.js](https://nextjs.org/) is a React framework used to build static web applications with server side rendering, serverless functions and seamless hosting. It's a framework that takes the React knowledge you already have, and puts some structure and conventions in place.
22
22
23
23
-[Ably](https://ably.com/) is realtime, pub/sub messaging platform with a suite of integrated services to deliver complete realtime functionality directly to end-users.
24
24
25
-
-[Vercel](https://vercel.com/) is a hosting platform, built from the ground up to host Next.js apps, and Serverless Functions with them.
25
+
-[Netlify](https://netlify.com/) is a hosting platform that provides continuous deployment, serverless functions, and a global CDN for modern web projects.
26
26
27
27
-[React](https://reactjs.org/) is a JavaScript library for building user interfaces with encapsulated components that manage their own state.
28
28
29
+
-[TypeScript](https://www.typescriptlang.org/) is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
30
+
29
31
## What are we going to build?
30
32
31
-

32
-
*The UI of the app we'll build with this walkthrough*
33
+

34
+
*The UI of the app we'll build with this walkthrough*
33
35
34
-
We'll build a realtime chat app that runs in the browser. It will be built upon the Next.js [create-next-app](https://nextjs.org/docs/api-reference/create-next-app) template, it will contain a React component which will use Ably to send and receive messages. We'll also write a Next.js serverless function which will be used to connect to Ably.
36
+
We'll build a realtime chat app that runs in the browser. It will be built upon the Next.js [create-next-app](https://nextjs.org/docs/api-reference/create-next-app) template, it will contain a React component which will use Ably to send and receive messages. We'll also write a serverless function which will be used to authenticate the client with Ably.
35
37
36
38
## Building & running locally
37
39
@@ -40,8 +42,8 @@ We'll build a realtime chat app that runs in the browser. It will be built upon
40
42
In order to build and deploy this app, you will need:
41
43
42
44
-**An Ably account** for sending messages: [Create an account with Ably for free](https://ably.com/signup).
43
-
-**A Vercel Account** for hosting on production: [Create an account with Vercel for free](https://vercel.com/signup).
44
-
-**Node 16** or greater: [Install Node](https://nodejs.org/en/).
45
+
-**A Netlify Account** for hosting on production: [Create an account with Netlify for free](https://netlify.com/signup).
46
+
-**Node 20** or greater: [Install Node](https://nodejs.org/en/).
45
47
46
48
You'll also need an API key from Ably to authenticate with the Ably Service. To get an API key, once you have [created an Ably account](https://ably.com/signup):
3. Run `npm run netlify:dev` to start the Netlify development server.
64
+
65
+
The Netlify development server will spin up and you'll see a demo chat application.
66
+
67
+
> Note: You can also use `npm run dev` to run just the Next.js development server without Netlify functions, but for the full experience with serverless functions, use `npm run netlify:dev`.
68
+
69
+
### TypeScript Support
70
+
71
+
This project uses TypeScript for type safety. Here are some useful commands for TypeScript development:
72
+
73
+
-`npm run type-check`: Run TypeScript's type checker without emitting files
74
+
-`npm run dev`: The Next.js development server automatically type-checks your code as you develop
62
75
63
-
The Next.js dev server will spin up and you'll see a demo chat application.
76
+
When creating new components or functions, use the `.tsx` extension for React components and `.ts` for plain TypeScript files. The project is configured with a `tsconfig.json` file that provides sensible defaults for Next.js TypeScript projects.
64
77
65
-
## Hosting on Vercel
78
+
## Hosting on Netlify
66
79
67
-
We're using `Vercel` as our development server and build pipeline.
80
+
We're using `Netlify` as our development server and build pipeline.
68
81
69
-
> The easiest way to deploy Next.js to production is to use the Vercel platform from the creators of Next.js. Vercel is an all-in-one platform with Global CDN supporting static & Jamstack deployment and Serverless Functions.
> Netlify is a powerful platform for building, deploying, and managing modern web projects. It provides continuous deployment, serverless functions, and a global CDN.
0 commit comments