Front-end Devbox Essentials
Tags: frontend, webdev, productivity, devbox
Published: 2024-03-05 09:31:29

Over the years, front-end code development has evolved a lot. Nowadays, frameworks like React, Angular, Vue, Svelte, etc provide a more structured way of building an immersive frontend experience for users. This has led to a substantial amount of code being written on the front end of the application. Having a lot of code on the front end can make it hard to manage. This problem becomes even more aggravated while working in big teams.
Setting up a common dev box configuration for the team can help in collaborating effectively and crafting production-ready code.

This configuration can be categorized into 2 categories :

1. Planning
2. Development

## Planning

This phase includes all the setups a team needs to do to ensure the development experience is smooth. It generally includes the following -
- Setting up an IDE
  - Should be tailored for HTML, CSS, Javascript
  - Should support quick navigation and intellisense
- Finalising collaboration tools to be used for working. Especially explore various tools for screen sharing as pairing on the work needs to be effective. Few of the options are Zoom, Slack huddle etc.
-  Setting up the repo
	- Employ git for version control
- Decide which code formatter (e.g. [Prettier](https://prettier.io/)) are you going to use and make sure all the IDEs being used by your team has that formatter's plugin installed in their IDE. This will maintain unifromity irrespective of the different IDEs.
- Decide which code linter (e.g. [ESlint](https://eslint.org/), [SonarQube](https://www.sonarsource.com/products/sonarqube/) etc.) are you going to use and make sure all the IDEs being used by your team has that formatter's plugin installed in their IDE. This will maintain coding standards uniform irrespective of the different IDEs.
- Have IDE specific config to ensure uniformity. You can refer [this](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) for VScode or you refer [this](https://www.jetbrains.com/help/idea/configure-project-settings.html#share-project-through-vcs) for Intellij.
- Web browsers (Chrome, Brave)
	- Decide web browsers which provide better debugging tools and extensions for react apps such as **[React Dev Tools](https://react.dev/learn/react-developer-tools)** and **[Redux DevTools](https://github.com/reduxjs/redux-devtools)**.

## Development

This phase includes following -

- Decide appropriate build tools (e.g. [Webpack](https://webpack.js.org/), [Rollup](https://rollupjs.org/), and [Vite](https://vitejs.dev/))
	- Simplified setups are available in frameworks like [CRA](https://legacy.reactjs.org/docs/create-a-new-react-app.html#create-react-app) and [NextJS](https://nextjs.org/), [Gatsby](https://www.gatsbyjs.com/) following React conventions.
	- Must have tasks/scripts setup in your package.json. Some of the important scripts include **build, test, local server** etc.
	- Adding pre-commit hooks to have quicker feedback loop on code analysis, running unit tests before committing etc. You can use [husky](https://typicode.github.io/husky/) or [pre-commit](https://pre-commit.com/) for this.
	- Good to have on local dev box setup, but must have on CI setup.
- Decide common package manager for a team (e.g. [npm](https://www.npmjs.com/), [yarn](https://yarnpkg.com/))
	- Having multiple package managers may result in package conflicts
- Decide Test Framework
	- Choose a testing framework like [Jest](https://jestjs.io/) and React Testing Library([RTL](https://testing-library.com/docs/react-testing-library/intro/)) for comprehensive testing. Use RTL so that it helps your team in writing behaviour driven tests.
	- Ensure the framework has good mocking and stubbing support along with an extensive set of “matchers” for writing assertions
	- Also decide on api mocking framework. You can use [msw](https://mswjs.io/)/[nock](https://github.com/nock/nock) etc. for this purpose.
- Decide API mocking framework
	- It helps to mock API so that front-end does not rely on back-end API completion. You can use msw/[miragejs](https://miragejs.com/) etc. for this purpose.
- Type Checker
	- Consider adding [Typescript](https://www.typescriptlang.org/) to your project for having type checking capabilities
	- Ensure your IDE has plugins installed to get real time feedback
- Containerize your application
	- Helps in making your app independent of local setup
	- Also helps in setting up app locally for new team members
- Accessibility Tools
	- Prioritize accessibility by incorporating tools like the [ESLint accessibility plugin](https://www.npmjs.com/package/eslint-plugin-jsx-a11y), [axe-core](https://github.com/dequelabs/axe-core)
	- Also use browser tools such as [WAVE](https://wave.webaim.org/extension/) or [LERA](https://chromewebstore.google.com/detail/lera/neninfnjnhknniefcpognoooalfdaofc) etc.

**This comprehensive Dev box setup ensures a smooth and efficient front-end development workflow, fostering collaboration, code quality, and adherence to best practices.**