Skip to content

strogo/nhost-template

 
 

Repository files navigation

NHost Template for Nuxt

For detailed explanation on how things work, check out Nuxt.js docs.

NHost is cool. It's a PostgreSQL database with GraphQL, file storage, and authentication built in. You should check it out.

Preconfiguration

Apollo configuration

There is a configuration for apollo in plugins/apollo.js which adds the bearer token to websocket requests (for subscriptions).

Auth configuration

The authentication has a custom configuration provided by plugins/refreshScheme.js. This adds support for the JWT refresh scheme used by NHost.

There is also an auth configuration in plugins/auth.js which handles whether a user should be able to access a page.

Style configuration

This project is preconfigured with Tailwind. It's pretty awesome, but if you want to use something else, remove the tailwind dependencies and add something new.

Template setup

From Github, you can click on Use this template to create a new repository based on this one.

Alternatively, you can create a new repository from your terminal:

# Clone this repo
$ git clone https://github.com/MarcelloTheArcane/nhost-template -b master --single-branch <project-name>

# Enter the new directory
$ cd <project-name>

# Replace origin with your repository url
$ git remote set-url origin <git repository>

# Send this repository to the remote
$ git push --origin master

# Add template repository
$ git remote add template https://github.com/MarcelloTheArcane/nhost-template

Environment variables

Modify the .env file to use the urls from NHost. You will need to add urls for GraphQL and auth.

Getting started

# Install the dependencies
$ yarn

# Start the development server
$ yarn serve

To run in production, use the start command

$ yarn start

Updating from template

Fetch from the template remote. If you cloned via github, you will need to add the remote as above.

$ git fetch --all --allow-unrelated-histories

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 87.7%
  • Vue 12.3%