All Projects → ledermann → templatus

ledermann / templatus

Licence: MIT license
Opinionated template for starting new web applications with Ruby on Rails and Vue.js 3

Programming Languages

ruby
36898 projects - #4 most used programming language
Vue
7211 projects
typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to templatus

react-boilerplate
React 18, React-Router, Typescript, Vite, Babel 7, React-Testing-Library, Vitest
Stars: ✭ 27 (-46%)
Mutual labels:  vitejs
django-vite
Integration of ViteJS in a Django project.
Stars: ✭ 201 (+302%)
Mutual labels:  vitejs
vite-plugin-webfont-dl
⚡ Webfont Download Vite Plugin - Make your Vite site load faster
Stars: ✭ 69 (+38%)
Mutual labels:  vitejs
preview-pro
Use pro-layout in vitejs. preview https://sendya.github.io/preview-pro/index.html
Stars: ✭ 71 (+42%)
Mutual labels:  vitejs
vite-plugin-ssr
Like Next.js / Nuxt but as do-one-thing-do-it-well Vite plugin.
Stars: ✭ 1,703 (+3306%)
Mutual labels:  vitejs
image-optimizer
A free and open source tool for optimizing images and vector graphics.
Stars: ✭ 740 (+1380%)
Mutual labels:  vitejs
jplayer-skin-audiocheck
A responsive HTML5 jPlayer skin with playlist.
Stars: ✭ 16 (-68%)
Mutual labels:  vitejs
admin-one-vue-tailwind
Free Vue.js 3.x Tailwind 3.x admin dashboard template with dark mode. Vite builds. Pinia state. Laravel integration available
Stars: ✭ 742 (+1384%)
Mutual labels:  vitejs
jumpstart-vite
⚡️ Jumpstart a new Rails app with Vite.js + Turbo + Stimulus, and more
Stars: ✭ 67 (+34%)
Mutual labels:  vitejs
pingcrm-vite
⚡️ PingCRM on Vite Rails - A Vite.js + Inertia.js + Vue SSR + Rails demo
Stars: ✭ 48 (-4%)
Mutual labels:  vitejs
html5-blank-slate
A blank starter theme that incorporates Bootstrap 5 with WordPress and Vite for frontend tooling.
Stars: ✭ 21 (-58%)
Mutual labels:  vitejs
vite-plugins
🌱 为社区尽一份绵薄之力
Stars: ✭ 63 (+26%)
Mutual labels:  vitejs
django-vitevue
Manage Vitejs frontends for Django
Stars: ✭ 45 (-10%)
Mutual labels:  vitejs
dragonfly-dag
完全支持Vue3和Vitejs的DAG流程图组件
Stars: ✭ 54 (+8%)
Mutual labels:  vitejs
vite-bundle
Integration with your Symfony app & Vite
Stars: ✭ 56 (+12%)
Mutual labels:  vitejs
vite-plugin-theme-preprocessor
css theme preprocessor plugin for vite
Stars: ✭ 144 (+188%)
Mutual labels:  vitejs
troisjs.github.io
📖 Examples and documentation for TroisJS ✨
Stars: ✭ 119 (+138%)
Mutual labels:  vitejs
vite-plugin-environment
Easily expose environment variables in Vite.js
Stars: ✭ 57 (+14%)
Mutual labels:  vitejs
vite-plugin-vue-gql
⚡ GraphQL Tags for your Vue SFC ⚡
Stars: ✭ 188 (+276%)
Mutual labels:  vitejs
vitejs-kr.github.io
ViteJS 공식 문서에 대한 한글 번역 목적 리포지토리입니다. (ViteJS documentation Korean translation)
Stars: ✭ 81 (+62%)
Mutual labels:  vitejs

Build Status Cypress

Templatus (Vue edition)

Templatus is an opinionated template to build web applications with Ruby on Rails and Vue.js 3. It simplifies the process of setting up a new application while following best practices.

Live demo available at https://templatus-vue.ledermann.dev

There are two sister repositories:

Using Hotwire instead of Vue.js (the "DHH way"): https://github.com/templatus/templatus-hotwire/

Using Inertia and Svelte.js instead of Vue.js; https://github.com/templatus/templatus-inertia/

Features / Technology stack

Backend

Frontend

  • Vite for bundling JavaScript and CSS with Hot Module Replacement (HMR) in development
  • Vue 3 as frontend framework
  • Vue Router 4 for frontend routing
  • Pinia for frontend state management
  • Tailwind CSS 3 to not have to write CSS at all
  • Heroicons for SVG icons as Vue components
  • Rails Request.JS for AJAX requests with default headers

Development

  • Puma-dev for using .test TLD (instead of localhost:3000) and https in development
  • Foreman for starting up the application locally
  • dotenv to load environment variables from .env into ENV
  • TypeScript for writing strongly-typed JavaScript
  • Prettier for auto-formatting TypeScript and Ruby code in Visual Studio Code

