How sorosave-protocol/frontend works
Purpose and Runtime
SoroSave is a Next.js 14 App Router frontend for a decentralized rotating-savings protocol on Stellar Soroban. It runs as a browser-rendered web client, styled with Tailwind, and connects users’ wallets and contract calls through Stellar SDK/Freighter APIs. The application root is src/app/layout.tsx; shared client providers are established in src/app/providers.tsx.
Route Entry Points
The landing experience is src/app/page.tsx. Group discovery is served by src/app/groups/page.tsx, with group-specific views resolved through the dynamic route src/app/groups/[id]/page.tsx. Group creation is a separate route at src/app/groups/new/page.tsx. These routes define the main navigation and state boundaries: browse groups, create a group, then inspect and contribute to a selected group.
Wallet and Blockchain Boundary
src/lib/wallet.ts encapsulates wallet-facing behavior, principally Freighter integration and account/signing concerns. src/lib/sorosave.ts is the Soroban contract boundary: it is expected to construct and submit/read contract interactions using @stellar/stellar-sdk, configured by public contract ID, RPC URL, and network passphrase environment variables. Browser UI should reach on-chain state through these library modules rather than embedding protocol calls in route components.
Group Lifecycle
Group creation is represented by src/components/CreateGroupForm.tsx and exposed through src/app/groups/new/page.tsx. The form collects group parameters and initiates the corresponding contract operation through the SoroSave integration layer. After contract confirmation, the created group becomes available to group-listing and detail flows.
Discovery and Group Detail
src/app/groups/page.tsx coordinates group retrieval and renders reusable summaries via src/components/GroupCard.tsx. src/app/groups/[id]/page.tsx is the per-group orchestration point, loading the identified group and composing its member, progress, and contribution surfaces. The route parameter is the key boundary between navigation state and contract-derived group state.
Contribution and Rotation State
src/components/ContributeModal.tsx provides the transaction-oriented contribution interaction. src/components/RoundProgress.tsx presents the current savings/rotation round status, while src/components/MemberList.tsx displays participating members. Together these components translate contract state into the group-level workflow: member roster, active round, user contribution, and progression toward payout/next round.
Shared UI and Deployment Assumptions
src/components/Navbar.tsx and src/components/ConnectWallet.tsx provide cross-route navigation and wallet-session entry. Global visual styling is rooted in src/app/globals.css. Deployment requires a reachable Soroban RPC endpoint and browser access to Freighter; the default documented target is Stellar testnet, with all chain settings exposed as NEXT_PUBLIC_* client-side variables.
Main entry points: sorosave.ts SoroSave contract client · [id]/page.tsx Group detail · layout.tsx Root layout · groups/page.tsx Group discovery
Components 17
App shell
- Root layout · Establishes the application shell.
src/app/layout.tsx - Client providers · Shared browser-side provider boundary.
src/app/providers.tsx - Navigation bar
src/components/Navbar.tsx - Connect wallet
src/components/ConnectWallet.tsx - Global styles
src/app/globals.css
Routes
- Landing page
src/app/page.tsx - Group discovery · Retrieves and lists savings groups.
src/app/groups/page.tsx - Group detail · Loads the group selected by its route ID.
src/app/groups/[id]/page.tsx - Create group page
src/app/groups/new/page.tsx
Group UI
- Group card
src/components/GroupCard.tsx - Create group form · Collects group parameters and starts creation.
src/components/CreateGroupForm.tsx - Member list
src/components/MemberList.tsx - Round progress
src/components/RoundProgress.tsx - Contribution modal
src/components/ContributeModal.tsx
Wallet & chain
- Wallet adapter · Encapsulates account access and transaction signing.
src/lib/wallet.ts - SoroSave contract client · Reads and submits contract interactions using public chain settings.
src/lib/sorosave.ts - Soroban contract · Protocol state and transaction execution on the configured network.
Connections 18
- Root layout → Client providers: establishes
- Root layout → Navigation bar: renders
- Root layout → Global styles: loads
- Navigation bar → Connect wallet: includes
- Connect wallet → Wallet adapter: connects via
- Landing page → Group discovery: navigates to
- Group discovery → Group card: renders
- Group card → Group detail: opens selected group
- Group discovery → SoroSave contract client: retrieves groups
- Create group page → Create group form: hosts
- Create group form → SoroSave contract client: creates group
- Group detail → Member list: renders roster
- Group detail → Round progress: renders round
- Group detail → Contribution modal: opens contribution
- Group detail → SoroSave contract client: loads group by ID
- Contribution modal → SoroSave contract client: submits contribution
- SoroSave contract client → Wallet adapter: requests signing
- SoroSave contract client → Soroban contract: reads and submits