heshamelmasry77 / RateMate-front-end

💱 RateMate Front-End – A modern, responsive front-end for currency conversion and historical exchange rate tracking, powered by React and Vite, with Redux for state management and TailwindCSS for sleek styling. Connected to a secure Rails API backend with JWT authentication.
https://rate-mate-front-end.vercel.app
0 stars 0 forks source link

RateMate Front-End

RateMate Front-End is a front-end application built using React.js, Vite, Tailwind CSS, Prettier, ESLint, Husky, Redux Toolkit, and React Router. It is the user interface for interacting with the RateMate API, providing a seamless experience for currency conversions. The app is deployed on Vercel and can be accessed live.

Live Version: RateMate Front-End

Features

Project Structure

RateMate-front-end/
├── dist/                # Distribution folder
├── node_modules/        # Dependencies
├── public/
│   └── index.html       # Main HTML file
├── src/                 # Source code
│   ├── assets/
│   │   └── react.svg    # Sample React logo
│   ├── components/      # Reusable components
│   │   ├── Navbar.jsx   # Navigation component
│   │   ├── SignIn.jsx   # Sign In form
│   │   ├── SignUp.jsx   # Sign Up form
│   │   └── ProtectedRoute.jsx # Protected route component
│   ├── pages/           # Page components for routes
│   │   ├── HomePage.jsx
│   │   ├── SignInPage.jsx
│   │   ├── RegisterPage.jsx
│   │   └── CheckCurrencyHistory.jsx
│   ├── services/        # API call services
│   │   └── authService.js # Handles sign-in and sign-up authentication services
│   ├── store/           # Redux store configuration
│   │   ├── authSlice.js  # Handles auth state management
│   │   └── store.js      # Redux store configuration
│   ├── App.css          # Application-specific styles
│   ├── App.jsx          # Root React component with routing
│   ├── index.css        # Global CSS styles
│   └── main.jsx         # Main entry point for the React app
├── .gitignore           # Files and folders to ignore in git
├── .prettierignore      # Files to ignore for Prettier
├── .prettierrc          # Prettier configuration
├── eslint.config.js     # ESLint configuration
├── index.html           # Main HTML file
├── package.json         # Dependencies and scripts
├── postcss.config.js    # PostCSS configuration
├── README.md            # Project documentation
├── tailwind.config.js   # Tailwind CSS configuration
└── vite.config.js       # Vite configuration

Environment Setup

Before running the project, you need to create a .env file in the root of the project and add the following environment variables:

VITE_FIXER_API_KEY=your_fixer_api_key
VITE_FIXER_API_BASE_URL=https://data.fixer.io/api
VITE_API_BASE_URL=http://localhost:3000/api/v1

Fixer.io API Key

Routes

The app uses React Router to handle client-side routing. The available routes include:

Protected routes (accessible only after login):

Services Folder

The src/services folder handles API interactions, specifically authentication for the RateMate API. It includes two main services:

Both services interact with the backend authentication API and handle errors such as invalid credentials or existing user conflicts.

Getting Started

Prerequisites

Make sure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/heshamelmasry77/RateMate-front-end.git
    cd RateMate-front-end
  2. Install dependencies:

    npm install
  3. Create a .env file:

    Add your environment variables in the .env file as mentioned above, including your Fixer.io API key.

  4. Run the development server:

    npm run dev

    The application will be available at http://localhost:3000.

Build for Production

To create a production build, run:

npm run build

Format Code with Prettier

To format your code using Prettier, run:

npm run format

This will automatically format your code according to the configured rules.

Husky

Husky is used to manage Git hooks, ensuring that linting and formatting rules are followed before committing changes.

Redux Toolkit

Redux Toolkit is used for managing the application's state in a scalable way. The store is located in the src/store directory and includes an authSlice for handling user authentication.

React Router

React Router is used for client-side routing. The application includes the following routes:

Protected routes:

Deployment

The project is deployed on Vercel.

Live Version: RateMate Front-End


License

This project is open-sourced and available under the MIT license.