Using the create-key-5-app we can create a boilerplate template for our Nuxt-Keystone app. It automatically configure the folder structure, pacakge.json and src folder where our regular Nuxt app resides.

Also there is a index.js file which is the entry point to the app. We can set up the project manually and then add scripts, dependencies, entry point file, index.js.

Keystone and index.js

@kestonejs/nuxt-app works through the configuration specified in the export. We can use the config object for specify nuxt configurations such as middleware, plugins, env etc.

//as object
....
const config = {
  srcDir: 'src/',
  buildDir: 'dist',
  env:{
    URI:process.env.API
  },
  router:{
    middleware:'Identity'
  },
   buildModules:['@nuxtjs/tailwindcss'],      
  components:true
 
};

module.exports = {
 keystone,
 apps: [new GraphQLApp(), new AdminUIApp(), new NuxtApp(config)],
};

Or we can prepare our nuxt.config as follows and import @ keystone index.js file as follows

//nuxt.config.js
require('dotenv').config()
const config= {
 srcDir: 'src/',
 buildDir: 'dist',
 router: {
   middleware: 'Identity'
},
 
 target: 'static',  
 
 env:{
   URI:proccess.env.API
},
 ....
}
module.exports =config;
//index.js
....
const config= require("./nuxt.config")

module.exports = {
 keystone,
 apps: [new GraphQLApp(), new AdminUIApp(), new NuxtApp(config)],
};

Following Keystone post may help you learn more


This free site is ad-supported. Learn more