A multiplayer lunar resource extraction game built for Farcaster with Supabase backend and Netlify hosting.
Farpost is an engaging lunar mining simulation where players:
- Manage lunar territory through a hexagonal grid system
- Deploy expeditions to extract valuable resources
- Upgrade operations with powerful boosters
- Progress through levels to unlock advanced resources
- Build a thriving lunar colony
The game has been completely refactored from a monolithic design to a modern, modular architecture:
js/core/
โโโ GameStateManager.js # State management & validation
โโโ ResourceManager.js # Resource extraction & boosters
โโโ UIController.js # UI updates & interactions
โโโ GameEngine.js # Main coordinator & public API
Benefits:
- ๐ง Maintainable: Clear separation of concerns
- ๐งช Testable: Individual module testing capabilities
- ๐ Scalable: Easy to add new features
- โก Performance: Optimized update cycles
- ๐ Debuggable: Better error tracking and logging
- Modular JavaScript Architecture - Event-driven components with clear boundaries
- HTML5/CSS3 - Pure web technologies for maximum compatibility
- Responsive Design - Works on desktop, tablet, and mobile
- Real-time Updates - Live progress tracking and animations
- Event System - Loose coupling via reactive updates
- Supabase - PostgreSQL database with real-time capabilities
- Netlify Functions - Serverless API endpoints
- Row Level Security - Secure user data isolation
- JWT Authentication - Secure user sessions
- Netlify - Static hosting with global CDN
- GitHub - Version control and CI/CD
- Custom Domain - Professional deployment ready
- Node.js 16+
- Supabase account
- Netlify account
-
Clone the repository
git clone <your-repo-url> cd farposter npm install
-
Set up Supabase
- Create a new Supabase project
- Run the SQL schema from
supabase/schema.sql - Get your API keys from Settings > API
-
Configure environment
cp env.example .env # Edit .env with your Supabase credentials -
Update configuration
- Edit
js/config.jswith your Supabase URL and keys
- Edit
-
Start development server
npm run dev
Visit http://localhost:8888 to play the game locally.
See DEPLOYMENT.md for complete deployment instructions.
- Push code to GitHub
- Connect repository to Netlify
- Set environment variables in Netlify dashboard
- Deploy automatically
- 10 Unique Resources - From Lunar Regolith to Helium-3
- Dynamic Pricing - Resources have different values and extraction times
- Progressive Unlocks - Advanced resources unlock with player level
- Hexagonal Grid - 18 cells of lunar territory
- Cell Progression - Purchase and upgrade individual cells
- Visual Feedback - Real-time extraction progress and status
- 5 Booster Types - Speed up extraction operations
- Strategic Application - Use on specific cells or globally
- Resource Optimization - Plan boosters for maximum efficiency
- Level System - Gain XP and unlock new content
- Expeditions - Purchase and deploy resource extraction missions
- Economic Growth - Build wealth through smart resource management
POST /api/auth/signup- Create new user accountPOST /api/auth/signin- Sign in existing userPOST /api/auth/signout- Sign out current user
GET /api/game-state- Load complete game statePUT /api/game-state- Save game state updates
POST /api/game-actions- Execute game actions:purchase_expedition- Buy expedition equipmentpurchase_booster- Buy performance boosterspurchase_cell- Expand territorydeploy_expedition- Start resource extractioncollect_resource- Harvest completed extractionssell_resources- Convert resources to pointsapply_booster- Activate speed boosters
player_profiles- User progression and statsgame_cells- Territory ownership and statusplayer_resources- Resource inventoryplayer_expeditions- Expedition equipmentplayer_boosters- Booster inventorygame_sessions- Analytics and tracking
- Row Level Security (RLS) enabled on all tables
- JWT-based authentication
- User isolation through database policies
- Vanilla JavaScript - No frameworks, pure performance
- CSS Grid & Flexbox - Modern responsive layouts
- CSS Animations - Smooth UI transitions
- Local Storage Fallback - Offline capability
- Supabase - Backend-as-a-Service
- PostgreSQL - Robust relational database
- Netlify Functions - Serverless compute
- Node.js - Server-side JavaScript
- ESLint - Code quality
- Prettier - Code formatting
- Git Hooks - Pre-commit validation
- Authentication Required - All game actions require valid JWT
- Input Validation - Server-side validation of all actions
- Rate Limiting - Prevent abuse of game mechanics
- CORS Protection - Restrict cross-origin requests
- SQL Injection Prevention - Parameterized queries only
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Player engagement metrics
- Resource extraction patterns
- Level progression tracking
- Economic balance monitoring
- Client-side error capture
- Server function monitoring
- Database performance metrics
- User feedback collection
- Resource Trading - Player-to-player commerce
- Alliances - Cooperative gameplay
- Competitions - Leaderboards and tournaments
- Real-time Chat - Community interaction
- Territory Wars - Competitive cell claiming
- Research Tree - Technology progression
- Market Dynamics - Supply/demand pricing
- Special Events - Limited-time challenges
- Progressive Web App - Mobile app-like experience
- Offline Mode - Play without internet
- Push Notifications - Extraction completion alerts
- Social Integration - Share achievements
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check the
/docsfolder - Issues: Create GitHub issues for bugs
- Discussions: Use GitHub Discussions for questions
- Email: Contact the development team
- Supabase Team - Amazing backend platform
- Netlify Team - Excellent hosting solution
- Farcaster Community - Inspiration and support
- Open Source Contributors - Various libraries and tools
Ready to mine the moon? ๐ Deploy your own instance and start extracting lunar resources today!