Installation Guide
This comprehensive guide covers everything you need to install, configure, and deploy SkyCast IA in both development and production environments.System Requirements
Ensure your development environment meets these minimum requirements before proceeding.
- Node.js: Version 20 or higher
- npm: Version 10+ (comes with Node.js)
- Operating System: macOS, Windows, or Linux
- Browser: Modern browser with geolocation support (Chrome, Firefox, Safari, Edge)
Verify Installation
Getting API Keys
SkyCast IA requires three API services. Follow these steps to obtain your keys:The free tier includes 1,000 API calls per day. SkyCast IA makes approximately 3-4 calls per location search.
- Label: SkyCast IA
- reCAPTCHA type: v3
- Domains: Add
localhostfor development and your production domain
- Site Key (public, used in frontend)
- Secret Key (private, used in backend)
Project Installation
Step 1: Clone Repository
Step 2: Install Dependencies
Install all required packages frompackage.json:
[email protected]- React framework[email protected]- UI library[email protected]- React DOM renderertypescript@^5- Type safety
@google/generative-ai@^0.24.1- Google AI SDK (Gemini support)
tailwindcss@^4- Utility-first CSSlucide-react@^0.576.0- Icon libraryrecharts@^3.7.0- Chart components
leaflet@^1.9.4- Interactive mapsreact-leaflet@^5.0.0- React wrapper for Leafletcountry-state-city@^3.2.1- Location data
react-google-recaptcha@^3.1.0- reCAPTCHA integration
@types/node,@types/react,@types/react-dom- TypeScript definitions@types/leaflet,@types/react-google-recaptcha- Additional type definitionseslint@^9- Code linting[email protected]- Next.js ESLint config
View complete package.json
View complete package.json
package.json
Step 3: Environment Configuration
Create a.env.local file in the root directory:
.env.local
Environment Variable Reference
| Variable | Type | Required | Description |
|---|---|---|---|
NEXT_PUBLIC_OPENWEATHER_API_KEY | Public | Yes | OpenWeatherMap API key for weather data |
GROQ_API_KEY | Private | Yes | Groq AI key for weather analysis (server-side) |
RECAPTCHA_SECRET_KEY | Private | No | reCAPTCHA secret for chat validation |
NEXT_PUBLIC_RECAPTCHA_SITE_KEY | Public | No | reCAPTCHA site key for frontend |
Variables prefixed with
NEXT_PUBLIC_ are exposed to the browser. Private variables are only accessible in API routes and server components.Step 4: Start Development Server
Project Structure Explained
Configuration Files
Next.js Configuration
Thenext.config.ts file contains framework settings:
next.config.ts
Tailwind Configuration
Tailwind CSS 4 is configured intailwind.config.ts:
tailwind.config.ts
Building for Production
Step 1: Create Production Build
- Type-checks all TypeScript files
- Lints code with ESLint
- Optimizes and bundles for production
- Generates static pages where possible
Step 2: Test Production Build Locally
Step 3: Deploy
SkyCast IA can be deployed to various platforms:Deploy to Vercel (Recommended)
Deploy to Vercel (Recommended)
Vercel (creators of Next.js) offers the best integration:
- Push code to GitHub/GitLab/Bitbucket
- Import project at vercel.com/new
- Add environment variables in project settings
- Deploy
- Runs builds on every push
- Configures edge functions for API routes
- Provides free SSL certificates
- Offers global CDN distribution
Deploy to Netlify
Deploy to Netlify
- Install Netlify CLI:
npm install -g netlify-cli - Build project:
npm run build - Deploy:
netlify deploy --prod - Configure environment variables in Netlify dashboard
next.config.ts for static export if needed:Self-Hosted Deployment
Self-Hosted Deployment
For VPS or dedicated servers:
- Build the application:
npm run build - Start with PM2 for process management:
- Configure Nginx as reverse proxy:
Troubleshooting Common Issues
Module not found errors
Module not found errors
Problem: Ensure
Module not found: Can't resolve 'leaflet'Solution:leaflet and react-leaflet versions match:Window is not defined (Leaflet)
Window is not defined (Leaflet)
Problem: Server-side rendering error with LeafletSolution: The WeatherMap component already uses dynamic import with If you create new map components, always use this pattern.
ssr: false:src/app/page.tsx
API key not working
API key not working
Problem:
401 Unauthorized from OpenWeatherMapSolutions:- Activation delay: Wait 10-15 minutes after generating new key
- Wrong variable name: Must be
NEXT_PUBLIC_OPENWEATHER_API_KEY - Server restart: Restart dev server after adding environment variables
- Verify in code: Check console logs in browser DevTools Network tab
Geolocation not working
Geolocation not working
Problem: Location permission denied or timeoutSolutions:
- Browser permissions: Click lock icon → Location → Allow
- HTTPS required: Geolocation only works on HTTPS (or localhost)
- Timeout increase: Already set to 15 seconds in
useLocation.ts:21 - Fallback to search: Use city search if GPS unavailable
src/hooks/useLocation.ts
TypeScript errors
TypeScript errors
Problem: Type errors in components or API callsSolution: Install missing type definitions:For any
any types, define proper interfaces:AI chat not responding
AI chat not responding
Problem: Chat returns errors or empty responsesChecks:
- Groq API key: Verify
GROQ_API_KEYin.env.local - reCAPTCHA: If using chat, ensure both reCAPTCHA keys are set
- Rate limits: Check Groq console for quota limits
- Network tab: Inspect
/api/chatrequest in browser DevTools
src/app/api/chat/route.ts includes detailed error handling:Build fails with CSS errors
Build fails with CSS errors
Problem: Tailwind CSS or PostCSS errors during buildSolution: Ensure Tailwind 4 is properly configured:
- Check
globals.csshas directives:
src/app/globals.css
- Verify
tailwind.config.tscontent paths are correct - Clear Next.js cache:
Development Tips
These tips will help you develop more efficiently with SkyCast IA.
Hot Reload Issues
If changes aren’t reflecting:Testing Different Weather Conditions
Search for cities with different climates:- Hot: Dubai, UAE (28°C+)
- Cold/Snow: Reykjavik, Iceland (0°C or below)
- Rainy: London, UK
- Clear: Los Angeles, USA
src/app/page.tsx:420-430.
Debugging API Calls
Add console logs to API clients:src/lib/api/weather.ts
Performance Optimization
The app is already optimized with:- Dynamic imports for heavy components (Leaflet)
- Parallel API calls with
Promise.all - Memoized callbacks with
useCallback - Debounced search (400ms in SearchCity)
Next Steps
Now that SkyCast IA is installed:- Customize: Modify components in
src/components/ui/ - Extend: Add new weather data sources or AI features
- Deploy: Push to production with Vercel or your preferred platform
- Monitor: Set up error tracking with Sentry or similar tools
