/realworld-nuxtjs

Primary LanguageJavaScriptMIT LicenseMIT

Nuxt.js example

This repository will help you to start with Nuxt.js.

Core principles:

  • Server Side Rendering
  • AntDesign (like Bootstrap or Material)
  • Auth0
  • I18n (translations)
  • Errors handling
  • Tests (TU & E2E)
  • SEO
  • Common plugins (lodash, vee-validate, vee-lazyload)

Feel free copy/paste code from this repository. It's MIT licenced.

Don't start your projects from it, prefer create-nuxt-app, it's a great tool!

Build Setup

Add an env file

This repository uses .env files for configuration. Copy paste the following lines in a file named .env in the root directory.

BASE_URL=http://realworld.nuxtjs.com:3333

# Auth0
AUTH0_DOMAIN=# Example: nuxt-js.eu.auth0.com
AUTH0_CLIENT_ID=# Example: gI6lVM0y2HqwgBI5ujO9YmGyt4y3yPhU

Auth0 (facultative)

First, create a tenant at Auth0. Then, create an application (Regular Web Application) and specify AUTH_* environment variables in .env file.

More info here about the application configuration.

Define local dns (facultative)

Add the local dns realworld.nuxtjs.com.

$ sudo vi /etc/hosts

Example: 127.0.0.1 localhost realworld.nuxtjs.com

If you want to change the local dns name, don't forget to edit BASE_URL environment variable in .env file.

Time to launch mate!

# install dependencies
$ yarn

# serve with hot reload at localhost:3333
$ yarn dev

# build for production and launch server
$ yarn build && yarn start

You can access the project locally at : localhost:3333 or realworld.nuxtjs.com:3333 if you defined the local dns.

Used dependencies

Dependencies configuration

robots.txt

Two possible configurations are implemented in this repo: with the robots.txt module and with static files.

Static files config: all included files are automatically served by Nuxt and are accessible through your project root URL. (static/robots.txt will be available at localhost:3000/robots.txt).

Nuxt Robots.txt module: inject a middleware to generate a robots.txt file. The JS translation of static/robots.txt file is available in config/modules/robots.js.

In both cases, if you do not use a sitemap, don't forget to remove it from the robots.txt.

Awesome repositories

To find nice dependencies, don't forget to check these repositories:

License

MIT License

Copyright (c) Romain POUSSIER