Pinata is a reliable IPFS pinning service that ensures your files stay available on IPFS. It's free to start and much more reliable than public IPFS gateways.
- Your app uploads → Profile data goes to Pinata via API
- Pinata stores → File is pinned on IPFS network
- Pinata returns CID → Content Identifier (e.g.,
bafyreiabc123...) - Smart contract stores CID → On Polygon blockchain
- Anyone can fetch → Using the CID from any IPFS gateway
- Go to https://app.pinata.cloud/register
- Sign up for a free account (1GB storage free)
- Verify your email
- Go to https://app.pinata.cloud/developers/api-keys
- Click "New Key"
- Give it a name:
Linko IPFS - Enable these permissions:
- ✅ pinFileToIPFS
- ✅ pinJSONToIPFS
- Click "Create Key"
- Copy the JWT token (starts with
eyJ...)⚠️ Save it immediately - you can't see it again!
Local Development (.env.local):
PINATA_JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24...Vercel Production:
- Go to your Vercel project settings
- Navigate to Environment Variables
- Add:
- Name:
PINATA_JWT - Value: Your JWT token
- Environment: Production, Preview, Development (select all)
- Name:
- Click Save
- Redeploy your app
- ✅ App still works
⚠️ Uses simulated in-memory storage- ❌ Data doesn't persist across server restarts
- ✅ Good for testing/development
- ✅ App works with real IPFS
- ✅ Data persists permanently
- ✅ Accessible from any IPFS gateway
- ✅ Production-ready
- Add PINATA_JWT to .env.local
- Restart dev server:
npm run dev - Save a profile
- Check console - should see:
Uploaded to Pinata: bafyrei... - Verify on Pinata Dashboard:
- Go to https://app.pinata.cloud/pinmanager
- See your uploaded
profile.jsonfile
Your files will be accessible via:
https://gateway.pinata.cloud/ipfs/{CID}https://ipfs.io/ipfs/{CID}https://cloudflare-ipfs.com/ipfs/{CID}
The app automatically tries multiple gateways for reliability.
Pinata Free Plan:
- 1 GB storage
- Unlimited bandwidth
- Perfect for your use case!
Each profile is ~1-5 KB, so you can store ~200,000+ profiles on free tier.
- Check JWT token is correct
- Regenerate API key if needed
- Free tier rate limit hit
- Wait a minute and try again
- Consider upgrading if needed
- PINATA_JWT not set in environment
- Add the token and restart server
If you don't want to use Pinata:
- Leave
PINATA_JWTempty - App uses in-memory storage (works for development)
- Data clears on server restart
- Not recommended for production
After setting up Pinata:
- Test profile save/load locally
- Add PINATA_JWT to Vercel
- Deploy to production
- Verify profiles persist
- Deploy smart contract to Polygon mainnet