SolanaFans is a proof-of-concept, decentralized creator platform built on the Solana blockchain. This MVP allows creators to monetize their content (images) by setting a price in SOL, which users can pay directly from their wallets to get access.
The project demonstrates a hybrid on-chain/off-chain architecture, using Solana for payments and a traditional web stack for data management and content delivery.
#LIVE (https://only-solana-fans-zbzp.vercel.app/)
- Features
- Tech Stack
- Project Structure
- Getting Started
- Core Concepts
- Next Steps & Future Improvements
- 👤 Wallet Login: Securely log in using a Solana wallet (Phantom, Solflare, etc.) via message signing.
- 🖼️ Content Upload: Creators can upload images and set a viewing price in SOL.
- 💳 Solana Payments: Users can pay for content directly with SOL.
- 🔐 On-Chain Verification: The backend verifies each payment transaction on the Solana Devnet before unlocking content.
- 🔍 User Search: Find creator profiles by searching for their wallet address.
- 👁️ Blurred Previews: All paid content is blurred until a successful payment is made.
This project uses a modern, type-safe stack:
- Frontend: Next.js (bootstrapped with
create-solana-dapp)- Styling: Tailwind CSS with daisyUI
- State Management: Zustand
- Solana Integration:
@solana/wallet-adapter
- Backend: Express.js
- Language: TypeScript
- Database: PostgreSQL
- ORM: Prisma
- File Storage: Cloudflare R2 (S3-compatible API)
- Deployment: (TBD - e.g., Vercel for Frontend, Railway/Fly.io for Backend)
The project is a monorepo with two main packages: frontend and backend.
/
├── backend/ # Express.js, Prisma, and all API logic
│ ├── prisma/
│ ├── src/
│ └── ...
└── my-solana-fans/ # Next.js frontend application (rename as needed)
├── src/
│ ├── components/
│ ├── pages/
│ └── ...
└── README.md
Follow these steps to get the project running locally.
- Node.js (v18 or later)
- pnpm (recommended) or npm/yarn
- PostgreSQL installed and running
- A Solana wallet extension (e.g., Phantom) set to Devnet
- A Cloudflare account (for R2 storage)
This project uses Cloudflare R2 for free, S3-compatible file storage.
- Create an R2 Bucket: In your Cloudflare dashboard, navigate to R2 and create a new bucket.
- Enable Public Access: In the bucket's settings, enable public access by connecting a custom domain or using the public
r2.devURL. - Create API Token: Go to "Manage R2 API Tokens", create a new token with "Object Read & Write" permissions.
- Copy Credentials: Securely copy the Account ID, Access Key ID, and Secret Access Key.
-
Navigate to the backend directory:
cd backend -
Install dependencies:
pnpm install
-
Set up environment variables:
- Copy the example environment file:
cp .env.example .env - Fill in the
backend/.envfile with your credentials:# PostgreSQL DATABASE_URL="postgresql://YOUR_USER:YOUR_PASSWORD@localhost:5432/solana_fans_mvp?schema=public" # JWT Secret for Auth JWT_SECRET="generate-a-super-long-random-secret-string" # Cloudflare R2 Credentials AWS_ACCESS_KEY_ID="YOUR_R2_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="YOUR_R2_SECRET_ACCESS_KEY" AWS_S3_BUCKET_NAME="YOUR_R2_BUCKET_NAME" CLOUDFLARE_ACCOUNT_ID="YOUR_CLOUDFLARE_ACCOUNT_ID"
- Copy the example environment file:
-
Run database migrations: This command will create the necessary tables in your PostgreSQL database.
npx prisma migrate dev
-
Start the backend server:
pnpm run dev
The server will be running on
http://localhost:3001.
-
Navigate to the frontend directory:
cd my-solana-fans # or your frontend folder name
-
Install dependencies:
pnpm install
-
Set up environment variables:
- Create a new file:
touch .env.local - Add the backend API URL to
.env.local:NEXT_PUBLIC_API_URL=http://localhost:3001/api
- Create a new file:
-
Start the frontend development server:
pnpm run dev
The app will be available at
http://localhost:3000.
Authentication is handled without traditional passwords.
- Challenge: The frontend requests a unique, single-use message from the backend.
- Sign: The user signs this message with their wallet's private key, proving ownership. This does not create a transaction.
- Verify: The backend verifies the signature against the user's public key.
- Session: If verification is successful, the backend issues a JSON Web Token (JWT) for traditional session management.
The backend is the single source of truth for content access.
- Transaction: The frontend constructs and sends a
SystemProgram.transfertransaction to the Solana network. - Signature: Upon confirmation, the frontend receives a transaction signature.
- Verification: The frontend sends this signature to a protected backend endpoint.
- Unlock: The backend fetches the transaction from the Solana Devnet RPC, validates its details (sender, receiver, amount), and if everything matches, creates a
Purchaserecord in the database, granting the user access to the content.
This MVP provides a solid foundation. Future enhancements could include:
- Production Deployment: Deploy the frontend to Vercel and the backend/DB to Railway or Fly.io.
- Username/Profile Editing: Allow users to set a username and profile picture.
- Video Content: Support for uploading and viewing video content.
- SPL-Token Payments: Allow payments with other tokens like USDC.
- Subscriptions: Implement a subscription model using token streams or on-chain programs.
- Decentralized Storage: Move content storage to a fully decentralized solution like Arweave.
- Program-Owned Vaults: Use a Solana program with Program-Derived Addresses (PDAs) to act as escrow vaults for payments, enabling more complex logic.