-
Go to Render.com and sign up/login
-
Create a new PostgreSQL database:
- Click "New +" → "PostgreSQL"
- Name:
virtual-stock-market-db - Plan: Free (or paid for production)
- Region: Choose closest to your users
- Click "Create Database"
-
Get your database connection string:
- Once created, go to your database dashboard
- Copy the "External Database URL"
- It will look like:
postgresql://username:password@hostname:port/database
-
Push your code to GitHub:
git init git add . git commit -m "Initial commit: Virtual Stock Market Simulator" git branch -M main git remote add origin https://github.com/yourusername/virtual-stock-market.git git push -u origin main
-
Deploy to Vercel:
- Go to vercel.com
- Sign up/login with GitHub
- Click "New Project"
- Import your GitHub repository
- Configure environment variables (see below)
In your Vercel project dashboard, go to Settings → Environment Variables and add:
DATABASE_URL = postgresql://username:password@hostname:port/database
NEXTAUTH_URL = https://your-app-name.vercel.app
NEXTAUTH_SECRET = your-super-secret-key-here
Generate NEXTAUTH_SECRET:
openssl rand -base64 32-
Deploy to Vercel:
- Vercel will automatically build and deploy
- Wait for deployment to complete
-
Run database migrations:
- Go to your Vercel project dashboard
- Go to Functions → Create a new function
- Or use Vercel CLI:
npx vercel env pull .env.local npx prisma migrate deploy npx prisma db seed
-
Initialize sample data:
- Visit:
https://your-app-name.vercel.app/api/init-db - Or run the init script locally with production DATABASE_URL
- Visit:
-
Test the application:
- Visit your Vercel URL
- Register a new account
- Check if database operations work
-
Monitor logs:
- Check Vercel function logs for any errors
- Monitor Render database usage
// In your Prisma client configuration
const prisma = new PrismaClient({
datasources: {
db: {
url: process.env.DATABASE_URL,
},
},
})# Production
DATABASE_URL="postgresql://username:password@hostname:port/database"
NEXTAUTH_URL="https://your-app.vercel.app"
NEXTAUTH_SECRET="your-production-secret"
NODE_ENV="production"- Vercel Analytics: Enable in project settings
- Database Monitoring: Use Render dashboard
- Error Tracking: Consider adding Sentry
- Performance: Monitor Core Web Vitals
-
Database Connection Errors:
- Check DATABASE_URL format
- Ensure Render database is running
- Verify network access
-
Build Failures:
- Check Prisma client generation
- Verify all dependencies are installed
- Check TypeScript errors
-
Authentication Issues:
- Verify NEXTAUTH_SECRET is set
- Check NEXTAUTH_URL matches your domain
- Ensure HTTPS in production
# Check deployment status
npx vercel ls
# View logs
npx vercel logs
# Run database migrations
npx prisma migrate deploy
# Generate Prisma client
npx prisma generate- Database migrations completed
- Sample data initialized
- User registration working
- Trading functionality tested
- Analytics dashboard accessible
- All API endpoints responding
- SSL certificate active
- Performance optimized
- Database: Upgrade Render plan for higher limits
- CDN: Vercel automatically handles this
- Caching: Consider Redis for session storage
- Monitoring: Set up alerts for errors and performance
Your Virtual Stock Market Simulator is now live! 🚀📈