|
| 1 | +# stackpay-frontend 🪨 |
| 2 | + |
| 3 | +> React + Vite dApp for **StackPay** — create & share payment requests, pay with a Stellar wallet, and track status in real time. |
| 4 | +
|
| 5 | +[](https://github.com/Stack-Rocks/stackpay-frontend/actions) |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +The user-facing app for StackPay. It talks to the deployed Soroban contract ([`stackpay-contracts`](https://github.com/Stack-Rocks/stackpay-contracts)) and the [`stackpay-backend`](https://github.com/Stack-Rocks/stackpay-backend) API. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Table of contents |
| 16 | +- [Features](#features) |
| 17 | +- [Tech stack](#tech-stack) |
| 18 | +- [Getting started](#getting-started) |
| 19 | +- [Configuration](#configuration) |
| 20 | +- [Project structure](#project-structure) |
| 21 | +- [Wallet connect](#wallet-connect) |
| 22 | +- [Pages & flows](#pages--flows) |
| 23 | +- [Styling](#styling) |
| 24 | +- [Testing](#testing) |
| 25 | +- [Production build](#production-build) |
| 26 | +- [Contributing](#contributing) |
| 27 | +- [License](#license) |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Features |
| 32 | +- 🔐 **Stellar wallet login** (Freighter, Albedo) — non-custodial. |
| 33 | +- ➕ **Create a request** — payee (you), asset, amount, memo; get a shareable link. |
| 34 | +- 🔗 **Request page** — anyone with the link can pay from their wallet. |
| 35 | +- 📊 **Live status** — Open / Paid / Cancelled with real-time updates. |
| 36 | +- 🧾 **Payment proof** — on-chain `Paid` status = receipt. |
| 37 | +- 🌐 **Testnet / Mainnet** toggle. |
| 38 | + |
| 39 | +## Tech stack |
| 40 | +React 18 + TypeScript · Vite · Tailwind CSS · `@stellar/stellar-sdk` + `@stellar/freighter-api` · TanStack Query · Socket.IO client · React Router · Zod. |
| 41 | + |
| 42 | +## Getting started |
| 43 | +```bash |
| 44 | +git clone https://github.com/Stack-Rocks/stackpay-frontend.git |
| 45 | +cd stackpay-frontend |
| 46 | +cp .env.example .env |
| 47 | +npm install |
| 48 | +npm run dev |
| 49 | +``` |
| 50 | +Open `http://localhost:5173`. |
| 51 | + |
| 52 | +## Configuration |
| 53 | +See [`.env.example`](./.env.example): |
| 54 | + |
| 55 | +| Variable | Description | |
| 56 | +| --- | --- | |
| 57 | +| `VITE_API_URL` | Backend API base. | |
| 58 | +| `VITE_RPC_URL` | Soroban RPC endpoint. | |
| 59 | +| `VITE_NETWORK` | `testnet` \| `mainnet`. | |
| 60 | +| `VITE_CONTRACT_PAYMENT` | PaymentRequest contract id. | |
| 61 | + |
| 62 | +## Project structure |
| 63 | +``` |
| 64 | +src/ |
| 65 | ++-- main.tsx # entry |
| 66 | ++-- App.tsx # router + providers |
| 67 | ++-- lib/stellar.ts # wallet connect + tx helpers |
| 68 | ++-- lib/api.ts # backend REST client |
| 69 | ++-- hooks/useWallet.ts # wallet state |
| 70 | ++-- hooks/useRequests.ts# queries + live updates |
| 71 | ++-- components/ # Navbar, RequestCard, CreateForm, PayButton |
| 72 | ++-- pages/ # Dashboard, Create, Request |
| 73 | +``` |
| 74 | + |
| 75 | +## Wallet connect |
| 76 | +```ts |
| 77 | +import { connectFreighter } from "./lib/stellar"; |
| 78 | +const pubkey = await connectFreighter(); // prompts Freighter |
| 79 | +``` |
| 80 | + |
| 81 | +## Pages & flows |
| 82 | +1. **Dashboard** — your requests (as payee) + received totals. |
| 83 | +2. **Create** — form to make a request; shows the shareable link. |
| 84 | +3. **Request** — public page: pay button + live status. |
| 85 | + |
| 86 | +## Styling |
| 87 | +Tailwind with a custom theme (`tailwind.config.js`) using Stack-Rocks' slate/amber palette. Responsive + accessible. |
| 88 | + |
| 89 | +## Testing |
| 90 | +```bash |
| 91 | +npm run test # vitest + RTL |
| 92 | +npm run test:e2e # playwright (wallet mocked) |
| 93 | +``` |
| 94 | + |
| 95 | +## Production build |
| 96 | +```bash |
| 97 | +npm run build && npm run preview |
| 98 | +``` |
| 99 | +Deploy `dist/` to any static host (Vercel, Netlify, GitHub Pages, IPFS). |
| 100 | + |
| 101 | +## Contributing |
| 102 | +Part of the **Stellar Wave Program** on Drips. Look for `Stellar Wave` / `Good first issue`. Run `npm run lint && npm run build && npm run test` before a PR. |
| 103 | + |
| 104 | +## License |
| 105 | +[MIT](./LICENSE). |
0 commit comments