All Projects â†’ slanatech â†’ Vue Monorepo Boilerplate

slanatech / Vue Monorepo Boilerplate

Licence: mit
Vue Fullstack App Monorepo Boilerplate

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Monorepo Boilerplate

Nestjs Bff
A full-stack TypeScript solution, and starter project. Includes an API, CLI, and example client webapp. Features include production grade logging, authorization, authentication, MongoDB migrations, and end-to-end testing.
Stars: ✭ 450 (+230.88%)
Mutual labels:  lerna, fullstack, boilerplate
Stator
Stator, your go-to template for the perfect stack. 😍🙏
Stars: ✭ 217 (+59.56%)
Mutual labels:  fullstack, boilerplate, monorepo
Suicrux
🚀 Ultimate universal starter with lazy-loading, SSR and i18n. [not maintained]
Stars: ✭ 958 (+604.41%)
Mutual labels:  fullstack, boilerplate
React Native Web Template
Template project for sharing code between iOS, Android & Web using monorepo
Stars: ✭ 45 (-66.91%)
Mutual labels:  boilerplate, monorepo
Fullstack Apollo React Boilerplate
💥A sophisticated Apollo in React boilerplate project.
Stars: ✭ 136 (+0%)
Mutual labels:  fullstack, boilerplate
Lerna Yarn Workspaces Example
How to build TypeScript mono-repo project with yarn and lerna
Stars: ✭ 787 (+478.68%)
Mutual labels:  lerna, monorepo
Vue Stack
Minimalistic Boilerplate for FullStack Express and Vue.js applications
Stars: ✭ 26 (-80.88%)
Mutual labels:  fullstack, boilerplate
Fullstack Apollo Express Postgresql Boilerplate
💥 A sophisticated GraphQL with Apollo, Express and PostgreSQL boilerplate project.
Stars: ✭ 1,079 (+693.38%)
Mutual labels:  fullstack, boilerplate
Ultra Runner
🏃⛰ Ultra fast monorepo script runner and build tool
Stars: ✭ 496 (+264.71%)
Mutual labels:  lerna, monorepo
Flow Mono Cli
A command line interface that aims to solve a few issues while working with flow typed codebases in a mono-repo.
Stars: ✭ 84 (-38.24%)
Mutual labels:  lerna, monorepo
Vitamin Web
Decathlon Design System libraries for web applications
Stars: ✭ 70 (-48.53%)
Mutual labels:  lerna, monorepo
Oh My Fullstack
🚀 Full stack web application skeleton (Next.js, Redux, RxJS, Immutable, Express)
Stars: ✭ 99 (-27.21%)
Mutual labels:  fullstack, boilerplate
React Native Web Monorepo
Code sharing between iOS, Android & Web using monorepo
Stars: ✭ 697 (+412.5%)
Mutual labels:  boilerplate, monorepo
Lerna
Splitting up large codebases into separate independently versioned packages is extremely useful for code sharing. However, making changes across many repositories is messy and difficult to track, and testing across repositories becomes complicated very quickly.
Stars: ✭ 31,079 (+22752.21%)
Mutual labels:  lerna, monorepo
Angular6 Monorepo Experiment
A monorepo experiment using Angular-CLI and Lerna
Stars: ✭ 15 (-88.97%)
Mutual labels:  lerna, monorepo
Lerna Changelog
📖 PR-based changelog generator with monorepo support
Stars: ✭ 611 (+349.26%)
Mutual labels:  lerna, monorepo
Pectin
Rollup-related tools for incremental transpilation of packages in Lerna-based monorepos
Stars: ✭ 50 (-63.24%)
Mutual labels:  lerna, monorepo
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (-16.18%)
Mutual labels:  lerna, monorepo
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+237.5%)
Mutual labels:  lerna, monorepo
Eslint Plugin Monorepo
ESLint Plugin for monorepos
Stars: ✭ 56 (-58.82%)
Mutual labels:  lerna, monorepo

vue-monorepo-boilerplate

Build Status

Vue Fullstack App Monorepo Boilerplate

  • Lerna and Yarn Workspaces to manage monorepo
  • Full Stack: Front End, Server, Common module packages
  • Front End package: Vue SPA using Vue-cli 3
  • Server package: Node+Express
  • Common package: common code used in both Front End and Server
  • Docs using Vuepress and Github pages
  • CI/CD using Travis CI
  • Docker build

Prerequisites

This boilerplate uses Lerna and Yarn workspaces to manage packages in monorepo. vue-cli is used in UI package. Suggest to install Lerna, Yarn and vue-cli globally in dev environment

Quick start

