Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/igorek05m/daily-geogame/llms.txt

Use this file to discover all available pages before exploring further.

Daily GeoGame is optimized for deployment on Vercel, the platform built by the creators of Next.js.
1

Push to GitHub

Ensure your code is pushed to a GitHub repository:
git add .
git commit -m "Ready for deployment"
git push origin main
2

Import to Vercel

Go to vercel.com and sign in with your GitHub account. Click “Add New Project” and import your repository.
3

Configure project settings

Vercel will automatically detect that this is a Next.js project. The default settings should work:
  • Framework Preset: Next.js
  • Build Command: next build --turbopack (from package.json)
  • Output Directory: .next (auto-detected)
  • Install Command: pnpm install (auto-detected)
4

Add environment variables

Before deploying, add your MongoDB connection string:
  1. Go to “Environment Variables” section
  2. Add MONGODB_URI with your MongoDB Atlas connection string
  3. Select all environments (Production, Preview, Development)
Use your production MongoDB connection string, not your development one.
5

Deploy

Click “Deploy” and Vercel will build and deploy your application. Your app will be live at a *.vercel.app URL.
The live demo is hosted at https://daily-geogame.vercel.app

Environment variables in production

Required variables

Set these environment variables in your deployment platform:
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/geogame?retryWrites=true&w=majority

Setting variables on Vercel

1

Navigate to project settings

Go to your project dashboard on Vercel and click “Settings”.
2

Add environment variables

Click “Environment Variables” in the sidebar and add your variables:
  • Key: MONGODB_URI
  • Value: Your MongoDB connection string
  • Environments: Select Production, Preview, and Development
3

Redeploy

If you add variables after initial deployment, trigger a new deployment for changes to take effect.

MongoDB Atlas production setup

For production deployments, configure MongoDB Atlas with enhanced security:
1

Use a production cluster

Create a separate production cluster, distinct from your development database. Consider upgrading from the free M0 tier for better performance.
2

Configure IP whitelist

Restrict access to Vercel’s IP addresses:
  1. In MongoDB Atlas, go to “Network Access”
  2. Add Vercel’s IP ranges or use 0.0.0.0/0 (less secure but easier)
  3. For tighter security, use Vercel’s static IP addresses if available on your plan
3

Set up database user

Create a production-specific database user:
  1. Use a strong, unique password
  2. Grant only necessary permissions (readWrite on your database)
  3. Store credentials securely in environment variables
4

Enable monitoring

Enable MongoDB Atlas monitoring and set up alerts for:
  • Connection spikes
  • High CPU usage
  • Storage threshold warnings
Use MongoDB Atlas’s free M0 tier for small projects, but consider upgrading for production workloads with higher traffic.

Build process

The build process compiles your Next.js application for production:
npm run build
This runs next build --turbopack, which:
  1. Compiles TypeScript to JavaScript
  2. Optimizes React components
  3. Generates static pages where possible
  4. Creates optimized bundles with Turbopack

Build output

After a successful build, you’ll see output similar to:
✓ Compiled successfully
✓ Linting and checking validity of types
✓ Collecting page data
✓ Generating static pages
✓ Finalizing page optimization

Route (app)                              Size     First Load JS
┌ ○ /                                   XXX kB         XXX kB
└ ○ /api/*                              XXX kB         XXX kB

Starting the production server

For custom hosting, start the production server after building:
npm run start
This runs next start, which serves the built application on port 3000.
On Vercel, this step is handled automatically. You only need this for self-hosting.

Custom domain setup

To use a custom domain with your Vercel deployment:
1

Add domain in Vercel

Go to your project settings → “Domains” and add your custom domain.
2

Configure DNS

Add DNS records to your domain provider:
  • Type: A or CNAME
  • Name: @ (or your subdomain)
  • Value: Provided by Vercel
3

Verify and enable HTTPS

Vercel will automatically verify your domain and provision SSL certificates. This usually takes a few minutes.

Alternative deployment platforms

Self-hosting with Docker

For self-hosting, create a Dockerfile:
FROM node:20-alpine

WORKDIR /app

COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install --frozen-lockfile

COPY . .

RUN pnpm build

EXPOSE 3000

CMD ["pnpm", "start"]
Build and run:
docker build -t daily-geogame .
docker run -p 3000:3000 -e MONGODB_URI="your-connection-string" daily-geogame

Other platforms

Daily GeoGame can be deployed to any platform that supports Next.js:
  • Netlify: Use the Next.js build plugin
  • Railway: Auto-detects Next.js, add environment variables
  • DigitalOcean App Platform: Import from GitHub, configure build settings
  • AWS Amplify: Import repository and set build configuration
For all platforms, ensure you:
  1. Set MONGODB_URI environment variable
  2. Use Node.js 20.x or higher
  3. Install pnpm or configure the platform to use it
  4. Use build command: pnpm build
  5. Use start command: pnpm start

Monitoring and logs

Vercel monitoring

Vercel provides built-in monitoring:
  1. Real-time logs: View deployment and runtime logs in the dashboard
  2. Analytics: Track page views and performance (requires upgrade)
  3. Error tracking: See runtime errors and stack traces
Access logs:
  • Go to your project → “Deployments”
  • Click on a deployment to view its logs
  • Use “Runtime Logs” for live application logs

MongoDB Atlas monitoring

Monitor your database:
  1. Performance: View query performance and slow queries
  2. Connections: Track connection count and patterns
  3. Storage: Monitor database size and growth
  4. Alerts: Set up email alerts for issues
Enable MongoDB Atlas’s Performance Advisor to get recommendations for index optimization.

Production checklist

Before going live, verify:
  • MongoDB connection string is set in environment variables
  • Using production MongoDB cluster (not development)
  • MongoDB network access is properly configured
  • Database user has appropriate permissions
  • Build completes without errors
  • All required dependencies are in package.json
  • .env.local is in .gitignore
  • Custom domain is configured (if applicable)
  • SSL certificate is active
  • Monitoring and alerts are enabled

Troubleshooting

Build failures

If your build fails:
  1. Check the build logs for TypeScript errors
  2. Ensure all dependencies are listed in package.json
  3. Verify Node.js version is 20.x or higher
  4. Try building locally first: pnpm build

MongoDB connection errors

If you see database connection errors:
  1. Verify MONGODB_URI is set correctly
  2. Check MongoDB Atlas network access settings
  3. Ensure database user credentials are correct
  4. Test connection string locally

Performance issues

If your application is slow:
  1. Check MongoDB Atlas performance metrics
  2. Consider upgrading from M0 tier
  3. Add database indexes for frequently queried fields
  4. Enable Vercel Analytics to identify bottlenecks

Next steps

After deployment:
  • Monitor your application’s performance
  • Set up error tracking (Sentry, LogRocket, etc.)
  • Configure continuous deployment for automatic updates
  • Review and optimize database queries

Build docs developers (and LLMs) love