├── .gitignore ├── .npmrc ├── README.md ├── app.vue ├── components ├── Block.vue ├── BlockRenderer.vue ├── CoreImage.vue ├── CoreParagraph.vue ├── Post.vue └── TheHeader.vue ├── nuxt.config.ts ├── package-lock.json ├── package.json ├── pages ├── [...uri].vue └── index.vue ├── public └── favicon.ico └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | .nuxt 4 | .nitro 5 | .cache 6 | .output 7 | .env 8 | dist 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | strict-peer-dependencies=false 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nuxt 3 WordPress Starter 2 | 3 | This project is meant to be a flexible starting point for people interested in using [Nuxt 3](https://nuxt.com/) with WordPress as a headless CMS. If you want some additional resources to help get you started, check out the blog post and video linked below. 4 | 5 | [✍️ Read the step-by-step tutorial](https://wpengine.com/builders/headless-wordpress-with-nuxt-3-vue-3/) 6 | [📹 Watch the video]() 7 | 8 | ## Requirements 9 | - [WordPress](https://wordpress.org/) 10 | - [WPGraphQL](https://www.wpgraphql.com/docs/introduction) 11 | - Environment Variables 12 | 13 | Update the `wordpressUrl` variable in `nuxt.config.ts` to your WordPress site and run `npm run dev`: 14 | 15 | ``` 16 | export default defineNuxtConfig({ 17 | modules: [ 18 | '@nuxt/devtools', 19 | '@nuxtjs/tailwindcss' 20 | ], 21 | runtimeConfig: { 22 | public: { 23 | wordpressUrl: 'https://yourwordpresssite/graphql' 24 | } 25 | } 26 | }) 27 | 28 | ``` 29 | 30 | 31 | ## Headless WordPress Hosting with Atlas 32 | 33 | WP Engine's Atlas platform provides a performant and user-friendly hosting platform for headless WordPress and Node-based JavaScript apps. [Create a free sandbox account](https://wpengine.com/atlas/) to try the platform, and check out our Astro deployment guide for instruction to deploy to the platform. 34 | -------------------------------------------------------------------------------- /app.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /components/Block.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /components/BlockRenderer.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /components/CoreImage.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /components/CoreParagraph.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 14 | -------------------------------------------------------------------------------- /components/Post.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | {{ post.title }} 17 | {{ new Date(post.date).toLocaleDateString() }} 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /components/TheHeader.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | Nuxt WP 4 | 5 | -------------------------------------------------------------------------------- /nuxt.config.ts: -------------------------------------------------------------------------------- 1 | // https://nuxt.com/docs/api/configuration/nuxt-config 2 | export default defineNuxtConfig({ 3 | modules: [ 4 | '@nuxt/devtools', 5 | '@nuxtjs/tailwindcss' 6 | ], 7 | runtimeConfig: { 8 | public: { 9 | wordpressUrl: 'https://acfheadless.wpengine.local/graphql' 10 | } 11 | } 12 | }) 13 | 14 | 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "build": "nuxt build", 5 | "dev": "nuxt dev", 6 | "generate": "nuxt generate", 7 | "preview": "nuxt preview", 8 | "postinstall": "nuxt prepare", 9 | "start" : "node .output/server/index.mjs" 10 | }, 11 | "devDependencies": { 12 | "nuxt": "^3.2.3" 13 | }, 14 | "dependencies": { 15 | "@nuxt/devtools": "^0.2.5", 16 | "@nuxtjs/tailwindcss": "^6.4.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pages/[...uri].vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ data.title }} 6 | {{ new Date(data.date).toLocaleDateString() }} 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JEverhart383/nuxt-wordpress-starter/6d195feb27e6e3997d5f271bd0b9aa82265cf4fd/public/favicon.ico -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://nuxt.com/docs/guide/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | --------------------------------------------------------------------------------
{{ new Date(post.date).toLocaleDateString() }}