Skip to content

Latest commit

 

History

History
384 lines (273 loc) · 14.3 KB

README.md

File metadata and controls

384 lines (273 loc) · 14.3 KB

KataIX - Posts & Users with Vue2 + Typescript

Deployment Validation

Contents

  1. 🖊️ Description
  2. 📓 Documentation
  3. 💡 Objective
    1. 🤩 Technical Goals
  4. ✨ Features
  5. 🎨 Design Pattern
  6. 📚 Tech stack
    1. 📱 Frontend
    2. 🧼 Clean code
    3. 🎬 CI/CD
  7. 🙌 Disclaimer!!
  8. 🔎 Quick tour
    1. 🛖 Home
    2. 😎 Author
    3. 📰 Posts
    4. 📜 Post detail
    5. 🧑 User
    6. 📲 Contact
  9. ⚙️ How to set it up?
    1. 📋 Pre-requisites
    2. 🪛 Install
    3. 🛠️ Use
  10. 🌐 How to deploy?
    1. ⚠️ Notice
    2. ☁️ Using the CI/CD
  11. ☑️ Testing
    1. 🗒️ How to execute all the tests in the system?
    2. ✔️ How to create a new test bench?
    3. ✔️ How to create a new test?
  12. 🔖 Usage
    1. 🛠️ Compiles and hot-reloads for development
    2. 📦 Compiles and minifies for production
    3. ☑️ Run your unit tests
    4. 🖥️ Run your end-to-end tests
    5. ✍️ Lints and fixes files
    6. 🧰 Customize configuration
  13. 🧐 Improvements
  14. 🥳 Conclusions
  15. 😁 Credits

🖊️ Description

⬆ Back to top

It's the final project from a Bootcamp for Frontend in Vue. The idea is to develop a fully fleshed webapp using vue and other libraries that we saw along the way. As to provide content, jsonplaceholder will be used.

The changes are registered at the CHANGELOG, even though is not minute perfect, it's an orientation of the project's progress. I'm pretty sure there's plenty of little details that I've left in the drawer.

📓 Documentation

⬆ Back to top

For the docs please refer to the /docs folder, or with this link.

💡 Objective

⬆ Back to top

The main objective is to develop a webapp using vue. And also to develop a frontend project from start to finish.

🤩 Technical Goals

⬆ Back to the section

  • Use Vue as the main frontend framework, Vue 2 to be specific.
  • Route the pages, for that, we'll use Vue Router.
  • Use axios to fetch information, VueAxios if possible.
  • As to store information in memory, we'll use vuex, a state-management library for vue.
  • Create custom components as we need them along the way.
  • Use bootstrap or a similar library, tailwind may be an option, but bootstrap is far more popular.
  • Use BEM (Block__Element--Modifier).

✨ Features

⬆ Back to top

  • Contact page
    • A contact formulary that allows the user to contact us. It's validated in real time for a better user experience.
  • Posts page
    • A page to visualize all of the posts and visualize them individually. It also allows for user (the post's author) visualization and to see which posts they wrote.
  • Author page
    • The author of the application, a little description about me.
  • Navigation layout
    • A navbar from where we can go everywhere we want in the app.
  • Footer
    • A layout with the copyrights and some social media links.

The improvements are touched upon later on, 🧐 Improvements.

🎨 Design Pattern

⬆ Back to top

  1. Functionality is always the first priority, there's nothing to style without features. It's not a design concept, but it's worth keeping in mind.
  2. UX goes before the UI, a simple, native, uggly button can do if it's where it's supposed to be. UX may be the most important part of a feature (visually-wise).
  3. UI goes last, it's usually a matter of browsing to get a moodboard (even mentally) of what you're looking for.

📚 Tech stack

⬆ Back to top

  • Vue2 + TypeScript
  • The Vue ecosystem (vuex, VueAxios, vue-router)
  • Bootstrap

Made with vue-cli, first install the vue/cli package:

npm install -g @vue/cli
# OR
yarn global add @vue/cli

So that you can later create the project, or, for our case scenario, modify it.

vue create hello-world
vue add your-fav-package

📱 Frontend

⬆ Back to the section

  • TypeScript
    • The static typed version of JavaScript, good for preventing errors before execution, and easier usage (since you should always know exactly what you're working with!)
  • vue.js
    • One of the most used frontend framework, gaining more and more traction by the minute and for good reasons.
  • Vue's ecosystem
    • vue-router
      • an intuitive approach to routing that allows and "enforces" for array-usage for routing.
    • vuex
      • a state management library that's being slowly replaced but pinia, still, it's a good state mangement library.
  • bootstrap-vue
    • Bootstrap components and it's design pattern and implementations. jest + cypress
    • The full package for a complete frontend testing experience, unit + e2e/integration.

🧼 Clean code

⬆ Back to the section

  • eslint (airbnb) + prettier
    • Having a good style in the code is crucial for a scalable and maintanable codebase, and to automate the process as to avoid mistakes, it's almost a must nowadays.

🎬 CI/CD

⬆ Back to the section

  • Github Actions
    • A free CI/CD, and easy to configure for any public github repository, it's a new trend and with tons of community contributions.

🙌 Disclaimer!!

⬆ Back to top

  • I do not own any of the data presented, therefore all the credit goes to it's rightful author typicode.
  • Github Pages doesn't retain the vue-router information on my application, only the homepage loads properly.
  • For the theme to change on responsive devices you'll have to adapt the theme on the setting's device and refresh the application.
  • I'm no QA, the testing side of the application has a lot of room to grow and explore, of that I'm sure.

🔎 Quick tour

⬆ Back to top

Just a quick view on what's the application visual feel. I'll use the dark theme as an example since is the one I've worked the most on and it's also the one I like the most, even though the design wasn't the main point of this project.

🛖 Home

⬆ Back to the section

Home

Home

😎 Author

⬆ Back to the section

Author

Author

📰 Posts

⬆ Back to the section

Posts

Posts

📜 Post detail

⬆ Back to the section

Post detail

Post detail

🧑 User

⬆ Back to the section

User

User

📲 Contact

⬆ Back to the section

Contact form filled

⚙️ How to set it up?

⬆ Back to top

You may want to check it out locally, if that were to be the case, this section will clarify how to do just that.

📋 Pre-requisites

⬆ Back to the section

  • node.js >= 15.x.x compatibility.

🪛 Install

⬆ Back to the section

In the folder that you may want the project, execute the following command (on Git BASH if you're running a Windows).

This will clone (download) the repository locally on your device

git clone https://github.com/jofaval/gh-btc-vue-final.git

Then you'll need to install the dependencies (if node.js is not installed, please do so before this step at, node.js). I'm using the version 15.14.0, which you can find at 15.14.0

cd gh-btc-vue-final
npm install

🛠️ Use

⬆ Back to the section

For the usage take a look at the 🔖 Usage

🌐 How to deploy?

⬆ Back to top

Deployment is the process in which, the project gets ready for ✨production✨ and it's available for your target audiance.

⚠️ Notice

⬆ Back to the section

  • The public/ folder must always be the main one to use.
  • If there's any media file that you want to add, use src/assets/.

☁️ Using the CI/CD

⬆ Back to the section

Merge the changes to main.

☑️ Testing

⬆ Back to top

All the tests files will end in .ts, since we'll be using TypeScript.

  • Unit tests files will end in .spec.ts
  • End to end tests files will end in .e2e.ts

🗒️ How to execute all the tests in the system?

⬆ Back to the section

You can execute the following command, but I wouldn't recomend it since it will run unit tests and then e2e tests, I prefer to execute them on their own.

npm test

You can check out the 🔖 Usage section for more details about it.

✔️ How to create a new test bench?

⬆ Back to the section

Create a new describe call with the name and lambda function

describe('Customer', () => {
});

✔️ How to create a new test?

⬆ Back to the section

Create a new it call with all the asserts you want

describe('Customer', () => {
  it('should display all the information', () => {
    expect(<Customer />).not.toBe(null);
  })
});

🔖 Usage

⬆ Back to top

Set up the project by executing the following command at root level, which you should have already done if you already did the ⚙️ How to set it up?

npm install

🛠️ Compiles and hot-reloads for development

⬆ Back to the section

npm run serve

Runs the app in the development mode. Open http://localhost:3000 to view it in your browser.

📦 Compiles and minifies for production

⬆ Back to the section

npm run build

Used to build the solution into an optimized and compressed version

☑️ Run your unit tests

⬆ Back to the section

npm run test:unit

Runs all the unit test in the system and returns the information.

🖥️ Run your end-to-end tests

⬆ Back to the section

npm run test:e2e

Runs all the e2e test in the system and returns the information.

✍️ Lints and fixes files

⬆ Back to the section

npm run lint

Lints all of the files so they're quality code

🧰 Customize configuration

⬆ Back to the section

See Configuration Reference.

🧐 Improvements

⬆ Back to top

Some improvements that could be made to either the applicaion or the architecture that, either by time, or, mostly, level of experience with the stack, won't be developed:

  • Searchbar for posts and users. That displays results grouped by posts and users so that the real user can find the match for what they may be looking for
  • Generalize more the components, right now I feel they're to specific, I'd love nothing more than to make them as customizable as possible, but they're fine as they are and it may be overcomplicating the project.
  • Improve the overall visual style and feel with a better ui, and probably UX.
  • Greatly improve the responsive design so that it's as user-friendly as possible.
  • Add internalization, strings are hardcoded and that's not scalable, let alone ready for mutlilanguage.
  • Improve the form validation's user experience.
  • Create components using arrays so that the logic is abstracted as possible.

🥳 Conclusions

⬆ Back to top

I barely had any sustantial idea of how Vue truly worked, how a beginner -> intermediate webapp in Vue, was made, coming from React there were some habits I had to take off, while there were solutions to problems I was used to. I can see why Vue it's such a strong framework and I'm starting to understand where it's power comes from.

Single File Components where kind of a shock, but in a good way, the official documentation is marvelous, and it's ecosystem it's truly one of a kind, it can seriously, not only rival React's one, but beat it. But, at the end of the day, they are two different approaches to the same goal, each with it's own pros and cons.

😁 Credits

⬆ Back to top