Skip to content

About

SafeTrust is a decentralized P2P escrow platform built on Stellar securing deposits for hotels, vacation rentals, and tourism bookings without intermediaries.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

SafeTrust Logo

frontend-SafeTrust

Decentralized P2P Escrow · Stellar Blockchain · Standalone Frontend

License: MIT Next.js Hasura Stellar 🔥 Firebase 🔐 TrustlessWork


What is SafeTrust?

SafeTrust is a decentralized P2P escrow platform for rental transactions. Funds are held in tamper-proof smart contracts on the Stellar network via the TrustlessWork API — no intermediaries, full on-chain transparency.

🧩 This repo runs standalone. You do not need to clone or run backend-SafeTrust locally. The frontend connects directly to a remote Hasura GraphQL endpoint and Firebase over the network.


Quick Start

Prerequisites

Tool Version
Node.js ≥ 18
A Stellar wallet Freighter recommended

1. Clone and install

git clone https://github.com/<your_user>/frontend-SafeTrust
cd frontend-SafeTrust
git remote add upstream https://github.com/safetrustcr/frontend-SafeTrust
npm install

2. Set up environment variables

cp .env.example .env.local

Fill in .env.local following the sections below. Never commit this file.

3. Start the dev server

npm run dev

Runs on port 3000 by default. Use npm run dev -- --port 3001 only if landing-SafeTrust is already running on 3000.


Environment Variables

🔥 Firebase

From Firebase Console → Project Settings → Your apps → Web app → Config:

NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=

Enable Email/Password under Authentication → Sign-in method.

These are public, browser-safe values. The NEXT_PUBLIC_ prefix is what makes Next.js expose them to the bundle. Never put HASURA_ADMIN_SECRET here — the frontend authenticates via Firebase JWT, not the admin secret.

Setup: console.firebase.google.com


🌐 Hasura GraphQL

NEXT_PUBLIC_HASURA_GRAPHQL_URL=https://your-hasura-instance.example.com/v1/graphql

Point this at the shared SafeTrust Hasura instance — or http://localhost:8080/v1/graphql if you are running backend-SafeTrust locally. No admin secret goes here, ever.


🔐 TrustlessWork API

Required for escrow deploy, fund, and release flows.

NEXT_PUBLIC_API_URL=https://api.trustlesswork.com
NEXT_PUBLIC_API_KEY=
NEXT_PUBLIC_TRUSTLESS_API_URL=https://api.trustlesswork.com
NEXT_PUBLIC_TRUSTLESS_API_URL_DEV=https://dev.api.trustlesswork.com
NEXT_PUBLIC_TRUSTLESS_NETWORK=testnet

Get your API key:

  1. Go to dapp.trustlesswork.com → connect Freighter.
  2. Settings → Profile → fill in use-case field (required).
  3. Settings → API Keys → Request API Key → select Testnet.
  4. Copy immediately — shown only once.

Always use testnet for local development. Full guide: docs.trustlesswork.com → Request API Key


Architecture

Setup When to use
This repo standalone — npm run dev, remote Hasura + Firebase UI work, components, dashboard features — most contributor tasks
dApp-SafeTrust monorepo — frontend + backend together Full-stack work touching schema, mutations, or webhook behavior
backend-SafeTrust standalone — Hasura + Postgres + webhook via Docker Backend-only contributors who don't need the UI

Tech Stack

  • Frontend: TypeScript, Next.js 15, Tailwind CSS
  • Auth: Firebase Authentication
  • GraphQL: Apollo Client 4, Hasura GraphQL Engine
  • Blockchain: Stellar, TrustlessWork API
  • Wallets: Freighter, Albedo, LOBSTR

Testing

npm test              # unit and integration tests
npm run test:e2e      # E2E tests (Cypress)
npm run test:coverage # coverage report

Tests live in __tests__/ or as .test.ts(x) files. E2E tests in cypress/e2e/. API requests mocked via MSW (mocks/handlers.ts).


Contributing

  1. npm run dev — must start without errors.
  2. No console.log in production paths, no unexplained any or @ts-ignore.
  3. Link the issue your PR closes.

Branch naming: feat/<issue-number>-short-description · fix/<issue-number>-short-description


License

© 2026 SafeTrust. Released under the MIT License.

About

SafeTrust is a decentralized P2P escrow platform built on Stellar securing deposits for hotels, vacation rentals, and tourism bookings without intermediaries.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages