Skip to content

Commit

Permalink
Update README.md (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamgriffiths authored Aug 22, 2024
1 parent 87767d1 commit 042607a
Showing 1 changed file with 17 additions and 26 deletions.
43 changes: 17 additions & 26 deletions basics/streaming/typescript/quotes-nextjs/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Simple NextJS Example

## Getting Started
This project is an example that creates a simple NextJS web app that demonstrates streaming an LLM response from a route handler to a client component.

First, run the development server:
```sh
# install the dependencies (substrate)
npm install

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
# set your Substrate API Key
export SUBSTRATE_API_KEY=<your-api-key>

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More
# run the server
npm run dev

To learn more about Next.js, take a look at the following resources:
# view the page
open http://localhost:3000
```

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
## About the project

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
### `app/quote/route.ts`

## Deploy on Vercel
This file contains the route handler used to fetch the LLM response from Substrate. We're using the route handler here so that we can produce an event-stream for our client code to consume.

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
### `app/Example.tsx`

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
This file contains our client component with a UI for fetching the stream from our route handler and rendering the stream chunks as they arrive.

0 comments on commit 042607a

Please sign in to comment.