A Telegram-based customer loyalty rewards system for restaurants and cafes. Customers can check points, redeem rewards, and receive QR codes for identification. Includes a React admin dashboard for management.
- Telegram Bot - Customer registration, points checking, QR code generation, reward redemption
- Admin Dashboard - React-based UI for managing customers, transactions, and rewards
- REST API - Endpoints for admin operations with basic authentication
- Points System - Configurable rewards (drinks: 2 points, food: 4 points)
| Component | Technology |
|---|---|
| Backend | Go 1.23, Gorilla Mux |
| Database | MongoDB |
| Bot | Telegram Bot API (telebot) |
| Frontend | React 19, Vite, Tailwind CSS, DaisyUI |
| QR Codes | go-qrcode |
- Go 1.23+
- Node.js 18+ (for admin dashboard)
- MongoDB instance (local or MongoDB Atlas)
- Telegram Bot Token (from @BotFather)
git clone https://github.com/yourusername/go-pos-bot.git
cd go-pos-bot
cp .env.example .envCreate a .env file:
SERVER=https://your-domain.com
TELEGRAM_TOKEN=your_telegram_bot_token
MONGO_URL=mongodb://localhost:27017
ADMIN_USER=admin
ADMIN_PASS=your_secure_passwordgo mod download
go run main.goThe server starts on port 12345.
cd admin
npm install
npm run devDashboard available at http://localhost:5173.
| Command | Description |
|---|---|
/start |
Register as a new customer |
/get_customer_info |
View your points and QR code |
/redeem |
Exchange points for rewards |
All /api/* endpoints require Basic Authentication.
| Method | Endpoint | Description |
|---|---|---|
| GET | /docs |
API documentation (Scalar) |
| GET | /api/customers |
List all customers |
| GET | /api/histories |
List transaction history |
| GET | /api/rewards |
List available rewards |
| POST | /api/increase-points |
Add points to customer |
| POST | /api/redeem |
Redeem points for reward |
GOOS=linux GOARCH=amd64 go build -o myappserver {
listen 80;
location / {
proxy_pass http://localhost:12345;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}sudo yum install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.comMIT