This guide will help you deploy NEET.me to Railway.
- A GitHub account
- A Railway account (sign up at https://railway.app)
- A Reown project ID (get it from https://dashboard.reown.com)
PostgreSQL is required for all environments - both development and production. The Prisma schema is configured for PostgreSQL and should not be changed.
Before developing locally, you need a PostgreSQL database:
Option 1: Local PostgreSQL
- Install PostgreSQL on your machine
- Create a database:
createdb neetmetree - Update
.envwith:DATABASE_URL="postgresql://user:password@localhost:5432/neetmetree"
Option 2: Docker
docker run --name postgres-neetmetree \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=neetmetree \
-p 5432:5432 \
-d postgresOption 3: Cloud PostgreSQL
- Use Railway, Supabase, or Neon for a free PostgreSQL database
- Copy the connection string to your
.envfile
-
Initialize git repository (if not already done):
git init git add . git commit -m "Initial commit"
-
Create a new repository on GitHub
-
Push your code:
git remote add origin https://github.com/yourusername/neetmetree.git git branch -M main git push -u origin main
- Go to https://railway.app and sign in
- Click "New Project"
- Select "Deploy from GitHub repo"
- Choose your repository
- Railway will automatically detect it's a Next.js app
- In your Railway project, click "New"
- Select "Database" → "Add PostgreSQL"
- Railway will automatically create a PostgreSQL database
- The
DATABASE_URLenvironment variable will be automatically set
In your Railway project settings, add these environment variables:
NEXT_PUBLIC_REOWN_PROJECT_ID- Your Reown project IDNEXT_PUBLIC_APP_URL- Your Railway app URL (e.g.,https://your-app-name.railway.app)NEXTAUTH_URL- Same asNEXT_PUBLIC_APP_URLNEXTAUTH_SECRET- Generate with:openssl rand -base64 32NODE_ENV- Set toproduction
Note: DATABASE_URL is automatically set by Railway when you add PostgreSQL.
Important: You must add your Railway domain to Reown's allowed origins to fix CSP errors.
- Go to https://dashboard.reown.com
- Open your project settings
- Update the "Homepage URL" to your Railway domain (e.g.,
https://your-app-name.railway.app) - Add your Railway domain to "Allowed Origins" - This is critical for fixing the CSP frame-ancestors error
- Save the changes
Note: Features (email, socials) are managed remotely via the Reown dashboard. Local configuration in code is ignored.
Automatic: Database migrations run automatically on every deployment startup. The start script runs prisma db push before starting the server, so your database schema will be automatically created/synced.
No manual migration steps needed! 🎉
- Railway will automatically deploy when you push to GitHub
- Or manually trigger a deployment from the Railway dashboard
- Wait for the deployment to complete
- Your app will be live at
https://your-app-name.railway.app
- Visit your Railway URL
- Test sign-in functionality
- Test creating a profile
- Test uploading an avatar
- Test adding links
- Verify
DATABASE_URLis set correctly in Railway - Check that PostgreSQL service is running
- Ensure Prisma schema is using
postgresqlprovider
- Check Railway build logs for errors
- Ensure all environment variables are set
- Verify
package.jsonscripts are correct - Database migrations run automatically on startup - no manual steps needed
- Verify images are being stored in database (check PostgreSQL)
- Check API route logs in Railway
- Ensure base64 data is being saved correctly
- Verify
NEXT_PUBLIC_REOWN_PROJECT_IDis correct - Check Reown dashboard for allowed origins
- Ensure
NEXT_PUBLIC_APP_URLmatches your Railway domain
- PostgreSQL database added and connected
- All environment variables set
- Reown project configured with production URL
- Database migrations run successfully
- App deployed and accessible
- Sign-in functionality tested
- Image uploads working
- Links creation working
- Profile pages accessible
- In Railway, go to your service settings
- Click "Generate Domain" or add a custom domain
- Update
NEXT_PUBLIC_APP_URLandNEXTAUTH_URLwith your custom domain - Update Reown dashboard with the new domain
Railway provides:
- Build logs
- Runtime logs
- Metrics dashboard
- Database connection monitoring
Check these regularly to ensure your app is running smoothly.