Code Monkey home page Code Monkey logo

maddevs-nuxt's Introduction

Maddevs
Official Website Repository

Mad Devs develops enterprise-level custom software solutions & mobile apps for finance, transportation, logistics, security, edtech, cloudtech & advertising industries.

Commits activity Website status Javascript Nuxt

๐ŸŒŽ Table of contents

โšก๏ธ Quick development start

To start the project you need to do the following steps:

  1. Install dependencies
$ npm install
  1. Run the project in development mode
$ npm run dev
  1. The application is available on localhost:3000

For detailed explanation on how things work, checkout the Nuxt.js docs.

โš™๏ธ Project overview

Technologies && tools

Main technologies

A list of main technologies that we use for build our application

Technology Version Description
Node 16.x For the correct launch of the project, use this version of the node
Vue ^2.6.12 Progressive framework for building a modern user interfaces
Nuxt ^2.15.8 Server-side rendering framework for VueJS
Axios ^0.21.3 Promise based HTTP client for the browser and node.js
Express ^4.17.1 Web-framework for nodeJS
Vuelidate ^0.7.6 A VueJS modern validating library
Prismic ^1.3.1 Content-Management system
Lottie-web ^5.8.1 The mobile library for Web animations

Additional tools

A list of additional tools that we use for make our codebase better

Technology Version Description
Jest ^26.6.3 Delightful JavaScript Testing Framework with a focus on simplicity.
ESLint ^7.24.0 Pluggable JavaScript linter
testing-library ^5.6.1 Simple and complete testing utilities that encourage good testing practices
Cypress ^7.7.0 E2E testing framework on JavaScript
Sentry ^6.18.2 Application monitoring and error tracking
Snyk ^1.717.0 Tool for find and fix security vulnerabilities

Project structure

.
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ Procfile - heroku config file
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ nuxt.config.js - nuxt config
โ”œโ”€โ”€ nodemon.json - nodemon config
โ”œโ”€โ”€ jsconfig.json
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ cypress.json - cypress config
โ”œโ”€โ”€ babel.config.js - babel config
โ”œโ”€โ”€ .snyk - snyk policy file
โ”œโ”€โ”€ .sass-lint.yml - sass-lint config
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .eslintrc - eslint config
โ”œโ”€โ”€ .eslintignore
โ”œโ”€โ”€ .env.example
โ”œโ”€โ”€ .editorconfig
โ”œโ”€โ”€ .dockerignore
โ”œโ”€โ”€ utils - core utils
โ”œโ”€โ”€ tests - all unit-tests
โ”œโ”€โ”€ server - server code
โ”œโ”€โ”€ SEOAnalyzer - app for analytze SEO errors
โ”œโ”€โ”€ jest - jest configurations
โ”œโ”€โ”€ docs - additional docs
โ”œโ”€โ”€ client - main source folder
โ”‚ย ย  โ”œโ”€โ”€ api - api requests
โ”‚ย ย  โ”œโ”€โ”€ app - ?
โ”‚ย ย  โ”œโ”€โ”€ assets
โ”‚ย ย  โ”œโ”€โ”€ components
โ”‚ย ย  โ”œโ”€โ”€ data - static data
โ”‚ย ย  โ”œโ”€โ”€ directives
โ”‚ย ย  โ”œโ”€โ”€ featureFlags - featureFlags logic
โ”‚ย ย  โ”œโ”€โ”€ helpers
โ”‚ย ย  โ”œโ”€โ”€ layouts
โ”‚ย ย  โ”œโ”€โ”€ locales
โ”‚ย ย  โ”œโ”€โ”€ mixins
โ”‚ย ย  โ”œโ”€โ”€ pages
โ”‚ย ย  โ”œโ”€โ”€ plugins
โ”‚ย ย  โ”œโ”€โ”€ prismicSlices - libraries of shared slices for prismic dashboard
โ”‚ย ย  โ”œโ”€โ”€ static
โ”‚ย ย  โ”œโ”€โ”€ store - vuex

๐Ÿ’ผ๏ธ Environment variables

A list of environment variables that needed to start the project(required)

NAME DESCRIPTION
NODE_SENDPULSE_API_USER_ID Sendpulse api user id
NODE_SENDPULSE_API_KEY Sendpulse api key
NODE_EMAIL_HR Email to send messages(cv) to HR department
NODE_EMAIL_CONTACT Email to send messages(from leads) to DM department
NODE_EMAIL_MARKETING Email to send messages to Marketing department
NODE_EMAIL_CV Email to send messages to CV department
NODE_PRISMIC_API Prismic api key
NODE_ATLASSIAN_TOKEN Jira auth token
NODE_ATLASSIAN_EMAIL Jira auth email
NODE_ATLASSIAN_PROJECT_KEY Jira auth project key
NODE_ATLASSIAN_API_URL Jira api url
NODE_NODE_ATLASSIAN_EBOOK_PROJECT_KEY Jira Ebook key dashboard
NODE_ATLASSIAN_SUBSCRIBERS_PROJECT_KEY Jira Subscribers key dashboard
NODE_JEST_COVERAGE_SLACK_WEBHOOK_URL Slack webhook to send coverage
NODE_PAGESPEED_SLACK_WEBHOOK_URL Slack webhook to send pagespeed info
NODE_SENTRY_DSN Sentry DSN
NODE_SENTRY_DSN_FRONT Sentry DSN for client
SENTRY_ORG Sentry Organization name
SENTRY_PROJECT Sentry project name
SENTRY_AUTH_TOKEN Sentry auth token
NODE_DOMAIN Domain
FF_ENVIRONMENT Feature flags environment
NODE_ENV Development variant
NODE_HUNTFLOW_API_URL Huntflow api url
NODE_HUNTFLOW_TOKEN Huntflow auth token
NODE_HUNTFLOW_ACCOUNT_ID Huntflow auth account
NODE_HUNTFLOW_RESERVE_VACANCY_ID Huntflow auth reserve vacancy
NODE_CYPRESS_BASE_URL Cypress url
NODE_AWS_URL AWS url
NODE_S3_PUBLIC_URL S3 url
NODE_S3_SECRET_ACCESS_KEY S3 secret key
RECAPTCHA_SITE_KEY ReCaptcha site key
RECAPTCHA_SECRET_KEY ReCaptcha secret key
NODE_GA4_KEY GA4 MEASUREMENT ID
NODE_ANALYTICS_UNIVERSAL_KEY Universal Analytics Tracking ID
FACEBOOK_CODE Access code for FaceBook Pixel
LINKEDIN_PIXEL_ID Linkidin identificator
NODE_SMARTLOOK_PROJECT_ID Smartlook project id from smartlook account

๐Ÿ’ป Dev Radiator envs

NAME DESCRIPTION
NODE_DEV_RADIATOR_CRON_STRING Cron string for start dev radiator
NODE_DEV_RADIATOR_GH_TOKEN Github token for request
NODE_DEV_RADIATOR_SLACK_WEBHOOK Slack webhook for send message
NODE_DEV_MONGO_PASSWORD Cloud MongoDB password
NODE_DEV_MONGO_USERNAME Cloud MongoDB username
NODE_DEV_RADIATOR_MONGO Cloud MongoDB url connecting

๐Ÿ“‰ Marketing Radiator envs

NAME DESCRIPTION
RADIATOR_FIRESTORE_AUTH_TYPE
RADIATOR_FIRESTORE_PROJECT_ID
RADIATOR_FIRESTORE_PRIVATE_KEY_ID
RADIATOR_FIRESTORE_PRIVATE_KEY
RADIATOR_FIRESTORE_CLIENT_EMAIL From firestore auth json file
RADIATOR_FIRESTORE_CLIENT_ID
RADIATOR_FIRESTORE_AUTH_URI
RADIATOR_FIRESTORE_TOKEN_URI
RADIATOR_FIRESTORE_AUTH_PROVIDER
RADIATOR_FIRESTORE_CLIENT_CERT_URL
-------------------------------------- -------------------------------------------------------------
RADIATOR_AUTH_TYPE
RADIATOR_AUTH_URI
RADIATOR_CLIENT_CERT_URL
RADIATOR_CLIENT_EMAIL
RADIATOR_CLIENT_ID
RADIATOR_PRIVATE_KEY From google cloud console auth json file
RADIATOR_PRIVATE_KEY_ID
RADIATOR_PROJECT_ID
RADIATOR_PROVIDER_CERT_URL
RADIATOR_TOKEN_URI
-------------------------------------- -------------------------------------------------------------
RADIATOR_FIRESTORE_ID Firestore database ID
SLACK_WEBHOOK_URL Slack webhook for send message from marketing radiator
SLACK_CHANNEL_ID Slack channel id where send message from marketing radiator
RADIATOR_DAILY_DISPATCH_TIME Number when run send report from marketing radiator
REDDIT_CLIENT_ID Reddit client id from API app reddit
REDDIT_CLIENT_SECRET Reddit client secret from API app reddit
REDDIT_USER_NAME Reddit account username
REDDIT_PASSWORD Reddit account password
RADIATOR_QUORA_USER_ID Quora user account ID
RADIATOR_GLASSDOOR_API_KEY API Key from page2api service

Production status checker

NAME DESCRIPTION
CHECK_PRODUCTION_STATUS_CRON_STRING Cron string for start checker
SITE_URL_FOR_CHECK Site url for check
SLACK_CHANNEL_ID_FOR_PROD_CHECK Slack channel id where send message from checker
USERS_TO_BE_MENTIONED Array with objects like [{ "name": "John Doe", :id": "<@slack user id>" }]

Memory usage checker

NAME DESCRIPTION
CHECK_MEMORY_USAGE_CRON_STRING Cron string for start checker
CHECK_MEMORY_USAGE_WHEN_ALARM_PERC Percentage when alarm
CHECK_MEMORY_USAGE_ENABLED true or false
CHECK_MEMORY_USAGE_SIZE_MEM Total memory size in OS

All of these variables must be added to the Heroku hosting or an any others

โš ๏ธ Required variables for building an application

Without these variables the application will not work correctly

NAME DESCRIPTION
NODE_ENV Development variant
NODE_S3_PUBLIC_URL AWS S3 CloudFront public API
NODE_DOMAIN Domain
NODE_HUNTFLOW_RESERVE_VACANCY_ID Huntflow auth reserve vacancy
NODE_EMAIL_HR Email to send messages(cv) to HR department
NODE_EMAIL_CV Email to send messages to CV department
NODE_EMAIL_CONTACT Email to send messages(from leads) to DM department
NODE_EMAIL_MARKETING Email to send messages to Marketing department
NODE_SENTRY_DSN_FRONT Sentry DSN url for send errors
FF_ENVIRONMENT Feature flags environment
NODE_PRISMIC_API Prismic API url
NODE_IP_INFO_TOKEN IP info API token
RECAPTCHA_SITE_KEY Google v3 recaptcha site key
NODE_ANALYTICS_UNIVERSAL_KEY Google Universal Analytics ID
NODE_GA4_KEY Google Analytics 4 ID
FACEBOOK_CODE Facebook code for analytics
NODE_SENDPULSE_ADDRESSBOOKS_ID Sendpulse address book ID

โœ๏ธ Code review

We're have a special "Code Review Regulation" document that help us to review our code more better and professional. Before start working with our team you need to read the document.

๐Ÿš€ Deploy

Staging

To send changes to the staging server, you should merge your branch to the staging branch

Production

To send changes to the staging server, you should merge staging branch into master branch

๐Ÿš“ Testing

Coverage(unit)

Coverage statements Coverage branches Coverage functions Coverage lines

Commands

COMMAND DESCRIPTION
npm run test Run all tests
npm run test:unit Run all unit-tests
npm run test:unit:node Run only server unit-tests
npm run test:unit:browser Run only browser unit-tests
npm run test:staging Run tests && send coverage to slack
npm run test:e2e Run e2e tests
npm run generate:coverage-badges Generate coverage badges

โœจ Linting

We're using some tools for linting our code - ESLint, Sass-Lint

Commands

COMMAND DESCRIPTION
npm run lint Run all linters
npm run lint-es Run only ESLint for js/vue files
npm run lint-vue-scss Run only vue-scss lint
npm run lint-scss Run only core scss lint

๐Ÿบ Snyk

Snyk is a tool for find and fix security vulnerabilities

Commands

COMMAND DESCRIPTION
npm run snyk-protect Run snyk checking

๐Ÿ˜Ž AWS S3

Amazon S3 is used to store video files and pictures of the site.

Official Documentation

Install aws cli

You may install awscli using apt or brew

sudo apt install awscli

or download zip bundle

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" \&& unzip awscli-bundle.zip \&& sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws \&& rm -rf awscli-bundle*

The result should be

aws --version
aws-cli/2.3.6

Setup

The current AWS Access Key ID and AWS Secret Access Key can be requested from the team.

aws configure

AWS will ask for the keys to specify the settings

AWS Access Key ID: Key
AWS Secret Access Key: Key
Default region name: us-west-1
Default output format: json

Or just export the keys, in which case the access will only be in the terminal where the export is made.

export AWS_ACCESS_KEY_ID="key"
export AWS_SECRET_ACCESS_KEY="key"

It remains to update the environment variable and run the site.

In the root of the project should be a file .env, where you insert the variable NODE_S3_PUBLIC_URL

This variable must contain the url, which will be used to access s3 files.

The link through which we will get pictures and videos https://d6xkme6dcvajw.cloudfront.net/

AWS S3 Commands

COMMAND DESCRIPTION
aws s3 ls s3://maddevsio/ Show available folders & files
aws s3 ls s3://maddevsio/ && PRE images/ && PRE videos/ Result
aws s3 cp --acl public-read folder s3://maddevsio/folder/ --recursive Upload folder
aws s3 --recursive mv s3://maddevsio/folder/ s3://maddevsio/folder_2/ Rename folder
aws s3 rm --recursive s3://maddevsio/folder/ Remove folder
aws s3 cp --acl public-read ./folder/name.jpg s3://maddevsio/folder/ Upload file to folder
aws s3 rm s3://maddevsio/folder/name.jpg Remove file
aws s3 sync --acl public-read ./folder s3://maddevsio/folder/ Update files
aws s3 sync s3://maddevsio/folder/ ./folder Downloads all content from s3 /folder to local folder ./folder

๐Ÿณ๏ธ Feature flags

We're used feature-flags for display/hide some features on different environments.

Create flag

For create a new feature flag, you need to open @/featureFlags/config.js file and add your flag into config with the following syntax:

export const config = {
  myFeatureFlag: ["development", "staging"]
};

The name of your feature flag should be key in the config. Environments where your flag should return true should be value of your flag. It's an array of environments. At the moment we have 3 available environments:

  • development - for local development
  • staging - for staging(maddevs.co)
  • production - for production(maddevs.io)

Usage

with <Feature> component

The better option. You can simple use your feature-flag in the templates using globally registered component. Example:

<Feature flag="myFeatureFlag">Some content</Feature>

with featureFlag() method

Also you can use global method in your template:

<div v-if="featureFlag('myFeatureFlag')">Some content</div>

or in the component's code:

export default {
  methods: {
    send() {
      if (featureFlag("myFeatureFlag")) {
        // ...do something
      }
    }
  }
};

๐Ÿณ๏ธ Feature flags for pages

Create flag

For create a new feature flag for pages, you need to open router.config.js file and add your flag into config with the following syntax:

export const routerConfig = [
  {
    path: "/",
    development: true,
    staging: true,
    production: false
  }
];

Then, if a page is unavailable in one of the environments, the page will be removed from the sitemap and a redirect to page 404 will be configured for it.

BEM (Block, Element, Modifier)

BEM (Block, Element, Modifier) is a component-based approach to web development.

For BEM, I advise you to use the following:

  1. "block" - for naming blocks (A functionally independent page component that can be reused. In HTML, blocks are represented by the class attribute. Features:

The block name describes its purpose ("What is it?" โ€” menu or button), not its state ("What does it look like?" โ€” red or big).

Example

<!-- Correct. The `error` block is semantically meaningful -->
<div class="error"></div>

<!-- Incorrect. It describes the appearance -->
<div class="red-text"></div>

The block shouldn't influence its environment, meaning you shouldn't set the external geometry (margin) or positioning for the block. You also shouldn't use CSS tag or ID selectors when using BEM.

  1. "block**element" - ** for naming elements A composite part of a block that can't be used separately from it.

Features:

The element name describes its purpose ("What is this?" โ€” item, text, etc.), not its state ("What type, or what does it look like?" โ€” red, big, etc.).

The structure of an element's full name is block-nameelement-name. The element name is separated from the block name with a double underscore ().

Example

<!-- `search-form` block -->
<form class="search-form">
    <!-- `input` element in the `search-form` block -->
    <input class="search-form__input"/>

    <!-- `button` element in the `search-form` block -->
    <button class="search-form__button">Search</button>
</form>
  1. "block block - modifier" - --modifier for naming modifiers, while the main class of the block/element must be An entity that defines the appearance, state, or behavior of a block or element.

Features:

The modifier name describes its appearance ("What size?" or "Which theme?" and so on โ€” size_s or theme_islands), its state ("How is it different from the others?" โ€” disabled, focused, etc.) and its behavior ("How does it behave?" or "How does it respond to the user?" โ€” such as directions_left-top).

The modifier name is separated from the block or element name by a single underscore (_).

Let's not use:

  • "h2" or "> p" tag selectors
  • minimum nesting through "/deep/"
  • incorrect BEM naming conventions: "block_element" or "block_modifier"

For a detailed study of BEM, visit the website: https://en.bem.info/

๐Ÿ”ฅ SEO-Analyzer

Github action for checks for errors in the html DOM

Running

To run an analyzer you need to execute the following command:

npm run seo-analyze

If you have some problems with SEO you will be notified about that in the console:

โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 100% | ETA: 0s | 233/233

File: dist/clients/case-studies/namba-food/index.html
SEO defects found:
There are 1 <img> tag without alt attribute

Otherwise, you should get success result:

 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 100% | ETA: 0s | 233/233

 No any SEO defect found.

๐Ÿ—„ Prismic

Create and push slices to prismic dashboard

Slice machine dev tools are used to develop and push slices to prismic dashboard.

The main folder for developing slices is located in the following path - client/prismicSlices.
Slices can be divided into categories(libraries) by creating different folders for them inside the client/prismicSlices folder and adding the path to this folders to the sm.json config file.

To develop slices you need to install globally the prismic-cli

npm install -g prismic-cli

After installation you need login to prismic

prismic login

After login you need to run the slices builder dashboard: localhost:9999

npm run slicemachine

or

prismic sm --develop

Also you need to run the storybook dashboard in other terminal: localhost:3003

npm run storybook

Create a new slice in the slices builder dashboard

Edit code of created slice in the project filesystem

Push created slice to prismic from slices builder dashboard

๐Ÿ‘ Additional docs

How to remove link from sitemap.xml

maddevs-nuxt's People

Contributors

antongrushkin avatar kotyunin avatar denisoed avatar vladdomino avatar tangopj avatar zantmad avatar romanchasovitin avatar hektodaleky avatar denisoedovich avatar tshatmanaliev avatar ignatkim avatar oh-cactus avatar m1rotvorez avatar snyk-bot avatar dmhorbachov avatar ernestmaddevs avatar sviatoslav6 avatar halfb00t avatar khalezin avatar wriozumi avatar ally-8253 avatar restpass-spec avatar damilurg avatar kalashnikovisme avatar aleksei-krivov avatar heheksx avatar mglotov avatar gen1us2k 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.