Groovv is a full-stack Starknet music platform where artists can mint songs, list them on-chain, and listeners can discover, buy, and manage ownership-backed music access.
This repository contains:
- A Cairo smart contract for minting, listing, trading, and royalty-aware marketplace logic.
- A Next.js web app for wallet-based listening, studio management, playlists, marketplace discovery, and profile history.
- A TypeScript listener service that watches Starknet events and syncs them into the app database for fast queries, notifications, and recommendations.
Groovv combines on-chain ownership and off-chain product UX:
- On-chain (Starknet): source of truth for minting, listing, purchases, listing removal, and ownership balance.
- Off-chain (Postgres + Next.js APIs): indexed query layer for search, recommendations, notifications, and profile timelines.
- Realtime sync layer: event listener reads contract events and posts normalized batches to the app ingest API.
The result is a hybrid architecture: trust-minimized market actions on-chain, fast consumer-grade UX off-chain.
.
|- contracts/ # Cairo contract + Starknet Foundry tests
|- groovv-app/ # Next.js 15 app + Drizzle ORM + PostgreSQL
`- groovv-listener/ # Starknet websocket listener + event forwarding
- Wallet connect flow for Starknet users.
- Artist studio tools to mint songs and create albums.
- ERC1155-based ownership balances for songs.
- On-chain listings with purchase flow and seller-controlled delisting.
- Secondary sale royalty logic (artist royalty on resale).
- Marketplace ranking sections:
- Top Picks
- On the Rise
- More Your Speed (personalized)
- Listener-driven event ingest that updates songs, ownership balances, active market listings, user transactions, and user notifications.
- Search, playlists, profile transactions, and notification settings.
- PWA support and offline route in the web client.
User Wallet (Starknet)
|
v
Groovv Contract (Cairo, ERC1155 + marketplace)
| emits events
v
groovv-listener (WS/RPC subscriber)
| POST /api/listener/events
v
groovv-app ingest pipeline (eventIngest.ts)
|
v
PostgreSQL (Drizzle schema)
|
v
Next.js APIs + UI (library, market, search, notifications, profile)
Primary contract: Groovv
Implemented capabilities include:
mint_songupdate_song_pricebuy_songlist_songremove_listingcreate_albumadd_song_to_albumget_songget_listingget_song_balance
Event surface includes:
SongCreatedSongUpdatedAlbumCreatedListingCreatedListingPurchasedListingRemovedFundsWithdrawn
Tech stack:
- Next.js 15 (App Router, Turbopack)
- React 19
- Drizzle ORM + PostgreSQL
- Starknet wallet integration (
starknetkit,@starknet-react) - React Query for client data sync
Functional areas:
- Library and playback UI
- Studio (create/profile/listings)
- Marketplace + recommendation feeds
- Search across library and market
- Playlists
- Notification center + transaction history
- API endpoints for uploads, ingest, market views, and profile data
Responsibilities:
- Subscribe to Groovv contract events over WebSocket.
- Fetch receipts/traces over RPC.
- Decode ABI events and normalize payloads.
- Deduplicate/retry/reconnect for resilience.
- Forward event batches to
groovv-appingest endpoint. - Persist last processed block to state file.
- Node.js 20+
- npm
- PostgreSQL
- Scarb
- Starknet Foundry (
snforge) - Starknet Sepolia RPC + WS endpoints
Required:
DATABASE_URLNEXT_PUBLIC_GROOVV_CONTRACT_ADDRESSNEXT_PUBLIC_GROOVV_PAYMENT_TOKEN_ADDRESS(orNEXT_PUBLIC_USDC_TOKEN_ADDRESS)NEXT_PUBLIC_STARKNET_RPC_URL(orNEXT_PUBLIC_RPC_URL)
Optional:
LISTENER_SHARED_SECRET(recommended when listener posts events)NEXT_PUBLIC_STARKSCAN_TX_BASE_URLNEXT_PUBLIC_PWA_DEV_ENABLEDRPC_URL(server fallback for chain reads)
Use groovv-listener/.env.example as baseline:
RPC_URLWS_URLGROOVV_CONTRACT_ADDRESSAPP_BASE_URL(usuallyhttp://localhost:3000)LISTENER_SHARED_SECRET(must match app if configured)GROOVV_ABI_PATH(or use fallback ABI paths)
RPC_URLis used by fork tests inScarb.toml.
cd groovv-app
npm install
cd ../groovv-listener
npm installcd groovv-app
npm run db:generate
npm run db:migrate
npm run seedOr trigger seed API after app start:
curl -X POST http://localhost:3000/api/seedUse three terminals:
# Terminal 1: Next.js app
cd groovv-app
npm run dev# Terminal 2: Starknet listener
cd groovv-listener
npm run dev# Terminal 3: Contract tests
cd contracts
scarb testnpm run dev- start app in dev modenpm run build- production buildnpm run start- run production servernpm run seed- run data seed scriptnpm run db:generate- generate Drizzle migrationsnpm run db:migrate- apply migrationsnpm run db:studio- open Drizzle studio
npm run dev- run listener in TS modenpm run build- compile listenernpm run start- run compiled listenernpm run decode:tx- tx decode utility
scarb test- run contract tests (configured with coverage script inScarb.toml)
The ingest pipeline updates Postgres tables for:
- users
- songs
- albums
- market listings
- token ownership
- processed chain events (dedupe)
- user transactions
- user notifications
- notification settings
This enables fast API reads without repeatedly querying chain state for every UI interaction.
- This repository targets Starknet Sepolia for current tests and listener configs.
- Upload endpoints save media under
groovv-app/public/uploads/...for local development. - Contract and marketplace logic should be audited before mainnet production use.