8000 GitHub - HDRUK/gateway-web
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

HDRUK/gateway-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LICENCE Support

HDR UK Gateway - Frontend (Next.js)

Welcome to the HDR UK Gateway Frontend, a Next.js React application that powers the user interface of the HDR UK Gateway. This application facilitates seamless interaction with the Gateway API using:

  • fetch for efficient server-side communication.
  • SWR for optimized client-side data fetching and state management.
  • i18next for internationalization and multi-language support.
  • Jest for unit and snapshot testing.

This project utilizes the App Router of Next.js, providing improved performance and flexibility over the traditional Pages Router.

πŸš€ Getting Started

Follow these steps to install and run the project on your local machine.

Prerequisites

Ensure you have the following installed:

  • Node.js (Latest LTS version recommended)
  • npm or yarn (Package manager)
  • Git (For cloning the repository)

Installation & Setup

1️⃣ Clone the repository

Open a terminal and execute:

git clone https://github.com/HDRUK/gateway-web

2️⃣ Navigate to the project directory

cd gateway-web

3️⃣ Set up environment variables

Create a .env.local file and populate it with appropriate values, using .env.example as a reference.

4️⃣ Install dependencies

Run the following command to install the required packages:

npm install

5️⃣ Start the development server

Once dependencies are installed, start the application using:

npm run dev

By default, the application will be available at http://localhost:3000.

πŸ›  Available Scripts

In the project directory, you can run the following commands:

  • npm run dev – Starts the development server.
  • npm run build – Builds the application for production.
  • npm start – Runs the compiled production build.
  • npm run lint – Runs ESLint to check for code quality issues.
  • npm run lint:fix – Runs ESLint to automatically fix simple lint issues.
  • npm test – Runs the Jest test suite.
  • npm test:snapshot – Runs the Jest test suite to update snapshots.

For a full list of scripts, run npm run.

πŸ“‚ Project Structure

A brief overview of the project's folder structure:

β”œβ”€β”€ app/                # Next.js pages/api routes/actions
β”œβ”€β”€ components/         # Reusable React components
β”œβ”€β”€ config/             # Reusable configuration throughout the gateway
β”œβ”€β”€ const/              # Constant values
β”œβ”€β”€ hooks/              # React hooks
β”œβ”€β”€ interfaces/         # Types and interfaces
β”œβ”€β”€ modules/            # Module components
β”œβ”€β”€ pages/api           # Legacy APIs that need adapting to App Router APIs
β”œβ”€β”€ providers/          # Provider Wrappers, such as SWR, Snackbars...
β”œβ”€β”€ public/             # Static assets (images, fonts, etc.)
β”œβ”€β”€ seeded/             # Any seeded data during the build process, such as sitemap
β”œβ”€β”€ services/           # Services and clients such as API calls
β”œβ”€β”€ styles/             # Global styles and theme settings
β”œβ”€β”€ types/              # Types and interfaces
β”œβ”€β”€ utils/              # Helper functions and utilities
β”œβ”€β”€ .env.local.example  # Sample environment variables file
β”œβ”€β”€ next.config.js      # Next.js configuration
β”œβ”€β”€ package.json        # Project dependencies and scripts
└── README.md           # Project documentation

🧩 Internationalization (i18next)

This project uses i18next for multilingual support, allowing for seamless language switching and localization. Translations are managed within the /src/config/messages/ directory and integrated using the i18next library.

πŸ§ͺ Testing with Jest

We use Jest for unit testing and React Testing Library for component testing. Snapshot testing is included to ensure UI consistency.

To run tests:

npm test

To update snapshots:

npm test:snapshot

πŸ“– Additional Resources


For further support, please reach out via HDR UK or raise a bug or even better raise a PR!

0