# 1. Clone the repository.
git clone https://github.com/slanatech/vue-monorepo-boilerplate.git my-new-project

# 2. Enter your newly-cloned folder
cd my-new-project

# 3. Bootstrap
yarn run bootstrap

# 4. Run Build in all packages 
yarn run build

# 5. Dev: Run Server and in parallel start UI Serve with hot reload 
yarn run dev

Top-Level Scripts

  "scripts": {
    "bootstrap": "lerna bootstrap",
    "dev": "concurrently --kill-others --success first \"npm start --prefix ./packages/server\" \"npm run serve --prefix ./packages/ui\"",
    "test": "npm run test:common && npm run test:server && npm run test:ui",
    "test:common": "npm test --prefix ./packages/common",
    "test:server": "npm test --prefix ./packages/server",
    "test:ui": "npm test --prefix ./packages/ui",
    "build": "lerna run build",
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs",
    "docs:deploy": "yarn run docs:build && ./scripts/docsdeploy.sh",
    "docker:build": "IMAGE_VERSION=$(node -p \"require('./lerna.json').version\") && docker image build -t $npm_package_config_imageRepo:$IMAGE_VERSION -f ./docker/Dockerfile .",
    "publish": "lerna publish"
  }

  • bootstrap - install all packages and setup links for internal packages using lerna
  • dev - run Server and in parallel start UI Serve with hot reload
  • test - execute tests in all packages
  • test:common - execute tests in common package
  • test:server - execute tests in server package
  • test:ui - execute tests in UI package
  • build - execute build script in all packages
  • docs:dev - vuepress documentation development
  • docs:build - build vuepress docs
  • docs:deploy - deploy vuepress docs to github pages
  • docker:build - build Docker image
  • publish - publish public packages using lerna

Dev

Top-level script yarn run dev starts Server package that contains back end API implementation. And in parallel starts vue-cli-service serve script in UI package. This allows UI development with hot reloading, with dev server proxying API requests to API implementation

vue.config.js in UI package is configured to proxy API requests:

// vue.config.js
module.exports = {
  devServer: {
    proxy: 'http://localhost:3200'
  }
}

Publishing packages

yarn run publish

This will publish all public packages in monorepo to npm by invoking lerna publish.

Depending on your needs, you may choose to keep some or all packages private by setting "private": true in package.json of packages in monorepo.

For illustration, in this boilerplate common package is made public, and other packages are private.

Docker Build

Top-level script yarn run docker:build builds Docker image that contains entire Full Stack app:

  • UI package - compiled UI static files (/dist)
  • Common module package
  • Server package that implements API and serves UI static files

Docker build context is top level directory, so all app packages can be accessed.

Docker image entrypoint script just starts server, and you may access UI at http://localhost:3200

See Dockefile https://github.com/slanatech/vue-monorepo-boilerplate/blob/master/docker/Dockerfile

Dockerfile is set up with two goals in mind:

  • Utilize layers cache with minimal rebuild when app code changes
  • Don't publish all packages to npm on every build

These layers with 3rd party modules will be cached on Docker image rebuild if only app code changes:

RUN yarn global add lerna

COPY package.json lerna.json yarn.lock /app/
COPY packages/common/package.json /app/packages/common/package.json
COPY packages/server/package.json /app/packages/server/package.json
COPY packages/ui/package.json /app/packages/ui/package.json

RUN yarn install --production=true

And this copies app code - only relevant content from local packages - to Docker image. These layers will be rebuilt when app code changes:

# Application Packages
ADD packages/common/lib /app/packages/common/lib/
COPY packages/server/server.js /app/packages/server/server.js
ADD packages/ui/dist /app/packages/ui/dist/

Finally, bootstrap to ensure proper symlinks to local packages are set up in node_modules:

RUN yarn run bootstrap

Example of docker run:

#!/usr/bin/env bash

docker run -d -p 3200:3200 --name app --restart always slanatech/vue-monorepo-boilerplate:0.1.8

CI/CD

CI/CD is set up using Travis CI

See .travis.yml https://github.com/slanatech/vue-monorepo-boilerplate/blob/master/.travis.yml

before_install executes bootstrap to ensure local packages are resolved:

before_install:
  - yarn && yarn run bootstrap

Then build script just executes build,test, and docker:build

script:
  - yarn run build
  - yarn run test
  - yarn run docker:build

If desired, you may extend .travis.yml adding publishing packages to npm, and publishing docker image to Docker registry.

Enhancements and Bug Reports

If you find a bug, or have an enhancement in mind please post issues on GitHub. Suggestions and feedback are very welcome !

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].