Issues
Report bugs and request features to help improve the platform.
SLN Phase 1: Internal Credit Ledger System
Planned## Summary Implement the SLN credit economy as an internal ledger on Supabase. This is Phase 1 of the SAL Protocol — a launch-ready credit system with zero blockchain dependency. Users see "credits" or "SLN balance" while the underlying mechanics are forward-compatible with on-chain settlement in later phases. ## Key Details **Exchange Rate:** Fixed at 1000 SLN = €10 (1 SLN = €0.01) **Onboarding:** New users receive +100 SLN (~€1.00) on email confirmation, plus 5 invite slots. **Invite System:** - Sending an invite costs 20 SLN - When invitee publishes a site: inviter gets +100 SLN (5x return) - When invitee upgrades to Basic: inviter gets +500 SLN bonus + 200 SLN commission - When invitee upgrades to Premium/Pro: inviter gets +1000 SLN bonus + 400-800 SLN commission - Maximum return per invite: 1,600 SLN on 20 SLN investment (80x) **Commission on Upgrades:** 20% of the subscription's first payment, converted to SLN at fixed rate. Recurring commissions deferred to Phase 2. **Spending SLN (at launch):** - Send invite: 20 SLN - Apply as subscription discount: 1:1 at €0.01/SLN - Upgrade to Basic Monthly: 1000 SLN - Cash out: Min 1000 SLN (€10), PayPal or bank transfer, manual review, monthly **Credit Expiry:** 24 months of account inactivity (no login) ## Database Changes - Extend `user_profiles` with `sln_balance`, `invite_slots_total`, `invite_slots_used` - New table: `sln_transactions` (full double-entry ledger with type, amount, balance_after) - New table: `sln_cashout_requests` (manual payout queue) - Extend `invite_requests` with inviter tracking - Atomic `credit_sln` RPC function for all balance mutations - Daily reconciliation query to verify balance integrity ## New API Routes | Route | Method | Purpose | |---|---|---| | `/api/sln/balance` | GET | Current SLN balance and slot count | | `/api/sln/transactions` | GET | Paginated transaction history | | `/api/sln/cashout` | POST | Submit cash-out request | | `/api/sln/apply-discount` | POST | Calculate SLN discount for checkout | | `/api/admin/sln/cashouts` | GET | Pending cash-out requests (admin) | | `/api/admin/sln/cashouts/[id]` | PATCH | Approve/reject cash-out | | `/api/admin/sln/adjust` | POST | Manual balance adjustment | ## Integration Points 1. **Signup flow** — +100 SLN on email confirmation 2. **Invite flow** — SLN debit on send, reward on invitee site publish 3. **Stripe webhook** — Commission on referred user's first subscription payment 4. **Checkout flow** — SLN discount support with atomic debit on payment confirmation 5. **Settings page** — Replace invite placeholder with full balance/transaction/cashout UI ## Phase 2 Migration Path Phase 1 Supabase ledger maps 1:1 to Phase 2 on-chain (BSV-20 SLN tokens). User balances minted as tokens, transaction history archived, UI stays the same. Only visible change is a wallet connection step. *Full spec: `new-salon-app/docs/ongoing/SLN-PHASE-1-INTERNAL-LEDGER.md`*
[social] Follows, likes, posts, feed, discover
Planned- Database: `follows`, `likes`, `posts` tables - Post types: site published (auto), page added (auto), image shared, text post, repost - Following feed (content from people you follow) - Discover feed (trending/new content across platform) - Like button on sites, pages, images - Follow/unfollow on user profiles - Basic in-app notification system **Files:** Supabase migration, new components in `src/components/social/`