Skip to content

A Telegram-based customer loyalty rewards system for restaurants and cafes, built with Go and React. Features QR code identification, points management, and an admin dashboard

License

Notifications You must be signed in to change notification settings

quochuydev/go-pos-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go POS Bot

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.

Features

  • 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)

Tech Stack

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

Prerequisites

  • Go 1.23+
  • Node.js 18+ (for admin dashboard)
  • MongoDB instance (local or MongoDB Atlas)
  • Telegram Bot Token (from @BotFather)

Setup

1. Clone and configure

git clone https://github.com/yourusername/go-pos-bot.git
cd go-pos-bot
cp .env.example .env

2. Environment variables

Create 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_password

3. Run the backend

go mod download
go run main.go

The server starts on port 12345.

4. Run the admin dashboard

cd admin
npm install
npm run dev

Dashboard available at http://localhost:5173.

Bot Commands

Command Description
/start Register as a new customer
/get_customer_info View your points and QR code
/redeem Exchange points for rewards

API Endpoints

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

Deployment

Build for Linux (AWS EC2)

GOOS=linux GOARCH=amd64 go build -o myapp

Nginx reverse proxy

server {
    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;
    }
}

SSL with Certbot

sudo yum install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com

License

MIT

About

A Telegram-based customer loyalty rewards system for restaurants and cafes, built with Go and React. Features QR code identification, points management, and an admin dashboard

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •