Overview
This guide covers deploying Home Manager on your own infrastructure. You’ll learn how to set up the database, configure authentication, and deploy the application.Prerequisites
Node.js
Version 20.x or higher required
PostgreSQL
Version 14 or higher (local or cloud-hosted)
Clerk Account
Free account for authentication service
Git
For cloning the repository
Installation Methods
Choose your preferred deployment method:- Docker
- Vercel
- Local Development
- Custom Server
Recommended for production deployments
Step 1: Clone the Repository
The
postinstall script automatically runs prisma generate after installation.Step 2: Set Up PostgreSQL Database
Option A: Local PostgreSQL
Option B: Cloud PostgreSQL
Use a managed PostgreSQL service:Supabase
Free tier available with generous limits
Neon
Serverless Postgres with instant scaling
Railway
Simple deployment with built-in PostgreSQL
Step 3: Configure Clerk Authentication
Create Clerk Account
- Visit clerk.com and sign up
- Create a new application
- Choose authentication methods (Email, Google, GitHub, etc.)
Get API Keys
From your Clerk dashboard, navigate to API Keys and copy:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY(starts withpk_test_...orpk_live_...)CLERK_SECRET_KEY(starts withsk_test_...orsk_live_...)
Configure Allowed Domains
In Clerk dashboard, add your application domains:
- For local development:
http://localhost:3000 - For production:
https://yourdomain.com
Clerk provides the authentication UI components used in
src/app/page.tsx and handles all user management, password resets, and security.Step 4: Environment Configuration
Create a.env.local file in the project root:
.env.local
Environment Variables Reference
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string |
CLERK_SECRET_KEY | Yes | Server-side Clerk authentication key |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Yes | Client-side Clerk publishable key |
NEXT_PUBLIC_CLERK_SIGN_IN_URL | No | Custom sign-in page path (default: /) |
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL | No | Redirect after sign-in (default: /dashboard) |
Step 5: Initialize Database Schema
Home Manager uses Prisma ORM for database management:Push Database Schema
HouseholdHouseholdMemberChoresItemBillsItemShoppingItemMaintenanceItemNotificationAuditLog
For production, consider using
prisma migrate deploy instead of db push to maintain migration history.Step 6: Build and Deploy
Local Development
http://localhost:3000 with Turbopack for fast hot-reloading.
Production Build
Build the Application
- Runs
prisma generate - Compiles TypeScript
- Optimizes React components
- Generates static pages
- Creates production bundles
Deploy to Vercel
Configure Environment Variables
In Vercel dashboard, add your environment variables:
DATABASE_URLCLERK_SECRET_KEYNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
Vercel automatically detects Next.js and configures build settings. No additional configuration needed.
Deploy with Docker
Create aDockerfile:
Dockerfile
Deploy to Custom Server
For VPS or dedicated servers:Configure Reverse Proxy
Use Nginx or Apache to proxy to port 3000:
/etc/nginx/sites-available/home-manager
Step 7: Post-Deployment Configuration
Configure Clerk for Production
- Update Clerk dashboard with production domain
- Switch from test keys to live keys
- Configure production sign-in/sign-up URLs
Database Backup Strategy
Monitoring and Logging
Consider implementing:- Application monitoring (e.g., Sentry, LogRocket)
- Database monitoring (connection pools, slow queries)
- Server monitoring (CPU, memory, disk usage)
Troubleshooting
Database connection fails
Database connection fails
Symptoms:
PrismaClientInitializationErrorSolutions:- Verify
DATABASE_URLformat is correct - Check PostgreSQL is running:
sudo systemctl status postgresql - Verify user has correct permissions:
GRANT ALL PRIVILEGES ON DATABASE home_manager TO home_manager_user; - For cloud databases, ensure SSL mode is set:
?sslmode=require
Clerk authentication not working
Clerk authentication not working
Symptoms: Redirect loops, 401 errorsSolutions:
- Verify all Clerk environment variables are set correctly
- Check that domain is added to Clerk allowed origins
- Ensure you’re using the correct keys (test vs. live)
- Clear browser cookies and try again
- Review middleware configuration in
src/middleware.ts
Build fails with Prisma errors
Build fails with Prisma errors
Symptoms:
Cannot find module '@prisma/client'Solutions:- Run
npx prisma generatebefore building - Delete
node_modulesand reinstall:rm -rf node_modules && npm install - Ensure
DATABASE_URLis set during build (required for Prisma)
Port 3000 already in use
Port 3000 already in use
Solutions:
Security Best Practices
- Use strong database passwords: Generate random 32+ character passwords
- Enable SSL/TLS: Always use HTTPS in production
- Restrict database access: Only allow connections from application server IP
- Regular updates: Keep dependencies up to date with
npm audit - Environment isolation: Never reuse credentials between staging and production
- Backup encryption: Encrypt database backups at rest
- Rate limiting: Implement rate limiting on API routes (consider Clerk rate limits)
Performance Optimization
Database Optimization
Next.js Optimization
The application is already optimized with:- Server-side rendering for initial page loads
- API routes for backend logic
- Turbopack for fast development builds
- Material-UI emotion cache for CSS-in-JS performance
Maintenance Tasks
Regular Maintenance Checklist
- Weekly: Review application logs for errors
- Weekly: Check database size and growth
- Monthly: Update dependencies (
npm update) - Monthly: Review Clerk usage and limits
- Quarterly: Database vacuum and analyze
- Quarterly: Review and rotate API keys
Database Maintenance
Upgrading
To upgrade to a new version:Support and Resources
GitHub Repository
Source code, issues, and contributions
Clerk Documentation
Authentication setup and configuration
Prisma Documentation
Database management and queries
Next.js Documentation
Framework documentation and guides
Next Steps
After successful installation:Train Users
Share the Quick Start Guide with your users