Skip to content

VueJS Express Nuxt.js Sequelize based server/client boilerplate

License

Notifications You must be signed in to change notification settings

yogesum/vue-express-sequelize-base

Repository files navigation

Vue Express Sequelize base

Prerequisite

  • Node.js: >=8.4.0 and npm: >=5.3.0
  • MySQL|MariaDB: >=5.7.0

Configure

For application config use node-config with toml files

create config/local-development.toml for development config

# config/local-development.toml
env = "development"

[db]
username = "dbuser"
password = "dbpass"
database = "dbname"

Development

# install dependencies
npm install
# create database table and seed with data
npm run migration

# run development server
npm run dev

# for debugging
npm run dev:inspect

Migrations

Sequelize cli is used to generate migrations and seeder files

  • create database: ./node_modules/.bin/sequelize db:create
  • Auto generate model and migration file
# Generate Task model
mkdir server/api/task

./node_modules/.bin/sequelize model:generate\
  --models-path server/api/task --name Task\
  --attributes name:STRING,description:TEXT,startAt:DATE,endAt:DATE,completedAt:DATE
  • Run migration: ./node_modules/.bin/sequelize db:migrate
  • for more see this

References

  1. Nuxt.js - server-side rendering
  2. Element-UI - ui library
  3. Sequelize - mysql orm
  4. Passport.js - authentication library
  5. node-config - application configuration
  6. TOML - configuration files