Welcome to SafeSwap, a peer-to-peer platform that allows users to transfer USDC between Stellar wallet addresses through escrow-secured transactions. Powered by the Stellar Network and integrated with the Trustless Work API, SafeSwap ensures every transfer is transparent, trustless, and protected by smart contracts.
- P2P USDC Transfers: Send USDC directly to any Stellar wallet address in a secure, peer-to-peer flow.
- Escrow-Protected Transactions: Funds are held in Stellar escrow contracts and only released when both parties fulfill the agreed conditions.
- Trustless by Design: No central authority controls the process — smart contracts on Stellar handle every step automatically.
- Trustless Work API: Manages escrow creation, funding, completion, and dispute resolution.
- Fast & Low-Cost: Built on Stellar for near-instant settlement with minimal transaction fees.
- P2P App: Next.js, Tailwind CSS v4, shadcn/ui
- Backend (legacy): NestJS, GraphQL (Apollo Server), Prisma
- Blockchain: Stellar Network
- API: Trustless Work API for escrow smart contract management
- Database: PostgreSQL, Supabase
The UI is intentionally minimal — no unnecessary steps, no friction.
- Browse Listings: Users see a simple list of people who want to buy or sell USDC. Each listing shows the amount, direction (buy/sell), and the user's Stellar wallet address.
- Match & Connect: A user picks a counterpart from the list whose offer matches their need.
- Initiate the Transfer: Both parties agree on the amount. An escrow contract is created via the Trustless Work API, locking the USDC on the Stellar blockchain.
- Fund the Escrow: The sender deposits the USDC into the escrow contract.
- Release: Once both parties confirm, the contract releases the funds to the recipient's Stellar wallet automatically.
- Dispute Resolution: If something goes wrong, either party can open a dispute handled by the escrow contract.
Node.js version 20 or higher
Refer to the Node.js official documentation to download and install the latest version.
To check your installed Node.js version:
node -v
npm version 10.9.2 or higher
To check your installed npm version:
npm -v
To globally install or update npm:
npm install -g npm@10.9.2
Clone the Repository:
git clone https://github.com/your-username/SafeSwap.git cd SafeSwapInstall Dependencies:
npm install
Environment Variables:
Copy
.env.exampleto.env.localin the relevant app folder and fill in your values:cp p2p-safe-swap/.env.local p2p-safe-swap/.env.local
Required variables:
NEXT_PUBLIC_SUPABASE_URL— your Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY— your Supabase anon keySUPABASE_SERVICE_ROLE_KEY— your Supabase service role key (server-side only)TRUSTLESS_WORK_API_KEY— your Trustless Work API key (server-side only)
Full Supabase setup (projects, CLI, and client wrappers) is documented in
docs/SUPABASE-SETUP.md.
The repo ships Supabase CLI configuration in supabase/config.toml with
migrations in supabase/migrations/ and a local dev seed in
supabase/seed.sql.
Install the Supabase CLI.
Start the local stack and apply all migrations + seed:
supabase start supabase db reset
Or from the app folder:
npm run db:reset.Push migrations to a linked remote project (dev/prod) with
supabase db push.
See docs/SUPABASE-SETUP.md for CLI linking,
environment variables, and the browser/server client wrappers.
npm run dev— Starts all applications in development mode.npm run build— Builds all applications for production.
Run individual applications directly from the root directory:
P2P App:
cd p2p-safe-swapnpm run dev
| App | Description | Path |
|---|---|---|
| p2p-safe-swap | P2P USDC transfer app built with Next.js 16 and Tailwind v4 | p2p-safe-swap/ |
We appreciate and welcome contributions! Please review our CONTRIBUTING GUIDELINES and GIT GUIDELINES before submitting a PR.
Daniel Calderón Díaz GitHub | Diego Duarte Fernández GitHub |
This project is licensed under the MIT License - see the LICENSE file for details.
