- ✅ Updated Prisma schema to use PostgreSQL (required for all environments)
- ✅ Changed
avatarfield to@db.Textfor storing base64 data - ✅ Changed
iconfield in Link model to@db.Textfor base64 storage - ✅ PostgreSQL is now required for both development and production
- ✅ Avatar Upload API (
/api/upload/avatar.ts): Now stores base64 data directly in database - ✅ Image Serving API (
/api/images/avatar/[userId].ts): Serves images from database as binary data - ✅ All user-uploaded content (avatars, custom link icons) now stored in PostgreSQL
- ✅ Created
.env.examplewith all required environment variables - ✅ Created
railway.jsonfor Railway-specific configuration - ✅ Updated
package.jsonwith Railway build scripts - ✅ Updated
.gitignoreto exclude SQLite database files
- ✅ Created
RAILWAY_DEPLOYMENT.mdwith complete deployment guide
Before deploying to Railway:
-
GitHub Setup
- Initialize git repository
- Push code to GitHub
- Verify all files are committed
-
Railway Setup
- Create Railway account
- Create new project from GitHub repo
- Add PostgreSQL database service
- Configure environment variables (see
.env.example)
-
Reown Configuration
- Get Reown Project ID from dashboard.reown.com
- Update Reown dashboard with Railway domain
- Add Railway domain to allowed origins
-
Environment Variables (Set in Railway)
DATABASE_URL (auto-set by Railway) NEXT_PUBLIC_REOWN_PROJECT_ID NEXT_PUBLIC_APP_URL NEXTAUTH_URL NEXTAUTH_SECRET NODE_ENV=production -
Database Migration
- Run
npx prisma db pushafter first deployment - Or use Railway CLI:
railway run npm run railway
- Run
- Push code to GitHub
- Railway auto-detects Next.js and starts building
- Add PostgreSQL database in Railway
- Set environment variables
- Run database migration:
railway run npm run railway - Deploy and test!
- PostgreSQL is required for all environments (development and production)
- Images are stored in database as base64 data URIs
- No filesystem storage - everything is in PostgreSQL
- Database migrations must be run manually after first deployment
- Environment variables must be set before deployment
For local development, you need a PostgreSQL database:
- Install PostgreSQL locally, OR
- Use Docker:
docker run --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres, OR - Use a cloud PostgreSQL service (Railway, Supabase, Neon)
If deployment fails:
- Check Railway build logs
- Verify all environment variables are set
- Ensure PostgreSQL is connected
- Run
prisma db pushmanually if needed
See RAILWAY_DEPLOYMENT.md for detailed instructions.