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

update nextjs guides #8281

Open
wants to merge 99 commits into
base: master
Choose a base branch
from
Open

update nextjs guides #8281

wants to merge 99 commits into from

Conversation

beerose
Copy link
Member

@beerose beerose commented Jan 30, 2025

Since we will have a new quickstart tutorial for building apps with Next.js, I merged our two existing Next.js tutorials into a short guide showing the setup and basics of using EdgeDB with Next.

related PR: https://github.com/edgedb/edgedb.com/pull/955

@beerose beerose requested a review from scotttrinh January 31, 2025 15:48
@beerose beerose changed the base branch from master to new-gel-docs February 19, 2025 14:30
Create an API route and fetch data from the client side:

.. code-block:: tsx
:caption: pages/api/posts.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update this to be an app-router Route Handler, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking to have two options there - with app router and with pages router. I'll make it clear in the title.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to support the pages router still? There is nothing particularly special about this code, and if we show an app router Route Handler, it should be pretty easy for someone two write the equivalent pages router API route, I would think.

Deployment
-----------

First, add a ``prebuild`` script to your ``package.json`` to generate the query builder during deployment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this to gel.toml hooks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But don't we need this, too? So that t works with a cloud provider when building the app. As I understand, the hooks will work after applying the migration etc, so if I deploy to e.g. Vercel and connect to the Cloud with env variables, it won't run the generator.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good point, we should do both. We probably need some additional direction to get it to even work during deployment since it needs access to a live database. I think it works fine in the Vercel integration which I'm pretty sure sets the EDGEDB_INSTANCE and EDGEDB_SECRET_KEY environment variables correctly.

Maybe this section should be merged into the sections below?

Using EdgeDB in Next.js
-----------------------

EdgeDB with React Server Components (App Router)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we show both server components and server actions?

Copy link

github-actions bot commented Feb 19, 2025

Docs preview deploy

❌ Docs preview deployment failed for commit d7339b2:

https://edgedb-docs-9bl28msen-edgedb.vercel.app

(Last updated: Feb 19, 2025, 17:15:47 UTC)

Base automatically changed from new-gel-docs to master February 21, 2025 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants