A Vue app build from the Vue CLI for tracking and visualizing blood pressure readings over time. The app is powered by Firebase and available at blood-pressure-prod.web.app.
Authentication is handled through Firebase Auth and is open for your own usage. There is not any obfuscation of data happening, however, so if you're worried about prying eyes, maybe use a disposable email address service like Guerrilla Mail. Or see below for configuring to your own Firebase project.
npm installThe project will not run without first setting certain environment variables via the CLI or a .env file. This command runs ./scripts/build-env.js via Node to set environment variables to the app using dotenv.
npm run build:envNote: These environment variables currently match Firebase's app config object.
apiKey: A Firebase project's API keyauthDomain: The Firebase project's authentication domaindatabaseURL: The Firebase project's database URLprojectId: The Firebase project IDappId: Firebase web-based app IDmeasurementId: Associate the Firebase app with a Google Analytics property
Note: Environment configuration is built before each serve command.
npm run serveNote: Environment configuration is built before each build command.
npm run build:appThe app is configured for deployment to Firebase; its hosting, database, and user authentication is run through the platform.
npm run deploy:hostingFirebase's Cloud Firestore is used for the database. Security rules are located at ./firestore.rules and are set to limit user access to owned data only.
npm run deploy:databaseUnit tests and mocks are created with Jest and use Vue's Test Utils library for simplification.
npm run test:unitTo run a single suite:
npm run test:unit -- SUITE_NAMEFor debugging in VS Code, use the following configuration in launch.json:
{
"type": "chrome",
"request": "launch",
"name": "vuejs: chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*",
"webpack:///src/*": "${webRoot}/*",
"webpack:///*": "*",
"webpack:///./~/*": "${webRoot}/node_modules/*"
}
}Linting follow Vue CLI's prescribed rules as well as Prettier with a touch of personal customizations on top.
npm run lintComponents in src/views should be associated with routes and lean towards being "smart". Data fetching and setup happens in these components, but display elements should be implemented as "dumb" components that are passed down data through props.
"Dumb" components should be defined in src/components or as children of feature modules.
The src/core directory should contain application business logic.
Routing is implemented with Vue's official Router and is configured at ./src/router/index.ts. The state's mutation and action types are located at ./src/router/types.ts.
State is managed using Vuex and is set up at ./src/store/index.ts. Vuex is a bit of overkill for this app, but it was interesting to compare to Angular's NGRX.
The app is built with TypeScript and classes using vue-class-component and vue-property-decorator. The intent was compare against Angular's style of component architecture.
Looking back, it might make more sense to stick to the object-based format that the Vue docs lead with. This approach involved a steeper, less-documented learning curve.