A professional AI-powered construction management platform built with Next.js 14, Google Gemini API, and deployed on Vercel.
- Free AI Chat: 30 free questions powered by Google Gemini Pro
- Real-time Responses: Instant AI responses about construction, NEC codes, and best practices
- Professional UI: Clean, modern interface without distractions
- Freemium Model: Try before you buy with smooth upgrade path
- Mobile Responsive: Works perfectly on all devices
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- AI: Google Gemini Pro API
- Deployment: Vercel
- State Management: React Hooks
- Node.js 18+ installed
- Google API key (free from Google AI Studio)
- Vercel account (free tier works great)
# Create a new Next.js project or use this code
npm install- Go to Google AI Studio
- Click "Get API Key"
- Create a new API key (it's free!)
- Copy the key
Create a .env.local file in the root directory:
GOOGLE_API_KEY=your_google_gemini_api_key_here
NEXT_PUBLIC_APP_URL=http://localhost:3000npm run devOpen http://localhost:3000 in your browser.
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Add environment variable
vercel env add GOOGLE_API_KEY- Push your code to GitHub
- Go to vercel.com
- Click "New Project"
- Import your GitHub repository
- Add environment variable:
- Name:
GOOGLE_API_KEY - Value: Your Google API key
- Name:
- Click "Deploy"
Click this button to deploy:
constructioncody-app/
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ └── chat/
│ │ │ └── route.ts # Gemini API endpoint
│ │ ├── layout.tsx # Root layout
│ │ ├── page.tsx # Main chat page
│ │ └── globals.css # Global styles
│ └── components/
│ ├── ChatMessage.tsx # Message bubble component
│ ├── ChatInput.tsx # Input with suggestions
│ ├── Sidebar.tsx # Pro features sidebar
│ └── LoginModal.tsx # Sign up/in modal
├── public/ # Static assets
├── .env.local # Environment variables (local)
├── .env.example # Example env file
├── next.config.js # Next.js configuration
├── tailwind.config.js # Tailwind configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Dependencies
Send a message to the AI and get a response.
Request:
{
"message": "What are NEC grounding requirements?",
"conversationHistory": [
{
"role": "user",
"content": "Previous question"
},
{
"role": "assistant",
"content": "Previous answer"
}
]
}Response:
{
"success": true,
"response": "According to NEC Article 250...",
"timestamp": "2025-10-13T12:00:00Z"
}Edit the SYSTEM_PROMPT in src/app/api/chat/route.ts to customize the AI's behavior and expertise.
Update MAX_FREE_QUESTIONS in src/app/page.tsx (currently set to 30).
Edit the SUGGESTIONS array in src/components/ChatInput.tsx.
All styles use Tailwind CSS. The primary color scheme is defined in tailwind.config.js.
| Variable | Description | Required |
|---|---|---|
GOOGLE_API_KEY |
Google Gemini API key | Yes |
NEXT_PUBLIC_APP_URL |
Your app URL | No (defaults to localhost) |
- Free Tier: Generous free quota
- No Credit Card: Start immediately without payment info
- Powerful: Comparable to GPT-4 for most tasks
- Fast: Low latency responses
- Easy: Simple API, great docs
- 60 requests per minute
- Plenty for small-to-medium apps
- Upgrade to paid tier for higher limits
- Visit Google AI Studio
- Sign in with Google
- Click "Get API Key"
- Copy and use immediately
- First Load: ~500ms (Next.js 14 optimizations)
- API Response: 1-3 seconds (Gemini Pro)
- Caching: Built-in with Next.js
- Bundle Size: Optimized with tree-shaking
- API key stored in environment variables
- Never exposed to client
- CORS protection enabled
- Rate limiting recommended for production
- Set production
GOOGLE_API_KEY - Update
NEXT_PUBLIC_APP_URL - Add rate limiting (Vercel Edge Config)
- Set up analytics (Vercel Analytics)
- Configure custom domain
- Test on mobile devices
- Set up error monitoring (Sentry)
- Add SEO metadata
- Test all user flows
- Rate Limiting: Add rate limiting per IP/user
- Caching: Cache common questions/responses
- Paid Tier: Upgrade to Gemini API paid tier
- Database: Add PostgreSQL for user accounts
- Authentication: Implement proper auth (NextAuth.js)
- Analytics: Track usage and conversions
- Hosting (Vercel): Free for up to 100GB bandwidth
- API (Google): Free for first 60 req/min, then $0.00025/1K characters
- Example: 10K questions/day = ~$1-2/day
- Check
.env.localfile exists - Verify key is correct (no extra spaces)
- Restart dev server after adding key
- Ensure environment variables are set in Vercel
- Check build logs for errors
- Verify all dependencies are installed
- Check API key is valid
- Verify internet connection
- Check Google AI Studio for service status
- Add Authentication: Implement user accounts
- Add Database: Store conversation history
- Pro Features: Build document upload, RFI management
- Mobile App: Create React Native version
- Analytics: Track conversions and usage
- Documentation: Next.js Docs
- Gemini API: Google AI Docs
- Vercel: Vercel Docs
Proprietary - All rights reserved
Built with:
Ready to deploy? Push to GitHub and connect to Vercel. You'll be live in minutes!