Architecture overview
PayOnProof consists of two separate services:- Frontend (
services/web) - Next.js application with React and TypeScript - Backend (
services/api) - Vercel serverless REST API with Node.js and TypeScript
Prerequisites
Before you begin, ensure you have the following installed:- Node.js 20 or higher
- npm or pnpm package manager
- Git
- A Supabase account (for database)
- A Stellar testnet account (for blockchain operations)
Installation steps
Configure environment variables
Create environment files from the examples:API Service:Web Service:See Environment variables for detailed configuration.
Set up the database
Run the SQL migration files to create the required database tables.See Database setup for detailed instructions.
Development server options
The API service provides multiple development modes:The standard
npm run dev command builds the TypeScript files and runs the local server. This is the recommended approach for most development work.Project structure
Development workflow
Backend development
Create new endpoints inservices/api/api/...
Add business logic in services/api/lib/modules/...
Add external integrations in services/api/lib/providers/stellar/...
Add database access in services/api/lib/repositories/...
Architecture flow:
Frontend development
Create new pages inservices/web/app/.../page.tsx
Create components in services/web/components/...
Call backend APIs from services/web/lib/api.ts
Verifying the setup
Once both services are running, verify your setup:- Open
http://localhost:3000in your browser - Check that the API is responding at
http://localhost:3001/api/health(if available) - Test the anchor catalog endpoint:
http://localhost:3001/api/anchors/catalog
Troubleshooting
Port conflicts
If ports 3000 or 3001 are already in use, you can modify the ports:Database connection errors
Verify your Supabase credentials inservices/api/.env:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
Stellar network errors
Ensure you’re using the correct Stellar Horizon URL and network passphrase:- Testnet:
https://horizon-testnet.stellar.org - Mainnet:
https://horizon.stellar.org