Skip to content

nicholas5538/fp-voucher-FE

Repository files navigation

Table Of Contents

Quick links

Context

NOTE: Google Oauth2 does not work well with the current 3rd party React library, hence you might need to log in twice to use the app.

We decided to create an admin portal that allows user to use the following features with relative ease.

  1. A data table that displays all the vouchers
  2. Create new voucher for the system
  3. Update any existing vouchers
  4. Delete any existing vouchers
  5. A dummy checkout page to show that the vouchers can be applied
  • PostgreSQL is currently our choice of database, and we are calling REST API endpoints to perform CRUD operations on it.

Getting Started

Environment Setup

2 ways to run the apps

  1. Install Docker Desktop

  2. With package manager pnpm

    • Install any version of node that is >= 14.0.0.

    💁 Tip: You can use nvm to easily manage multiple versions of node. Once installed, run nvm use in the project directory.

    💁 npm install -g pnpm

Repository Setup

Once you have your SSH key added and environment setup, you can clone the repository.

git clone https://github.com/nicholas5538/fp-voucher-FE.git
cd fp-voucher-FE

Developing

Once you have set up the repo, you're ready to start developing. Starting the development environment is managed by the following command(s).

  • With Docker (recommended)
# Docker compose command
docker compose up -d --build

# Or you could build your own image
docker build --compress -t <image name> --target dev .
# For Windows PowerShell: ${pwd}, the rest: $(pwd)
docker run -d -p 3000:3000 -v $(pwd):/home/node/app --name <container name> fp-voucher-fe-dev
  • With pnpm
pnpm run i # Only run this when you have not installed any dependencies
pnpm run dev

The dev command will start the application in your local environment (port 5173).

Frequently Used Scripts

In addition to the dev command, there are other scripts available in the package.json. Some of the most common you might get to use are:

  • pnpm run format - Check prettier formatting through all the codes

    💁 Tip: use pnpm run format:fix to run auto prettier formatting across all the codes

  • pnpm run lint - Runs TS linter through all the codes

Additional Documentations