Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

Repository files navigation

PayRequest Hub

A P2P payment request app — request money from friends, track requests, pay or decline them. Built with React + Hono, deployed to Vercel + Supabase.

Live Demo

https://payrequest-hub.vercel.app

Sign in with your email — a magic link will be sent to your inbox.

E2E Test Videos

Test videos are recorded automatically on every CI run. Download from GitHub Actions → playwright-videos artifact

To watch locally, run the Docker stack then:

docker compose up --build -d
docker compose --profile test run --rm playwright
# Videos exported to e2e/videos/ on your machine

Run Locally with Docker

Prerequisites: Docker Desktop installed and running. No other installs needed.

git clone https://github.com/harunu/payrequest-hub
cd payrequest-hub
docker compose up --build

Open http://localhost:8080 in your browser.

  • Use Quick Login buttons (testuser1 / testuser2) — no email setup needed in Docker mode
  • Reset database: docker compose down -v && docker compose up --build

Run E2E Tests

All 12 tests run fully inside Docker — no local Node.js or Playwright install needed:

# Start Docker stack first
docker compose up --build -d

# Run all tests (videos exported to e2e/videos/)
docker compose --profile test run --rm playwright

Videos are automatically exported to e2e/videos/ on your host machine.

Tech Stack

Layer Technology
Frontend React 18 + Vite + React Router + Tailwind CSS + shadcn/ui
API Node.js + Hono (serverless on Vercel, Node server in Docker)
Database PostgreSQL (Supabase in production, postgres:15 in Docker)
Auth Supabase magic link + HTTP-only session cookie
Money math decimal.js — never native float
Deployment Vercel (frontend + API, single project)
E2E Playwright with video recording (video: 'on')
CI/CD GitHub Actions → Vercel deploy on push to main

Deploy to Vercel

See DEPLOYMENT.md for step-by-step instructions.

Required env vars in Vercel:

Variable Value
DATABASE_URL Supabase Transaction pooler URL (port 6543)
SUPABASE_URL Your Supabase project URL
SUPABASE_ANON_KEY Supabase anon/public key
SUPABASE_SERVICE_ROLE_KEY Supabase service role key (secret)
SESSION_SECRET Random 32-char string (openssl rand -base64 32)
FRONTEND_URL Your Vercel production URL (e.g. https://payrequest-hub.vercel.app)
DOCKER_MODE false
VITE_API_URL (leave empty — same domain on Vercel)
VITE_DOCKER_MODE false

Spec-Kit Process

Built following GitHub Spec-Kit workflow:

AI Tools Used

  • Lovable — Frontend scaffolding (React + Vite + shadcn/ui component library)
  • Claude Code — API design, Docker setup, CI/CD pipeline, E2E test suite, integration work

Architecture

payrequest-hub/
├── frontend/          # React SPA (Vite, deployed as static)
│   └── src/
│       ├── pages/     # Route-level components
│       ├── components/# UI components
│       ├── lib/api.ts # All API calls (fetch with credentials)
│       └── context/   # Auth state
├── api/               # Hono API (Node.js + Vercel serverless)
│   ├── index.ts       # Vercel entry point (single serverless function)
│   └── _src/          # Source (prefixed _ so Vercel ignores as functions)
│       ├── routes/    # auth, requests, public
│       ├── middleware/ # requireAuth, CORS
│       └── lib/       # db, decimal, formatters
├── supabase/
│   └── migrations/    # SQL migrations (001-004)
├── e2e/               # Playwright tests (12 test cases)
├── docker-compose.yml
└── vercel.json        # Routes /api/* to Hono, /* to frontend

Key Architectural Decisions

  • Atomic SQL updates for pay/decline/cancel — prevents race conditions
  • display_status computed server-side — EXPIRED is derived from expires_at < now(), never stored
  • HTTP-only cookie — session token never accessible via JavaScript (XSS-safe)
  • decimal.js for all money — avoids floating point rounding errors (e.g. 0.1 + 0.2 ≠ 0.3)
  • Shareable token separate from UUID — /request/:token/public is safe to share, not guessable
  • Single Vercel function — all API routes in one function (api/index.ts) to stay within Hobby plan limits

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages