AstroFarm is an educational farming simulation game that uses real NASA satellite data to teach sustainable agriculture practices. Players make farming decisions based on actual environmental data from the Central Valley of California.
🚀 Live Demo: Deploy in progress...
- Real NASA Data: Uses MODIS NDVI, SMAP soil moisture, and GPM precipitation data
- Educational Tips: Contextual guidance based on sustainable farming practices
- Achievement System: Super Carrot medals with 4 tiers (Bronze, Silver, Gold, Platinum)
- Multiplayer: Asynchronous competition with weekly seeds and private rooms
- Interactive Map: Leaflet-based map with NASA data layers
- Responsive Design: Works on desktop and mobile devices
- Node.js 18+
- npm or yarn
- Supabase account (for database)
- Clone the repository:
git clone <repository-url>
cd astrofarm_game- Install dependencies:
npm install- Set up environment variables:
cp env.example .env.local-
Configure Supabase:
- Create a new Supabase project
- Run the migration in
supabase/migrations/001_init.sql - Update
.env.localwith your Supabase credentials
-
Start the development server:
npm run dev- Open http://localhost:3000 in your browser
- Start a Game: Click "Start Playing" on the homepage
- Make Decisions: Use the HUD to water, fertilize, plant, and harvest crops
- Learn from Tips: Read contextual tips about sustainable farming practices
- Earn Achievements: Get Super Carrot medals for good farming decisions
- Compete: Join weekly challenges or create private rooms with friends
- Humidity Management: Learn to water efficiently with weather forecasts
- NDVI Interpretation: Distinguish between cloud cover and crop stress
- Frost Protection: Time planting to avoid frost damage
- Drought Response: Manage water during dry periods
- Final Challenge: Optimize all farming practices for maximum yield
- NDVI: MODIS MCD13Q1 (250m resolution, 16-day composite)
- Soil Moisture: SMAP via Crop-CASMA (~1km resolution)
- Temperature: MODIS MOD11A2 (1km resolution, 8-day composite)
- Precipitation: GPM IMERG (0.1° resolution, 30-minute intervals)
- Next.js 14 with App Router
- React 18 with TypeScript
- TailwindCSS for styling
- Leaflet for interactive maps
- Zustand for state management
- Framer Motion for animations
- Next.js API Routes (serverless)
- Supabase (PostgreSQL + Auth)
- Zod for validation
- Pure functions for deterministic simulation
- Seeded RNG for reproducible results
- Server-side validation to prevent cheating
# Run unit tests
npm run test
# Run end-to-end tests
npm run test:e2e
# Run linting
npm run lint- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
# Build the application
npm run build
# Start production server
npm startNEXT_PUBLIC_SUPABASE_URL: Your Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY: Your Supabase anonymous keySUPABASE_SERVICE_ROLE_KEY: Your Supabase service role key
Edit src/lib/config.ts to modify:
- Game parameters (resources, costs, targets)
- Achievement criteria
- Tip rules and cooldowns
- Data layer configurations
AstroFarm teaches:
- Water Management: Efficient irrigation and drought response
- Soil Health: Organic vs. synthetic fertilizers
- Climate Data: Interpreting satellite imagery and weather data
- Sustainable Practices: Environmental impact of farming decisions
- Data Limitations: Understanding resolution, latency, and accuracy
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- NASA for providing open satellite data
- Supabase for the backend infrastructure
- Vercel for hosting and deployment
- OpenStreetMap for base map tiles
For questions or support:
- Create an issue on GitHub
- Check the Data & Principles page
- Review the FAIR/CARE principles for data usage
- Additional crop types and regions
- Real-time multiplayer with WebSockets
- Mobile app with React Native
- Integration with more NASA datasets
- Advanced analytics and reporting
- Teacher dashboard for classroom use
Built with ❤️ for sustainable agriculture education