Skip to content

alejogiraldoo/Unit-Converter

Repository files navigation

Unit Converter Web App

A robust, server-rendered web application that allows users to seamlessly convert values between different units of measurement, including Length, Weight, and Temperature.

This project is a solution to the Unit Converter challenge from Roadmap.sh.

Features

  • Server-Side Processing: The application handles form submissions and calculates conversions on the backend, returning the processed data to the view.
  • Vite-Powered Bundling: Extremely fast development environment and optimized production builds.
  • Multiple Unit Categories:
    • Length: millimeter, centimeter, meter, kilometer, inch, foot, yard, mile.
    • Weight: milligram, gram, kilogram, ounce, pound.
    • Temperature: Celsius, Fahrenheit, Kelvin.
  • No Database Required: Lightweight execution focusing on pure conversion logic.
  • Strict Code Quality: Enforced via ESLint, Prettier, and Husky pre-commit hooks.

Tech Stack & Tooling

  • Language: TypeScript (running as ES Modules).
  • Runtime: Node.js.
  • Development Tooling: .
  • Code Quality: ESLint, Prettier.
  • Git Hooks: Husky.

Installation & Setup

Follow these steps to run the project locally:

  1. Clone the repository:
git clone https://github.com/alejogiraldoo/Unit-Converter.git
cd unit-converter
  1. Install dependencies:
npm install

Note: This will also automatically trigger the prepare script to set up Husky git hooks.

  1. Run in Development Mode:
npm run dev

This starts the Vite development server for real-time updates.

  1. Build for Production:
npm run build

Runs the TypeScript compiler and Vite build to generate optimized assets.

  1. Linting & Formatting:
npm run preview

Starts a local server to preview the production-ready application.

  1. Linting & Formatting:
npm run lint

Automatically fixes linting errors and formats the code according to ESLint and Prettier rules.

Architectural Patterns

To maintain clean code and separate the conversion logic cleanly, this project relies on specific design patterns:

  • Strategy Pattern: Used to define a family of conversion algorithms (e.g., converting Celsius to Fahrenheit vs. Meters to Yards), encapsulating each one, and making them interchangeable based on user input.

  • Template Method: Defines the skeleton of the conversion process in a base class, letting subclasses override specific steps of the calculation without changing the overall algorithm structure.

Study References & Resources:

Design Patterns

HTML & Javascript

Linter & Formatting Setup

Deploy

Static Deploy

About

A robust, server-rendered web application that allows users to seamlessly convert values between different units of measurement, including Length, Weight, and Temperature.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors