https://packt.link/free-ebook/9781801073905
67 | -------------------------------------------------------------------------------- /backend/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [{package.json,*.yml}] 12 | indent_style = space 13 | indent_size = 2 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /backend/.env.example: -------------------------------------------------------------------------------- 1 | HOST=0.0.0.0 2 | PORT=1337 3 | APP_KEYS="toBeModified1,toBeModified2" 4 | API_TOKEN_SALT=tobemodified 5 | ADMIN_JWT_SECRET=tobemodified 6 | JWT_SECRET=tobemodified 7 | 8 | -------------------------------------------------------------------------------- /backend/.eslintignore: -------------------------------------------------------------------------------- 1 | .cache 2 | build 3 | **/node_modules/** 4 | -------------------------------------------------------------------------------- /backend/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": "eslint:recommended", 4 | "env": { 5 | "commonjs": true, 6 | "es6": true, 7 | "node": true, 8 | "browser": false 9 | }, 10 | "parserOptions": { 11 | "ecmaFeatures": { 12 | "experimentalObjectRestSpread": true, 13 | "jsx": false 14 | }, 15 | "sourceType": "module" 16 | }, 17 | "globals": { 18 | "strapi": true 19 | }, 20 | "rules": { 21 | "indent": ["error", 2, { "SwitchCase": 1 }], 22 | "linebreak-style": ["error", "unix"], 23 | "no-console": 0, 24 | "quotes": ["error", "single"], 25 | "semi": ["error", "always"] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | ############################ 2 | # OS X 3 | ############################ 4 | 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | Icon 9 | .Spotlight-V100 10 | .Trashes 11 | ._* 12 | 13 | 14 | ############################ 15 | # Linux 16 | ############################ 17 | 18 | *~ 19 | 20 | 21 | ############################ 22 | # Windows 23 | ############################ 24 | 25 | Thumbs.db 26 | ehthumbs.db 27 | Desktop.ini 28 | $RECYCLE.BIN/ 29 | *.cab 30 | *.msi 31 | *.msm 32 | *.msp 33 | 34 | 35 | ############################ 36 | # Packages 37 | ############################ 38 | 39 | *.7z 40 | *.csv 41 | *.dat 42 | *.dmg 43 | *.gz 44 | *.iso 45 | *.jar 46 | *.rar 47 | *.tar 48 | *.zip 49 | *.com 50 | *.class 51 | *.dll 52 | *.exe 53 | *.o 54 | *.seed 55 | *.so 56 | *.swo 57 | *.swp 58 | *.swn 59 | *.swm 60 | *.out 61 | *.pid 62 | 63 | 64 | ############################ 65 | # Logs and databases 66 | ############################ 67 | 68 | .tmp 69 | *.log 70 | *.sql 71 | *.sqlite 72 | *.sqlite3 73 | 74 | 75 | ############################ 76 | # Misc. 77 | ############################ 78 | 79 | *# 80 | ssl 81 | .idea 82 | nbproject 83 | public/uploads/* 84 | !public/uploads/.gitkeep 85 | 86 | ############################ 87 | # Node.js 88 | ############################ 89 | 90 | lib-cov 91 | lcov.info 92 | pids 93 | logs 94 | results 95 | node_modules 96 | .node_history 97 | 98 | ############################ 99 | # Tests 100 | ############################ 101 | 102 | testApp 103 | coverage 104 | 105 | ############################ 106 | # Strapi 107 | ############################ 108 | 109 | .env 110 | license.txt 111 | exports 112 | *.cache 113 | dist 114 | build 115 | .strapi-updater.json 116 | -------------------------------------------------------------------------------- /backend/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the official Node.js 14 Alpine image from https://hub.docker.com/_/node. 2 | # Using an image with specific version tags allow deterministic builds. 3 | FROM node:14.16.1 AS builder 4 | 5 | # Create and change to the app directory. 6 | WORKDIR /usr/src/backend 7 | 8 | # Copy important root files to the builder image. 9 | COPY package*.json ./ 10 | 11 | # Install production dependencies. 12 | RUN npm install 13 | 14 | # Copy the Backend source to the container image. 15 | COPY . . 16 | 17 | # build app for production with minification 18 | RUN npm run build 19 | 20 | EXPOSE 1337 21 | 22 | # Init final image generation. 23 | FROM node:14.16.1 24 | 25 | # Run the Strapi service on container startup. 26 | CMD ["npm", "start"] 27 | -------------------------------------------------------------------------------- /backend/README.md: -------------------------------------------------------------------------------- 1 | # 🚀 Getting started with Strapi 2 | 3 | Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html) (CLI) which lets you scaffold and manage your project in seconds. 4 | 5 | ### `develop` 6 | 7 | Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-develop) 8 | 9 | ``` 10 | npm run develop 11 | # or 12 | yarn develop 13 | ``` 14 | 15 | ### `start` 16 | 17 | Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-start) 18 | 19 | ``` 20 | npm run start 21 | # or 22 | yarn start 23 | ``` 24 | 25 | ### `build` 26 | 27 | Build your admin panel. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-build) 28 | 29 | ``` 30 | npm run build 31 | # or 32 | yarn build 33 | ``` 34 | 35 | ## ⚙️ Deployment 36 | 37 | Strapi gives you many possible deployment options for your project. Find the one that suits you on the [deployment section of the documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment.html). 38 | 39 | ## 📚 Learn more 40 | 41 | - [Resource center](https://strapi.io/resource-center) - Strapi resource center. 42 | - [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation. 43 | - [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community. 44 | - [Strapi blog](https://docs.strapi.io) - Official Strapi blog containing articles made by the Strapi team and the community. 45 | - [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements. 46 | 47 | Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome! 48 | 49 | ## ✨ Community 50 | 51 | - [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team. 52 | - [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members. 53 | - [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi. 54 | 55 | --- 56 | 57 | 🤫 Psst! [Strapi is hiring](https://strapi.io/careers). 58 | -------------------------------------------------------------------------------- /backend/config/admin.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | auth: { 3 | secret: env('ADMIN_JWT_SECRET'), 4 | }, 5 | apiToken: { 6 | salt: env('API_TOKEN_SALT'), 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /backend/config/api.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rest: { 3 | defaultLimit: 25, 4 | maxLimit: 100, 5 | withCount: true, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /backend/config/database.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = ({ env }) => ({ 4 | connection: { 5 | client: 'sqlite', 6 | connection: { 7 | filename: path.join(__dirname, '..', env('DATABASE_FILENAME', '.tmp/data.db')), 8 | }, 9 | useNullAsDefault: true, 10 | }, 11 | }); 12 | -------------------------------------------------------------------------------- /backend/config/middlewares.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | 'strapi::errors', 3 | 'strapi::security', 4 | 'strapi::cors', 5 | 'strapi::poweredBy', 6 | 'strapi::logger', 7 | 'strapi::query', 8 | 'strapi::body', 9 | 'strapi::session', 10 | 'strapi::favicon', 11 | 'strapi::public', 12 | ]; 13 | -------------------------------------------------------------------------------- /backend/config/server.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | host: env('HOST', '0.0.0.0'), 3 | port: env.int('PORT', 1337), 4 | app: { 5 | keys: env.array('APP_KEYS'), 6 | }, 7 | }); 8 | -------------------------------------------------------------------------------- /backend/database/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Architecting-Vue.js-3-Enterprise-Ready-Web-Applications/2a46900038fc42672cbda9922e76b0dca05605a8/backend/database/migrations/.gitkeep -------------------------------------------------------------------------------- /backend/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Architecting-Vue.js-3-Enterprise-Ready-Web-Applications/2a46900038fc42672cbda9922e76b0dca05605a8/backend/favicon.ico -------------------------------------------------------------------------------- /backend/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Architecting-Vue.js-3-Enterprise-Ready-Web-Applications/2a46900038fc42672cbda9922e76b0dca05605a8/backend/favicon.png -------------------------------------------------------------------------------- /backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend", 3 | "private": true, 4 | "version": "0.1.0", 5 | "description": "A Strapi application", 6 | "scripts": { 7 | "develop": "strapi develop", 8 | "start": "strapi start", 9 | "build": "strapi build", 10 | "strapi": "strapi" 11 | }, 12 | "devDependencies": {}, 13 | "dependencies": { 14 | "@strapi/plugin-graphql": "^4.5.5", 15 | "@strapi/plugin-i18n": "4.5.5", 16 | "@strapi/plugin-users-permissions": "4.5.5", 17 | "@strapi/strapi": "4.5.5", 18 | "better-sqlite3": "7.4.6" 19 | }, 20 | "author": { 21 | "name": "A Strapi developer" 22 | }, 23 | "strapi": { 24 | "uuid": "daec4bf8-e7a1-441c-90f9-ecbb4783b589" 25 | }, 26 | "engines": { 27 | "node": ">=14.19.1 <=18.x.x", 28 | "npm": ">=6.0.0" 29 | }, 30 | "license": "MIT" 31 | } 32 | -------------------------------------------------------------------------------- /backend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # To prevent search engines from seeing the site altogether, uncomment the next two lines: 2 | # User-Agent: * 3 | # Disallow: / 4 | -------------------------------------------------------------------------------- /backend/public/uploads/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Architecting-Vue.js-3-Enterprise-Ready-Web-Applications/2a46900038fc42672cbda9922e76b0dca05605a8/backend/public/uploads/.gitkeep -------------------------------------------------------------------------------- /backend/src/admin/app.example.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | locales: [ 3 | // 'ar', 4 | // 'fr', 5 | // 'cs', 6 | // 'de', 7 | // 'dk', 8 | // 'es', 9 | // 'he', 10 | // 'id', 11 | // 'it', 12 | // 'ja', 13 | // 'ko', 14 | // 'ms', 15 | // 'nl', 16 | // 'no', 17 | // 'pl', 18 | // 'pt-BR', 19 | // 'pt', 20 | // 'ru', 21 | // 'sk', 22 | // 'sv', 23 | // 'th', 24 | // 'tr', 25 | // 'uk', 26 | // 'vi', 27 | // 'zh-Hans', 28 | // 'zh', 29 | ], 30 | }; 31 | 32 | const bootstrap = (app) => { 33 | console.log(app); 34 | }; 35 | 36 | export default { 37 | config, 38 | bootstrap, 39 | }; 40 | -------------------------------------------------------------------------------- /backend/src/admin/webpack.config.example.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* eslint-disable no-unused-vars */ 4 | module.exports = (config, webpack) => { 5 | // Note: we provide webpack above so you should not `require` it 6 | // Perform customizations to webpack config 7 | // Important: return the modified config 8 | return config; 9 | }; 10 | -------------------------------------------------------------------------------- /backend/src/api/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Architecting-Vue.js-3-Enterprise-Ready-Web-Applications/2a46900038fc42672cbda9922e76b0dca05605a8/backend/src/api/.gitkeep -------------------------------------------------------------------------------- /backend/src/api/board/content-types/board/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "collectionType", 3 | "collectionName": "boards", 4 | "info": { 5 | "singularName": "board", 6 | "pluralName": "boards", 7 | "displayName": "Board" 8 | }, 9 | "options": { 10 | "draftAndPublish": true 11 | }, 12 | "pluginOptions": {}, 13 | "attributes": { 14 | "title": { 15 | "type": "text" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /backend/src/api/board/controllers/board.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * board controller 5 | */ 6 | 7 | const { createCoreController } = require('@strapi/strapi').factories; 8 | 9 | module.exports = createCoreController('api::board.board'); 10 | -------------------------------------------------------------------------------- /backend/src/api/board/routes/board.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * board router 5 | */ 6 | 7 | const { createCoreRouter } = require('@strapi/strapi').factories; 8 | 9 | module.exports = createCoreRouter('api::board.board'); 10 | -------------------------------------------------------------------------------- /backend/src/api/board/services/board.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * board service 5 | */ 6 | 7 | const { createCoreService } = require('@strapi/strapi').factories; 8 | 9 | module.exports = createCoreService('api::board.board'); 10 | -------------------------------------------------------------------------------- /backend/src/api/photo/content-types/photo/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "collectionType", 3 | "collectionName": "photos", 4 | "info": { 5 | "singularName": "photo", 6 | "pluralName": "photos", 7 | "displayName": "Photo" 8 | }, 9 | "options": { 10 | "draftAndPublish": true 11 | }, 12 | "pluginOptions": {}, 13 | "attributes": { 14 | "title": { 15 | "type": "text" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /backend/src/api/photo/controllers/photo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * photo controller 5 | */ 6 | 7 | const { createCoreController } = require('@strapi/strapi').factories; 8 | 9 | module.exports = createCoreController('api::photo.photo'); 10 | -------------------------------------------------------------------------------- /backend/src/api/photo/routes/photo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * photo router 5 | */ 6 | 7 | const { createCoreRouter } = require('@strapi/strapi').factories; 8 | 9 | module.exports = createCoreRouter('api::photo.photo'); 10 | -------------------------------------------------------------------------------- /backend/src/api/photo/services/photo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * photo service 5 | */ 6 | 7 | const { createCoreService } = require('@strapi/strapi').factories; 8 | 9 | module.exports = createCoreService('api::photo.photo'); 10 | -------------------------------------------------------------------------------- /backend/src/extensions/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Architecting-Vue.js-3-Enterprise-Ready-Web-Applications/2a46900038fc42672cbda9922e76b0dca05605a8/backend/src/extensions/.gitkeep -------------------------------------------------------------------------------- /backend/src/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | /** 5 | * An asynchronous register function that runs before 6 | * your application is initialized. 7 | * 8 | * This gives you an opportunity to extend code. 9 | */ 10 | register(/*{ strapi }*/) {}, 11 | 12 | /** 13 | * An asynchronous bootstrap function that runs before 14 | * your application gets started. 15 | * 16 | * This gives you an opportunity to set up your data model, 17 | * run jobs, or perform some special logic. 18 | */ 19 | bootstrap(/*{ strapi }*/) {}, 20 | }; 21 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3.5" 2 | 3 | services: 4 | 5 | api: 6 | 7 | build: 8 | 9 | context: . 10 | 11 | dockerfile: Dockerfile 12 | 13 | args: 14 | PACKAGE_PATH: backend 15 | WORKING_DIR: /usr/src/ 16 | 17 | expose: 18 | - 1337 19 | 20 | ports: 21 | - 1337:1337 22 | 23 | environment: 24 | - NODE_ENV=development 25 | - HOST=0.0.0.0 26 | - PORT=1337 27 | - BASE_URL=http://api:1337 28 | 29 | env_file: 30 | - ./.env 31 | 32 | volumes: 33 | - ./backend:/usr/src 34 | 35 | command: > 36 | sh -c "npm install" 37 | 38 | frontend: 39 | 40 | build: 41 | 42 | context: . 43 | 44 | dockerfile: Dockerfile 45 | 46 | args: 47 | PACKAGE_PATH: frontend 48 | WORKING_DIR: /usr/src/ 49 | 50 | expose: 51 | - 3000 52 | 53 | ports: 54 | - 3000:3000 55 | 56 | environment: 57 | - APP_ENV=production 58 | - APP_BACKEND=http://0.0.0.0:1337/api 59 | - NODE_PATH=/usr/src/ 60 | - APP_TOKEN=eyJhbGciOiJIUzI1NiJ9.c29sb[STRAPI_TOKEN] 61 | 62 | env_file: 63 | - ./common.env 64 | 65 | volumes: 66 | - ./frontend:/usr/src 67 | 68 | depends_on: 69 | - api 70 | 71 | command: [ "npm", "start" ] 72 | -------------------------------------------------------------------------------- /frontend/.env: -------------------------------------------------------------------------------- 1 | BE_URL=http://localhost:1337 2 | FE_URL=http://localhost:3000 -------------------------------------------------------------------------------- /frontend/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | // add more generic rulesets here, such as: 4 | // 'eslint:recommended', 5 | "plugin:vue/vue3-recommended", 6 | // 'plugin:vue/vue3-essential', // This option doesn't impose formatting rules 7 | // 'plugin:vue/vue3-strongly-recommended', // This option imposes formatting rules on your code to improve readability 8 | ], 9 | rules: { 10 | // override/add rules settings here, such as: 11 | // 'vue/no-unused-vars': 'error' 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /frontend/.github/workflows/production.yml: -------------------------------------------------------------------------------- 1 | name: PRODUCTION - Deploy container to AWS App Runner # Name of the workflow 2 | on: 3 | pull_request: 4 | branches: 5 | - main 6 | workflow_dispatch: # Allow manual invocation of the workflow 7 | env: 8 | ENVIRONMENT_NAME: production 9 | ECR_REPOSITORY_NAME: vue-pinterest-demo 10 | jobs: 11 | deploy: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v2 17 | with: 18 | persist-credentials: false 19 | 20 | - name: Configure AWS credentials 21 | id: aws-credentials 22 | uses: aws-actions/configure-aws-credentials@v1 23 | with: 24 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 25 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 26 | aws-region: ${{ secrets.AWS_REGION }} 27 | 28 | - name: Login to Amazon ECR 29 | id: ecr-login 30 | uses: aws-actions/amazon-ecr-login@v1 31 | 32 | - name: Build, tag, and push image to Amazon ECR 33 | id: build-image 34 | env: 35 | ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }} 36 | ECR_REPOSITORY: ${{ env.ECR_REPOSITORY_NAME }} 37 | IMAGE_TAG: ${{ github.sha }} 38 | run: | 39 | docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . 40 | docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG 41 | echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" 42 | 43 | - name: Deploy to App Runner 44 | id: deploy-app 45 | uses: awslabs/amazon-app-runner-deploy@main 46 | with: 47 | service: erp-app-${{ env.ENVIRONMENT_NAME }} 48 | image: ${{ steps.build-image.outputs.image }} 49 | access-role-arn: ${{ secrets.ROLE_ARN }} 50 | region: ${{ secrets.AWS_REGION }} 51 | cpu : 1 52 | memory : 2 53 | port: 80 54 | wait-for-service-stability: false 55 | 56 | - name: App Runner output 57 | run: echo "App runner output ${{ steps.deploy-app.outputs.service-id }}" -------------------------------------------------------------------------------- /frontend/.github/workflows/staging.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - chapter-12 5 | 6 | jobs: 7 | lint: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | - run: | 12 | yarn 13 | yarn lint 14 | 15 | unit_test: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v3 19 | - run: | 20 | yarn 21 | yarn test:unit 22 | 23 | component_test: 24 | runs-on: ubuntu-latest 25 | needs: unit_test 26 | steps: 27 | - uses: actions/checkout@v3 28 | - run: | 29 | yarn 30 | yarn test:component 31 | 32 | e2e_test: 33 | runs-on: ubuntu-latest 34 | needs: component_test 35 | steps: 36 | - uses: actions/checkout@v3 37 | - run: | 38 | yarn 39 | yarn test:e2e 40 | 41 | deploy: 42 | runs-on: ubuntu-latest 43 | needs: e2e_test 44 | steps: 45 | - uses: actions/checkout@v2 46 | - name: Deploy to Netlify 47 | uses: nwtgck/actions-netlify@v1.2 48 | id: deploy-to-netlify 49 | with: 50 | publish-dir: './dist' 51 | production-branch: chapter-12 52 | github-token: ${{ secrets.GITHUB_TOKEN }} 53 | deploy-message: "Deploy from GitHub Actions" 54 | enable-pull-request-comment: false 55 | enable-commit-comment: true 56 | overwrites-pull-request-comment: true 57 | env: 58 | NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} 59 | NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} 60 | timeout-minutes: 1 61 | outputs: 62 | preview-url: ${{ steps.deploy-to-netlify.outputs.deploy-url }} 63 | 64 | lighthouse: 65 | runs-on: ubuntu-latest 66 | needs: deploy 67 | steps: 68 | - uses: actions/checkout@v2 69 | - name: Run Lighthouse on urls and validate with lighthouserc 70 | uses: treosh/lighthouse-ci-action@v7 71 | with: 72 | urls: | 73 | ${{ needs.deploy.outputs.preview-url }} 74 | budgetPath: ./budget.json 75 | runs: 3 76 | 77 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | package-lock.json 11 | yarn.lock 12 | 13 | node_modules 14 | dist 15 | dist-ssr 16 | *.local 17 | 18 | # Editor directories and files 19 | .vscode/* 20 | !.vscode/extensions.json 21 | .idea 22 | .DS_Store 23 | *.suo 24 | *.ntvs* 25 | *.njsproj 26 | *.sln 27 | *.sw? 28 | 29 | cypress/* -------------------------------------------------------------------------------- /frontend/.prettierrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /frontend/.storybook/main.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "stories": [ 3 | "../src/**/*.stories.mdx", 4 | "../src/**/*.stories.@(js|jsx|ts|tsx)" 5 | ], 6 | "addons": [ 7 | "@storybook/addon-links", 8 | "@storybook/addon-essentials" 9 | ], 10 | "framework": "@storybook/vue3" 11 | } -------------------------------------------------------------------------------- /frontend/.storybook/preview.js: -------------------------------------------------------------------------------- 1 | export const parameters = { 2 | actions: { argTypesRegex: "^on[A-Z].*" }, 3 | controls: { 4 | matchers: { 5 | color: /(background|color)$/i, 6 | date: /Date$/, 7 | }, 8 | }, 9 | } -------------------------------------------------------------------------------- /frontend/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["johnsoncodehk.volar"] 3 | } 4 | -------------------------------------------------------------------------------- /frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the official Node.js 14 Alpine image from https://hub.docker.com/_/node. 2 | # Using an image with specific version tags allow deterministic builds. 3 | FROM node:fermium-alpine3.14 AS builder 4 | 5 | # Create and change to the app directory. 6 | WORKDIR /app 7 | 8 | # Copy important root files to the builder image. 9 | COPY package*.json ./ 10 | 11 | RUN npm cache verify 12 | 13 | # Install production dependencies. 14 | RUN npm install 15 | 16 | # Copy the Vue 3 source to the container image. 17 | COPY . . 18 | 19 | # build app for production with minification 20 | RUN npm run build 21 | 22 | # Production stage 23 | FROM nginx:stable-alpine as production-stage 24 | 25 | # Copy the Vue 3 source to the container image. 26 | COPY --from=builder /app/dist /usr/share/nginx/html 27 | 28 | VOLUME /app/node_modules 29 | 30 | EXPOSE 80 31 | 32 | # Run the Vue service on container startup. 33 | CMD ["nginx", "-g", "daemon off;"] -------------------------------------------------------------------------------- /frontend/budget.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/*", 4 | "timings": [ 5 | { 6 | "metric": "first-contentful-paint", 7 | "budget": 2200 8 | }, 9 | { 10 | "metric": "speed-index", 11 | "budget": 3000 12 | }, 13 | { 14 | "metric": "largest-contentful-paint", 15 | "budget": 3000 16 | }, 17 | { 18 | "metric": "interactive", 19 | "budget": 3000 20 | }, 21 | { 22 | "metric": "total-blocking-time", 23 | "budget": 250 24 | }, 25 | { 26 | "metric": "cumulative-layout-shift", 27 | "budget": 0 28 | } 29 | ], 30 | "resourceSizes": [ 31 | { 32 | "resourceType": "script", 33 | "budget": 150 34 | }, 35 | { 36 | "resourceType": "total", 37 | "budget": 400 38 | } 39 | ], 40 | "resourceCounts": [ 41 | { 42 | "resourceType": "third-party", 43 | "budget": 5 44 | } 45 | ] 46 | } 47 | ] 48 | -------------------------------------------------------------------------------- /frontend/cypress.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require("cypress"); 2 | 3 | module.exports = defineConfig({ 4 | component: {}, 5 | 6 | env: { 7 | // HINT: here we read these keys from .env file, feel free to remove the items that you don't need 8 | baseUrl: process.env.FE_URL ?? "http://localhost:3000", 9 | apiUrl: process.env.BE_URL ?? "http://localhost:1337", 10 | email: "admin@test.com", 11 | password: "Admin111", 12 | }, 13 | 14 | e2e: { 15 | supportFolder: false, 16 | supportFile: false, 17 | specPattern: "src/tests/e2e/**/*.spec.js", 18 | // eslint-disable-next-line no-unused-vars 19 | setupNodeEvents(on, config) { 20 | // implement node event listeners here 21 | }, 22 | 23 | baseUrl: process.env.FE_URL ?? "http://localhost:3000", 24 | }, 25 | }); 26 | -------------------------------------------------------------------------------- /frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |