A modern, minimalistic payment system for the Stoneworks Minecraft server, built with React and Node.js.
This code is publicly available for viewing and learning purposes ONLY.
You MAY NOT deploy or use this software without explicit written permission from the copyright holder.
See the LICENSE file for complete terms and conditions.
- 🔐 Secure Authentication - JWT-based authentication with bcrypt password hashing
- 💰 Dual Currency System - Agon and Game Chips
- 🔄 Currency Swap - Exchange currencies at 1:1 ratio
- 💸 Peer-to-Peer Payments - Send payments to other users
- 📊 Transaction History - Track all your transactions
- 👥 User Directory - Browse and search all registered users
- 🏪 Auction House - Buy and sell Minecraft items with secure escrow system
- 👑 Admin Panel - Comprehensive user management, analytics, and auction monitoring
- 🎟️ Invite System - One-time use invite codes for controlled user registration
- 🎨 Modern UI - Professional, minimalistic design inspired by Phantom wallet
- A 5% commission fee is applied to completed auctions. Upon buyer confirmation, the fee is automatically deducted from the final price and transferred to an admin account; the remaining 95% is released to the seller. Both net payout and commission are recorded as separate transactions for transparency.
- React 18
- Vite
- Tailwind CSS
- React Router
- Axios
- Node.js
- Express
- PostgreSQL (Replit-compatible, Neon serverless)
- JWT Authentication
- bcrypt
- Node.js (v16 or higher)
- npm or yarn
- PostgreSQL database (automatically provisioned on Replit)
-
Clone the repository
cd Agon -
Install all dependencies
npm run install:all
-
Set up environment variables
Create a
.envfile in theserverdirectory:PORT=3001 JWT_SECRET=your_jwt_secret_key_change_this_in_production NODE_ENV=development DATABASE_URL=postgresql://user:password@localhost:5432/dbname
Note: On Replit,
DATABASE_URLis automatically set when you provision a PostgreSQL database. -
Start the development servers
npm run dev
This will start both the backend server (port 3001) and frontend client (port 5000).
Alternatively, you can start them separately:
# Terminal 1 - Backend npm run server # Terminal 2 - Frontend npm run client
-
Access the application
Open your browser and navigate to
http://localhost:5000
This application is fully optimized for deployment on Replit with PostgreSQL support.
See REPLIT_DEPLOYMENT.md for complete deployment instructions.
Key features:
- ✅ Automatic PostgreSQL provisioning (Neon serverless)
- ✅ Pre-configured connection pooling for serverless architecture
- ✅ Automatic schema initialization
- ✅ Built-in retry logic for cold starts
- ✅ SSL-secured database connections
- ✅ Graceful shutdown handling
For deployment guides to other platforms, see:
- QUICK_START_DEPLOYMENT.md - General deployment guide
- DEPLOYMENT_GUIDE.md - Detailed deployment options
Agon/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Main application pages
│ │ ├── services/ # API service layer
│ │ ├── context/ # React context (Auth)
│ │ ├── utils/ # Utility functions
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── index.html
│ ├── package.json
│ ├── tailwind.config.js
│ └── vite.config.js
├── server/ # Express backend
│ ├── src/
│ │ ├── config/ # Database configuration
│ │ ├── controllers/ # Business logic
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Authentication middleware
│ │ └── server.js # Main server file
│ ├── database.db # SQLite database (auto-generated)
│ └── package.json
├── package.json # Root package.json
└── README.md
POST /api/auth/signup- Create a new user account (requires invite code)POST /api/auth/login- Login to an existing accountGET /api/auth/profile- Get current user profile (protected)
GET /api/wallet- Get wallet balances (protected)POST /api/wallet/swap- Swap between currencies (protected)
POST /api/payment/send- Send payment to another user (protected)GET /api/payment/transactions- Get transaction history (protected)
GET /api/users- Get all users (protected)GET /api/users/search- Search users by username (protected)
GET /api/admin/users- Get all users with detailed statsPOST /api/admin/users/:id/toggle-disabled- Enable/disable user accountPOST /api/admin/users/:id/toggle-admin- Promote/demote admin statusGET /api/admin/metrics- Get system-wide metrics, analytics, and auction statsGET /api/admin/activity- Get activity logsGET /api/admin/invite-codes- Get all invite codesPOST /api/admin/invite-codes- Create custom invite codePOST /api/admin/invite-codes/generate- Generate random invite codeDELETE /api/admin/invite-codes/:id- Delete unused invite code
GET /api/auctions- Get all auctions (with filters for status: active/ended/completed)GET /api/auctions/:id- Get detailed auction information with bid historyPOST /api/auctions- Create a new auction listingPOST /api/auctions/:id/bid- Place a bid on an auction (with automatic escrow)POST /api/auctions/:id/confirm-delivery- Confirm item delivery and release paymentGET /api/auctions/my-auctions- Get your auction listingsGET /api/auctions/my-bids- Get auctions you've bid onDELETE /api/auctions/:id- Cancel an auction (only if no bids)
- Navigate to the signup page
- Enter your Minecraft username and a valid invite code
- Create a password
- You'll receive 100 Agon and 100 Game Chips as a welcome bonus
- Go to the "Send" page
- Select a recipient from the dropdown
- Choose the currency (Agon or Game Chips)
- Enter the amount and an optional description
- Click "Send Payment"
- Go to the "Swap" page
- Select the currency you want to swap from
- Select the currency you want to receive
- Enter the amount
- Click "Swap Currency"
Currency swaps occur at a 1:1 ratio.
- Access the admin panel via
/admin/login - View system metrics, user statistics, and transaction analytics
- Manage users (enable/disable, promote to admin)
- Create and manage invite codes
- Monitor all user activity through detailed logs
- Go to the "Users" page
- Browse all registered users
- Use the search bar to find specific users
- Click "Send Payment" next to any user to quickly send them funds
Creating an Auction:
- Navigate to the Auction House
- Click "Create Auction"
- Enter item details (name, description, rarity, durability)
- Set a starting price in Agon
- Choose auction duration (in days)
- Submit the auction
Bidding on Items:
- Browse active auctions
- Click on an item to view details
- Enter your bid amount (must be higher than current bid)
- Your Agon will be held in secure escrow
- If outbid, your funds are automatically refunded
Completing a Sale:
- When the auction ends, the highest bidder wins
- Deliver the item to the winner in-game
- Winner confirms receipt by clicking "Confirm Delivery"
- Escrowed funds are released to the seller
id- Primary keyusername- Unique Minecraft usernamepassword- Hashed passwordcreated_at- Account creation timestamp
id- Primary keyuser_id- Foreign key to users tableagon- Agon balancestoneworks_dollar- Game Chips balanceagon_escrow- Agon held in escrow for active bids
id- Primary keyfrom_user_id- Sender user IDto_user_id- Recipient user ID (null for swaps)transaction_type- Type: 'payment' or 'swap'currency- Currency usedamount- Transaction amountdescription- Optional descriptioncreated_at- Transaction timestamp
id- Primary keyuser_id- User who performed the actionaction- Action typemetadata- JSON metadata about the actioncreated_at- Action timestamp
id- Primary keycode- Unique invite codecreated_by- Admin user who created itused_by- User who used it (null if unused)is_used- Boolean flagcreated_at- Creation timestampused_at- Usage timestamp
id- Primary keyseller_id- Foreign key to users tableitem_name- Name of the item being solditem_description- Detailed descriptionrarity- Item rarity tierdurability- Item durability percentagestarting_price- Initial bid price in Agoncurrent_bid- Current highest bidhighest_bidder_id- Foreign key to users tableend_date- Auction end timestampstatus- Auction status (active/ended/completed/cancelled)created_at- Creation timestampcompleted_at- Completion timestamp
id- Primary keyauction_id- Foreign key to auctions tablebidder_id- Foreign key to users tableamount- Bid amount in Agonis_active- Whether this bid is still activecreated_at- Bid timestamp
Agon is designed with modularity in mind. Planned future features include:
- 📈 Stock Market - Trade virtual stocks with Agon
- 💵 Bonds - Purchase and trade bonds
- 🏦 Loans - Borrow and lend between users
- 📱 Mobile App - Native mobile application
- 🔗 Minecraft Integration - Direct integration with Minecraft server
- 🔔 Notifications - Real-time transaction notifications
- 👥 User Profiles - Enhanced user profiles with avatars
- 🎁 Gift Cards - Create and redeem gift cards
- 🔒 Two-Factor Authentication - Enhanced security
npm run buildThis will create optimized production builds in the client/dist directory.
npm startThis will start the production server on port 3001.
- Change the
JWT_SECRETin your.envfile to a strong, random string - Use environment variables for all sensitive configuration
- Enable HTTPS/SSL
- Implement rate limiting
- Add input sanitization
- Set up proper CORS policies
- Use a production-grade database (PostgreSQL, MySQL)
- Implement proper logging and monitoring
All Rights Reserved - Copyright (c) 2025 Kevin Lin
This source code is made publicly available for viewing and learning purposes ONLY.
Deployment, use, or modification for any purpose other than learning is strictly prohibited without explicit written permission from the copyright holder.
See the LICENSE file for complete terms and conditions.
To request permission to deploy or use this software, please open an issue in the repository with your use case. Permission must be granted explicitly in writing by the copyright holder.
For issues, questions, or feature requests, please create an issue in the repository.
Built with ❤️ for the Stoneworks Minecraft Server