Skip to content

Repository files navigation

Dorisio Frontend

Web application for Dorisio β€” user-facing experience layer for sending tips and managing creator accounts.

Live Demo

πŸš€ Deployed on Vercel: https://dorisio.vercel.app

Purpose

The frontend is the dumb UI layer that:

  • Renders state
  • Calls SDK functions
  • Zero business logic
  • Consumes stabilized SDK API

Design principle: Frontend = experience only. All logic lives in backend or SDK.

Tech Stack

  • Framework: Next.js 14 (App Router) + TypeScript
  • UI: Tailwind CSS + shadcn/ui
  • Animation: Framer Motion
  • State: Zustand (light client state), TanStack Query (server state)
  • Forms: React Hook Form + Zod
  • SDK: Dorisio-sdk (from workspace)
  • Deployment: Vercel

Features

  • βœ… User authentication (sign up / log in)
  • βœ… Creator profile pages (public profiles)
  • βœ… Creator discovery & search
  • βœ… Send tip flow (Freighter wallet integration)
  • βœ… Creator dashboard (earnings, transactions, wallet management)
  • βœ… Real-time blockchain confirmation tracking
  • βœ… Stellar testnet integration

Prerequisites

  • Node.js 20+ LTS
  • Backend running (see ../backend)
  • SDK built (see ../sdk)

Setup

1. Install dependencies

npm install

2. Configure environment

Copy .env.example to .env.local:

cp .env.example .env.local

Update values to match your backend:

NEXT_PUBLIC_API_URL=http://localhost:3000
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org

3. Start development server

npm run dev

Open http://localhost:3000

Project Structure

src/
β”œβ”€β”€ app/                  # Next.js App Router
β”‚   β”œβ”€β”€ layout.tsx        # Root layout
β”‚   β”œβ”€β”€ page.tsx          # Home page
β”‚   β”œβ”€β”€ (app)/            # Protected routes
β”‚   β”‚   β”œβ”€β”€ creators/[username]/page.tsx       # Creator profile
β”‚   β”‚   β”œβ”€β”€ creators/[username]/dashboard/     # Creator dashboard
β”‚   β”‚   └── creators/page.tsx                  # Discovery page
β”‚   └── globals.css       # Global styles
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ sections/         # Page sections
β”‚   β”‚   β”œβ”€β”€ dorisio-button.tsx       # Send tip button
β”‚   β”‚   β”œβ”€β”€ dorisio-modal.tsx        # Tip flow modal
β”‚   β”‚   β”œβ”€β”€ wallet-manager.tsx       # Wallet management
β”‚   β”‚   └── creator-spotlight.tsx    # Featured creators
β”‚   β”œβ”€β”€ ui/               # Reusable UI components
β”‚   └── shared/           # Shared utilities
β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ use-create-tip.ts           # Tip creation flow
β”‚   β”œβ”€β”€ use-wallet.ts               # Wallet management
β”‚   β”œβ”€β”€ use-creator-balance.ts      # Creator earnings
β”‚   └── use-transaction-history.ts  # Transaction list
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ sdk-client.ts     # SDK initialization
β”‚   └── stellar/          # Stellar utilities
β”œβ”€β”€ stores/
β”‚   └── auth-store.ts     # Auth state (Zustand)
β”œβ”€β”€ types/
β”‚   └── index.ts          # TypeScript types
└── utils/
    β”œβ”€β”€ formatters.ts     # Format utilities
    └── validators.ts     # Zod schemas

Key Pages

Route Purpose Auth Required
/ Landing page with features No
/creators Creator discovery & search No
/creators/[username] Creator public profile No
/creators/[username]/dashboard Creator earnings & wallet Yes

Environment Variables

Required

  • NEXT_PUBLIC_API_URL β€” Backend API base URL (required)
  • NEXT_PUBLIC_STELLAR_NETWORK β€” testnet or mainnet (default: testnet)
  • NEXT_PUBLIC_STELLAR_HORIZON_URL β€” Stellar Horizon endpoint (default: testnet)

Optional

  • NEXT_PUBLIC_ENABLE_ANALYTICS β€” Enable analytics (default: false)
  • NEXT_PUBLIC_ENABLE_ERROR_REPORTING β€” Enable error reporting (default: false)

Scripts

npm run dev              # Start dev server (port 3000)
npm run build            # Build for production
npm run start            # Run production build
npm run lint             # Run ESLint
npm run format           # Format with Prettier
npm run type-check       # Run TypeScript check

Code Standards

  • TypeScript: Strict mode, no any
  • Formatting: Prettier (100 char line width)
  • Linting: ESLint + Next.js rules
  • Components: Server/client boundary is explicit
  • Imports: Use @/ path alias for local imports

Development Workflow

Adding a page

  1. Create file in src/app/[route]/page.tsx
  2. Use 'use client' at top (most pages need interactivity)
  3. Use SDK hooks from context
  4. Keep logic minimal

Example:

'use client';

import { useCreatorBalance } from '@/hooks/use-creator-balance';

export default function CreatorDashboard() {
  const { balance, loading, error } = useCreatorBalance(username);

  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return <div>Total Earnings: ${balance?.totalEarnings}</div>;
}

Adding a component

  1. Create in src/components/
  2. Keep it presentational (props-driven)
  3. Logic lives in parent or SDK hooks

Deployment

To Vercel

  1. Push code to GitHub
  2. Import repository in Vercel dashboard
  3. Set environment variables (see DEPLOYMENT.md)
  4. Deploy
vercel --prod

Environment Setup for Production

See DEPLOYMENT.md for:

  • Environment variable configuration
  • Vercel setup steps
  • Health checks and monitoring
  • Troubleshooting guide

Key Principles

Frontend Stays Dumb

❌ Don't do this:

// Business logic in component
const fee = amount * 0.025;
const total = amount + fee;

βœ… Do this:

// Business logic in backend/SDK
const result = await sdk.createTip({ creatorId, amount });

Call SDK, Not Backend Directly

❌ Don't do this:

const response = await fetch('http://api.dorisio.com/api/v1/tips', {
  method: 'POST',
  body: JSON.stringify(payload),
});

βœ… Do this:

const tip = await sdk.createTip(payload);

State Management

  • Server state (data from API) β†’ TanStack Query
  • Client state (UI state, auth token) β†’ Zustand
  • Component state (form input) β†’ React useState

Testing the Tip Flow

  1. Create Account

    • Go to home page, click "Sign Up"
    • Enter email and password
    • Verify email (testnet only)
  2. Link Wallet

    • Go to /creators/[any-username]/dashboard
    • Click "+ Add Wallet"
    • Sign challenge with Freighter wallet
  3. Send Tip

    • Go to /creators/[creator-username]
    • Click "πŸ’° Send a Tip"
    • Enter amount, optional message
    • Select wallet and confirm
    • Wait for blockchain confirmation
  4. View Earnings

    • Creator goes to their dashboard
    • See earnings overview card
    • Check transaction history table
    • Verify wallet management section

Notes

  • Frontend builds depend on SDK β€” build SDK first
  • Never leak Stellar/blockchain logic into UI
  • Keep routes simple β€” one responsibility per page
  • Use Next.js middleware for auth guard routes (future)
  • All API calls go through SDK, never directly to backend

Support & Troubleshooting

For issues:

  1. Check browser console for errors
  2. Verify environment variables are set
  3. Check backend is running (NEXT_PUBLIC_API_URL)
  4. Review DEPLOYMENT.md for production issues
  5. Contact: support@dorisio.dev

About

Reference web app for Dorisio creator profiles, tip flow, and earnings dashboard on Stellar.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages