Skip to content

Invoice-Liquidity-Network/ILN-Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

461 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Invoice Liquidity Network (ILN) Frontend

An open-source invoice factoring protocol built on the Stellar network. ILN bridges the gap between freelancers seeking immediate payment and liquidity providers looking for short-term yields.


🎨 Creative North Star: "The Fiscal Atelier"

The user interface follows a curated design system strategy known as The Fiscal Atelier. Rather than standard sterile, template-locked fintech designs, ILN provides a bespoke workspace where precision meets editorial warmth.

  • Color & Tonal Architecture: Rooted in a "Warm Industrial" aesthetic combining structural Navy/Slate with warm parchment grays.
  • The "No-Line" Rule: The layout explicitly avoids 1px borders for containment, using background shifts (surface, surface-container-low, surface-container-high) to create architectural boundaries.
  • Typography Dialogue: Pairs the editorial authority of the Newsreader serif typeface for display statements and data points with the functional clarity of the Manrope sans-serif.

For a deep dive into layout grids, elevation layers, and color tokens, read the full DESIGN.md document.


πŸ›  Tech Stack


πŸ— Application Architecture

For a deep dive into data flows, component interactions, and key trade-offs, refer to the Frontend Architecture Overview.

The application is structured logically to support multiple participant roles (freelancers, payers, liquidity providers, and governance administrators).

πŸ“ Directory Layout

β”œβ”€β”€ app/                      # Next.js App Router root
β”‚   β”œβ”€β”€ admin/                # Admin portal (parameters, contract governance)
β”‚   β”œβ”€β”€ analytics/            # Cash flow & volume charts
β”‚   β”œβ”€β”€ api/                  # API endpoints (reminders, feedback)
β”‚   β”œβ”€β”€ freelancer/           # Freelancer dashboard & invoice submission
β”‚   β”œβ”€β”€ governance/           # Voting portal
β”‚   β”œβ”€β”€ lp/                   # Liquidity Provider portfolio dashboard
β”‚   β”œβ”€β”€ marketplace/          # Open invoices explorer
β”‚   β”œβ”€β”€ payer/                # Payer dashboard & email reminders opt-in
β”‚   β”œβ”€β”€ profile/              # User settings & reputation profiles
β”‚   β”œβ”€β”€ submit/               # Submitter checkout & confirmation flows
β”‚   └── Providers.tsx         # TanStack Query & MSW Provider setup
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/           # Reusable UI components (Bells, Drawers, Badges)
β”‚   β”œβ”€β”€ context/              # Global React Contexts (Wallet, Notifications, Toasts)
β”‚   β”œβ”€β”€ hooks/                # Custom React Hooks & background polling
β”‚   β”œβ”€β”€ lib/                  # Services layer (Stellar SDK, Supabase client, Horizon)
β”‚   └── utils/                # General helpers (reputation decay, health checks)

🧩 Core Component Layers

  1. Smart Contract Layer (src/lib/invoice-nft.ts & src/lib/contract/)

    • Connects frontend actions to the Soroban smart contract.
    • Reconstructs Invoice NFT metadata and tracks mint/burn/transfer event history by scanning the Horizon transaction logs and simulating Soroban contract invocations.
  2. State & Context Layer (src/context/)

    • WalletContext: Monitors Freighter wallet connection, active address, and queries multi-token balances (USDC, EURC, XLM) on Stellar.
    • NotificationContext: Handles in-app notification center persistence via localStorage (caps at 20 logs).
    • ToastContext: Powers non-blocking alerts.
  3. Background Polling & Sync (src/hooks/usePositionPolling.ts)

    • Monitors state transitions of funded invoices (e.g. Funded -> Paid, Funded -> Defaulted, or Funded -> Disputed) for the connected LP. It runs queries every 60 seconds and notifies the LP about due date expiration.
  4. Payer Email Reminders (app/api/reminders/)

    • Allows payers to opt-in using their email. A background cron script checks for funded invoices due in 72 hours and 24 hours, queries preferences from a Supabase table, sends warning templates via Resend, and logs records to prevent duplicate deliveries.

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm

1. Install Dependencies

npm install

2. Configure Environment Variables

Copy .env.example to .env.local (see the Environment Variables section below for details):

cp .env.example .env.local

3. Run Development Server

npm run dev

Open http://localhost:3000 with your browser.

4. Running Tests

  • Unit & Snapshot Tests (Vitest):
    npm test
    To update Vitest snapshot files after intentional UI changes, run:
    npm test -- --update-snapshots
  • End-to-End Tests (Playwright):
    npm run test:e2e

5. Storybook & Visual Regression

Storybook and Chromatic are used to check UI components for regressions.

  • Start Storybook locally:
    npm run storybook
  • Run visual regression checks:
    npm run chromatic

πŸ”‘ Environment Variables Reference

Here is a detailed guide of the configuration options available:

🌐 Stellar & Smart Contract Settings

Variable Default Value Description
NEXT_PUBLIC_CONTRACT_ID CD3TE3IAHM737P236XZL2OYU275ZKD6MN7YH7PYYAXYIGEH55OPEWYJC The primary Invoice Factoring smart contract ID on Soroban.
NEXT_PUBLIC_NETWORK_PASSPHRASE Test SDF Network ; September 2015 Stellar network identifier passphrase.
NEXT_PUBLIC_RPC_URL https://soroban-testnet.stellar.org Soroban RPC server endpoint.
NEXT_PUBLIC_NETWORK_NAME TESTNET Descriptive name of the active Stellar network.
NEXT_PUBLIC_STELLAR_NETWORK testnet Network type identifier (testnet, public).
NEXT_PUBLIC_TESTNET_USDC_TOKEN_ID CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75 Asset contract ID for USDC on testnet.
NEXT_PUBLIC_TESTNET_EURC_TOKEN_ID GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP Asset contract ID for EURC on testnet.
NEXT_PUBLIC_TESTNET_XLM_TOKEN_ID native-xlm Token identifier for Native XLM.
NEXT_PUBLIC_GOVERNANCE_ADMIN_ADDRESS GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF Admin fallback address for parameters governance.
NEXT_PUBLIC_INSURANCE_POOL_ENABLED false Enables/disables the liquidity insurance pooling feature.
NEXT_PUBLIC_NFT_ENABLED false Set to true to enable Soroban Invoice NFT metadata displays.
NEXT_PUBLIC_NFT_CONTRACT_ID Defaults to contract ID Contract ID for Invoice NFTs (if separated from primary).
NEXT_PUBLIC_NFT_METADATA_METHOD token_uri Contract function that returns token metadata URI.
NEXT_PUBLIC_NFT_EVENT_HINTS "" Hints helper (e.g., mint:Minted;transfer:Transfer;burn:Burned).

πŸ—„οΈ Notifications, Databases & Email (Backend/Cron)

Variable Description
NEXT_PUBLIC_SUPABASE_URL The endpoint URL for the Supabase database.
NEXT_PUBLIC_SUPABASE_ANON_KEY Anonymous browser-safe public key for Supabase.
SUPABASE_SERVICE_ROLE_KEY Backend service key used by reminder crons to bypass RLS policies.
RESEND_API_KEY API key from Resend.com used to dispatch payer reminder emails.
CRON_SECRET Secret token to secure /api/reminders GET trigger from unauthorized calls.
NOTIFICATION_API External backend base URL to fetch notifications.
INDEXER_URL Base API URL of the ILN contract data indexer.
NEXT_PUBLIC_INDEXER_API_URL Public indexer endpoint for activity feeds and analytics charts.
NEXT_PUBLIC_APP_URL Base URL of the deployed application (defaults to https://app.iln.finance).

πŸ§ͺ Testing & Analytics

Variable Description
NEXT_PUBLIC_API_MOCKING Set to enabled to run MSW mocks in local development.
NEXT_PUBLIC_ORACLE_ENABLED Set to true to display Oracle verification badges.
GITHUB_TOKEN / GITHUB_OWNER / GITHUB_REPO Secrets used by the feedback widget to raise GitHub issues directly.

πŸ“Έ Screenshots

πŸ“Š Liquidity Provider Dashboard

Provides LPs with real-time portfolio metrics, cash flow analysis, liquidity meters, and active funding statuses. Liquidity Provider Dashboard

✍️ Freelancer Dashboard

Allows freelancers to manage invoice factoring parameters, submit new invoices, view reputation ratings, and review cash advance details. Freelancer Dashboard

πŸ” Marketplace Explorer

A central marketplace listing all active open invoices waiting for funding, detailed interest rates, and risk rankings. Marketplace Explorer


πŸ”— Useful Links & Documentation

  • Getting Started Guide: Refer to the Quick Start section.
  • Component Library (Storybook): Browse the full component library with interactive controls, variants, and a11y checks at the published Storybook (deployed from main).
  • Frontend Architecture Overview: Learn about our architecture design and libraries in docs/architecture.md.
  • Contribution Guidelines: Read CONTRIBUTING.md for comprehensive setup instructions, testing standards, code style guidelines, Stellar-specific setup, and development workflow.
  • Visual Regression Testing: Learn about baseline configurations in docs/VISUAL_REGRESSION_WORKFLOW.md.
  • Design System Blueprint: Deep dive into "The Fiscal Atelier" aesthetic rules in DESIGN.md.
  • Live Deployed App: Access the application on app.iln.finance.

🀝 Contributing

Contributions are welcome! Please read our CONTRIBUTING.md first.

  1. Create a branch: git checkout -b feature/your-feature-name
  2. Make your changes and write stories for new components.
  3. Commit using conventional formats: feat(scope): describe changes
  4. Run testing commands: npm run lint and npm run test
  5. Open a Pull Request.

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors