Git Product home page Git Product logo

node-vue-template's Introduction

Node.js + Vue.js project template with TypeScript

This is a template for creating a SPA with Vue.js as a front-end and Node.js as a back-end. Current available features are:

  • Utilizing TypeScript for both front-end and back-end.
  • Code sharing between front-end and back-end.
  • A robust application state management build on top of Vuex.
  • SASS as a style sheet language with SCSS syntax.
  • Pre-configured vue-loader to support SFC with TypeScript and SCSS.
  • Fast loading with dynamic importing to support a loading progress for a large application.
  • Pre-configured BootstrapVue.
  • Runtime-only mode for Vue.js (no template compiler on the distributed JavaScript).
  • Supports both production and development mode on the front-end side.
  • Supports long-term caching on production mode.
  • Supports TypeScript debugging on both front-end and back-end. For front-end only supported when build in a development mode.
  • Shipped with configurations for Visual Studio Code for building and debugging both front-end and back-end out of the box.
  • Code snipped for Visual Studio Code for scaffolding the repetitive tasks.

Web browser requirements

  • Full ES2015 (ES6) supports.
  • Fetch API supports.

All modern browsers already supported both. So you should be fine as long as your target users does not come from the ancient world.

How to use

Just update the project name in package.json then execute:

npm install

Once finished you need to update the remote URL for Git with the following command:

git remote set-url origin URL

Now you are ready to go.

Getting started on development

To build from a command line, run:

npm run build

Once build is completed you can start a server by:

npm start

You can also build and debugging from Visual Studio Code. To build, select Run Build Task... from Terminal menu. To start debugging, select Start Debugging from Run menu.

Create a tarball for deployment

You can run the following command to create a distribution tarball:

npm pack

This will produce a PACKAGE_NAME-PACKAGE_VERSION.tgz in the project directory. It will include only required files to run the application (e.g. lib but not src). Please note the above command will not trigger the build processes so you need to build the project before you run it.

Before you can start the application that distributed with this method you need to run the following command in the extracted directory:

npm install

Now you can start the application with:

npm start

Deploy to production

The build process is in development mode by default. To build for a production you need to set NODE_ENV environment variable with value production. The server is also running in development mode by default too, which also using the same NODE_ENV to control which mode to run. The following will applied on production mode:

  • Assets for the client get minified.
  • No source map is generated for the client assets.
  • Vue.js is in production mode so Vue Devtools will not work.
  • The server will no longer serve the assets for the client. You need to use the other softwares for this job (e.g. NGINX).
  • npm install will not install development dependencies.

node-vue-template's People

Contributors

dependabot[bot] avatar ultimaweapon avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.