A React-based Tamagotchi-style virtual pet game featuring an adorable alien companion! Care for your pet by managing hunger, happiness, and cleanliness stats, play mini-games, and compete on the global leaderboard.
Built with Replit AI
- Virtual Pet Care - Feed, clean, and play with your alien (stats decay over time)
- Mini-Game - "Click the Books! Avoid the Worms!" with progressive difficulty
- Global Leaderboard - Top 10 high scores with PostgreSQL persistence
- Visual Feedback - Animations, emojis, and mood indicators
- React ^18.2.0 - UI library
- Vite ^5.0.0 - Build tool and dev server
- TypeScript ^5.2.2 - Type safety (partial support)
- Express ^5.1.0 - REST API server
- Node.js - Runtime environment
- CORS ^2.8.5 - Cross-origin resource sharing
- WebSocket (ws) ^8.18.3 - Real-time communication (available for future features)
- PostgreSQL - Database (hosted on Neon)
- Drizzle ORM ^0.44.7 - Type-safe database toolkit
- @neondatabase/serverless ^1.0.2 - Neon PostgreSQL driver
- Node.js (v18+ recommended)
- npm or compatible package manager
- PostgreSQL database (Neon recommended)
-
Clone the repository
git clone https://github.com/yourusername/Reactigotchi.git cd Reactigotchi -
Install dependencies
npm install
-
Configure environment variables
Create a
.envfile in the root directory:DATABASE_URL=postgresql://user:password@host/database
-
Initialize the database
npm run db:push
-
Start the development servers
npm start
This runs both the Vite dev server (frontend) and Express API server (backend) concurrently.
npm start- Runs both frontend and backend concurrentlynpm run dev- Starts Vite dev server only (port varies)npm run server- Starts Express API server only (port 3000)npm run build- Creates production buildnpm run preview- Previews production buildnpm run db:push- Pushes database schema changes to Neon
Reactigotchi/
├── src/ # React frontend
│ ├── App.jsx # Main app component
│ ├── Tamagotchi.jsx # Core game logic and state
│ ├── AlienCanvas.jsx # Alien rendering and animations
│ ├── GameUI.jsx # Stats display and action buttons
│ ├── MiniGame.jsx # Click game implementation
│ ├── Scoreboard.jsx # Leaderboard display and submission
│ └── *.css # Component styles
├── server/ # Express backend
│ ├── index.js # API routes and server setup
│ └── db.js # Database connection
├── shared/ # Shared code
│ └── schema.js # Drizzle ORM schema
├── drizzle.config.ts # Drizzle configuration
├── vite.config.js # Vite configuration
├── package.json # Dependencies and scripts
└── README.md # You are here!
Stats decay every 5 seconds. Feed (+25 hunger), Clean (restores cleanliness), and Play (opens mini-game) to keep your alien happy!
Mini-Game: Click 📚 books (+1 point), avoid 🪱 worms (+1 strike). 3 strikes = game over. Score converts to happiness boost (×5).
Leaderboard: Top 10 scores. Submit 3-letter initials when you qualify.
GET /api/highscores- Top 10 scoresPOST /api/highscores- Submit score (requiresinitials,score, optionalemail)GET /api/check-highscore/:score- Check if score qualifies for top 10
Contributions are welcome! Feel free to:
- Report bugs by opening an issue
- Suggest new features or improvements
- Submit pull requests with enhancements
This project is open source and available under the ISC License.
- Initially built with Replit AI
- Built with React and Vite
- Database powered by Neon and Drizzle ORM
- Hosted on Replit
- Inspired by the classic Tamagotchi virtual pets
Made with ❤️ for learning and fun!