Skip to content

Production project deployment

Prerequisites

  • Node.js: Required for package management and running the build server (v18+ recommended).
  • npm: Node Package Manager.
  • Git: For downloading the source code.

Download & Setup

  1. Clone the Repository Download the project source code to your local machine.

    bash
    git clone <repository-url>
    cd united-non-custodial-front
  2. Install Dependencies Install the required Node.js packages.

    bash
    npm install
  3. Environment Configuration Defined in the setup documentation, this interface maps environment variables to internal configuration.

    • cardsKey: Cryptographic key.
    • cardsIvKey: Initialization vector.
    • environment: Runtime environment name.

    The application relies on specific environment variables. You can export them in your shell session before running the application.

    bash
    export UNITED_CARDS_KEY="your_key_here"
    export UNITED_CARDS_IV_KEY="your_iv_key_here"
    export ENVIRONMENT_NAME="production"

    Production Environment Differences

    • Enable Obfuscation.
    • Removes all console.log calls.
    • Removes debugger statements.
    • Removes comments from the output.

Execution

  1. Production Build To compile and minify the application for deployment (artifacts are saved to public/ directory`):
    bash
    npm run build
  2. Deploy on hosting Copy compiled files and directories from public/ directory to your hosting provider root directory

Example Deploying to Cloudflare Pages

Cloudflare Pages is an excellent alternative for hosting Vite applications.

Prerequisites:

  • A Cloudflare account.
  • (Optional) Wrangler CLI: npm install -g wrangler

Option A: Git Integration (Recommended)

  1. Push your code to a GitHub/GitLab repository.
  2. Log in to the Cloudflare Dashboard and go to Pages.
  3. Click Create a project > Connect to Git.
  4. Select your repository.
  5. Build Settings:
    • Framework Preset: Vite
    • Build command: npm run build (or make build)
    • Output directory: public (Note: Ypu can change or verify Output directory in vite.config.js.).
  6. Click Save and Deploy.

Option B: Direct Upload (CLI)

  1. Build the project locally:
    bash
    make build
  2. Deploy using Wrangler:
    bash
    # Assuming 'public' is the build output folder
    npx wrangler pages deploy public --project-name united-network