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
+20-7Lines changed: 20 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
This is a starter template created by [Wunder](https://www.wunder.io) for a decoupled website using the open-source [Next.js for Drupal](https://next-drupal.org/) project by [Chapter Three](https://www.chapterthree.com) and contributors.
4
4
5
+
> ⚠️⚠️ **Now using the App router in Next.js!** 🎉 If you prefer using the pages router, we have kept the old version in the `pages-router` branch.
6
+
5
7
## 🪂 Check out the running demo at https://next-drupal-starterkit.dev.wdr.io !
6
8
7
9
The aims of this template are:
@@ -97,6 +99,8 @@ DDEV has a single container for both the backend and frontend, so the URLs diffe
> NOTE: localhost:3000 does not work in DDEV, you need to use the URL provided by DDEV above.
103
+
100
104
You can get a more detailed list of all the services and their urls with the command:
101
105
102
106
```bash
@@ -109,7 +113,7 @@ We try to add to the template what we think are the most commonly requested feat
109
113
110
114
### Preview mode
111
115
112
-
The template is set up to allow editors to use [Preview mode](https://next-drupal.org/docs/reference/preview). Visit the node page on the Drupal side while the frontend is running to see a preview of the page.
116
+
The template is set up to allow editors to use [Draft mode](https://nextjs.org/docs/app/building-your-application/configuring/draft-mode). Visit the node page on the Drupal side while the frontend is running to see a preview of the page.
113
117
114
118
### On-demand revalidation
115
119
@@ -123,10 +127,10 @@ The Next.js site will then create the metatags using a combination of these two
123
127
### Search indexing and frontend search interface
124
128
125
129
The site is set up to work with Elasticsearch to provide a complete search experience.
126
-
The Lando setup includes spinning up an Elasticsearch instance with the required plugins. The content normalization and index handling is managed via the custom `wunder_search` module, which in turn makes use of the [Elasticsearch helper Drupal contrib module](https://www.drupal.org/project/elasticsearch_helper).
130
+
Both the Lando and DDEV setups include spinning up an Elasticsearch instance with the required plugins. The content normalization and index handling is managed via the custom `wunder_search` module, which in turn makes use of the [Elasticsearch helper Drupal contrib module](https://www.drupal.org/project/elasticsearch_helper).
127
131
On the frontend side, the search user uses the [Elastic UI library](https://elastic.github.io/eui/).
128
132
The frontend site queries Elasticsearch via a simple proxy controller in Drupal, also provided by the included `wunder_search` custom Drupal module.
129
-
The lando setup also includes [ElasticVue](https://elasticvue.com/), a tool to help you manage your Elasticsearch indexes.
133
+
The included frontend search UI is provided by [Searchkit](https://www.searchkit.co/).
130
134
131
135
### Importable demo content
132
136
@@ -152,7 +156,7 @@ If the backend is not available momentarily, the frontend will try again to call
152
156
153
157
### Frontend user authentication and registration
154
158
155
-
The template includes the setup to allow users to log into the Drupal backend from the Next.js frontend, using [Next-Auth](https://authjs.dev/).
159
+
The template includes the setup to allow users to log into the Drupal backend from the Next.js frontend, using [Auth.js](https://authjs.dev/).
156
160
157
161
- As an example, only registered users are allowed to post to the drupal `contact` webform, and parts of the interface in the frontend are available only for logged-in users.
158
162
- Some test users are imported as part of the content migration (check the `users.csv' file for the credentials).
@@ -172,10 +176,19 @@ When adding or modifying queries and fragments, the codegen script needs to be r
172
176
173
177
Note that when there are changes on the GraphQL server schema itself, you will need to stop and start the command again to fetch the new schema definition (it will keep watching your changed files, but will only re-fetch the schema from the server when the codegen command first runs). Also, you might need to run `lando drush cr` or `ddev drush cr` to clear the Drupal cache.
174
178
179
+
##### VSCode extensions to work with GraphQL and TypeScript
180
+
181
+
We have included a `.vscode/extensions.json` file that will suggest some useful extensions to work with GraphQL and TypeScript in VSCode with full autocomplete and syntax highlighting. You can install them by clicking on the notification that appears when you open the project in VSCode.
182
+
183
+
Please note:
184
+
1. We suggest opening the project in VSCode using the `/next` directory as the root of the project.
185
+
2. The latest version of the "GraphQL: Language Feature Support" extension [currently has a bug](https://github.com/graphql/graphiql/issues/3620) that prevents it from working correctly with the `graphql-codegen` package. Make sure to install the v0.9.3 version instead.
186
+
175
187
#### Typesafe environment variables
176
188
177
-
The environment variables used by the frontend are also checked for type safety. If used correctly, a Zod error will prevent the frontend from building if the environment variables are not set according to the schema defined in `next/env.ts`. To add a new environment variable:
189
+
The environment variables used by the frontend are also checked for type safety. If used correctly, a Zod error will prevent the frontend from building if the environment variables are not set according to the schema defined in `next/env.ts`.
178
190
191
+
To add a new environment variable:
179
192
1. Add it to `.lando.yml`, under services > node > overrides > environment. or to `.ddev/config.yaml` for DDEV.
180
193
2. Add it to `next/env.ts`. Note that it must be added twice there - once under server/client to define its schema, and once under `runtimeEnv` to read the actual value.
181
194
3. Import it in the file where it's used with `import { env } from "@/env";` and use it like `env.MY_ENV_VAR`. At this point, your environment variable should be working locally.
@@ -185,7 +198,7 @@ The environment variables used by the frontend are also checked for type safety.
185
198
186
199
The Next.js frontend will query the Drupal backend to generate a `/sitemap.xml` path that can be submitted to search engines.
187
200
188
-
### Testing with Cypress
201
+
### Testing with Cypress (Lando only)
189
202
190
203
The template includes example tests to be run with Cypress. The Lando setup includes a headless browser and Cypress, so you can run the tests locally without the need to install anything else, but it won't be able to use the visual Cypress application. See below for more details.
0 commit comments