Linting and testing

  • RuboCop for Ruby static code analysis
  • RSpec for Ruby testing
  • ESLint for TypeScript static code analysis
  • Jest for TypeScript unit testing
  • Cypress for E2E testing

Deployment

  • Docker for production deployment, NOT for development
  • DockerRailsBase for fast building an optimized Docker image based on Alpine Linux
  • GitHub Actions for testing, linting, and building Docker image
  • Dependabot configuration for updating dependencies (with auto-merge)
  • Ready for serving assets via CDN like CloudFront
  • Honeybadger for error tracking in Ruby and TypeScript
  • Plausible for privacy friendly analytics

Production

  • Lograge for single-line logging
  • Gzip and Brotli compression of dynamic responses (HTML, JSON) using Rack::Deflater, Rack::Brotli
  • Fine-tuned Content Security Policy (CSP)
  • Ready for PWA (manifest, service-worker)

Metrics

This template is developed with optimized performance and security in mind. The following benchmarks are performed against the demo installation on production. It uses an inexpensive virtual server on the Hetzner Cloud behind a Traefik setup.

Lighthouse site performance

100% in all categories.

Lighthouse

Security headers

Security headers

What's the red Permissions-Policy badge? This seems to be fixed with one of the next Rails update: rails/rails#41994

Mozilla Observatory

Mozilla Observatory

WebPageTest

WebPageTest

GTmetrix

GTmetrix

Check-your-website

Check-your-website

JavaScript size

147 KB of compiled JavaScript (after tree-shaking, minified & uncompressed). The largest parts are:

  • Vue.js + Vue Router (75 KB)
  • Honeybadger (23 KB)
  • ActionCable (9 KB)
  • Pinia (6 KB)
$ RAILS_ENV=production bin/rails assets:precompile
yarn install v1.22.19
[1/5] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.11s.
Building with Vite ⚡️
vite v3.0.3 building for production...
transforming...
✓ 306 modules transformed.
rendering chunks...
../../public/vite/assets/logo.44ced38d.svg          0.48 KiB
../../public/vite/manifest-assets.json              0.10 KiB
../../public/vite/manifest.json                     0.56 KiB
../../public/vite/assets/application.17c82bfa.js    16.16 KiB / gzip: 6.56 KiB
../../public/vite/assets/application.17c82bfa.js.map 27.93 KiB
../../public/vite/assets/application.d89f975f.css   21.47 KiB / gzip: 4.72 KiB
../../public/vite/assets/vendor.d2870ebb.js         129.42 KiB / gzip: 48.47 KiB
../../public/vite/assets/vendor.d2870ebb.js.map     1040.46 KiB
Build with Vite complete: /Users/ledermann/Projects/templatus-vue/public/vite

Network transfer

Small footprint: The demo application transfers only 69 KB of data on the first visit.

Network

Docker build time

With multi-stage building and using DockerRailsBase the build of the Docker image takes very little time. Currently, the build job requires about 1,5 minutes on GitHub Actions (see https://github.com/templatus/templatus-vue/actions)

Docker image size

The Docker image is based on Alpine Linux and is optimized for minimal size (currently 113 MB uncompressed disk size). It includes just the bare minimum - no build tools like Node.js, no JS sources (just the compiled assets), no tests.

$ container-diff analyze ghcr.io/templatus/templatus-vue -n

-----Size-----

Analysis for ghcr.io/templatus/templatus-vue:
IMAGE                              DIGEST     SIZE
ghcr.io/templatus/templatus-vue        sha256:... 114.8M

Getting started

Install for development

  1. Clone the repo locally:
git clone [email protected]:templatus/templatus-vue.git
cd templatus-vue
  1. Install PostgreSQL, Redis, and puma-dev (if not already present). On a Mac with Homebrew, run this to install from the Brewfile:
brew bundle
  1. Set up puma-dev to use HTTPS for development. Do this on macOS:
sudo puma-dev -setup
puma-dev -install
puma-dev link

# Use Vite via puma-dev proxy
# Adopted from https://github.com/puma/puma-dev#webpack-dev-server
echo 3036 > ~/.puma-dev/vite.templatus-vue
  1. Setup the application to install gems and NPM packages and create the database:
bin/setup
  1. Start the application locally:
bin/dev

Then open https://templatus-vue.test in your browser.

Running linters

RuboCop:

bin/rubocop

ESLint:

bin/yarn lint

TypeScript compiler:

bin/yarn tsc

Running tests locally

Ruby tests:

bin/rspec
open coverage/index.html

JavaScript unit tests:

bin/yarn test

E2E tests with Cypress:

bin/cypress open

This opens Cypress and starts Rails in development environment, but with CYPRESS=true, so the test database is used. This allows code editing without class reloading and recompiling assets.

To run Cypress in headless mode:

bin/cypress run

Test deployment locally

docker network create public
docker-compose up
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].