A full-stack template for building Telegram Mini Apps with Go backend and React frontend.
- Backend: Go with Huma REST API framework
- Frontend: React 19 + Vite + TypeScript + Tailwind CSS
- Database: PostgreSQL with migrations
- Telegram Integration: Bot SDK and Mini App support
- API Documentation: Auto-generated OpenAPI/Swagger docs
- Docker: Docker Compose for easy development setup
- Go 1.24+
- Node.js 18+ and npm
- Docker and Docker Compose
- PostgreSQL 16+ (or use Docker Compose)
git clone <repository-url>
cd tma-templateNavigate to the server directory:
cd serverCreate a .env file in the server directory:
# Server Configuration
HTTP_PORT=8000
HTTP_HOST=0.0.0.0
DEBUG=true
# Database Configuration
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=cats
# Telegram Configuration
TG_BOT_TOKEN=your_bot_token_here
WEBAPP_NAME=your_webapp_name
# Storage Configuration (optional)
STORAGE_IMAGES_PATH=images
# S3 Configuration (optional)
S3_ACCESS_KEY_ID=
S3_SECRET_KEY=
S3_REGION=
S3_BUCKET=
S3_ENDPOINT_URL=
S3_ROOT_DIRECTORY=
# Logging
LOG_HANDLER=tintInstall Go dependencies:
go mod downloadNavigate to the client directory:
cd ../clientInstall dependencies:
npm installUpdate public/config.js with your configuration:
window.api = {
BOT_USERNAME: "your_bot_username",
API_URL: "http://localhost:8000",
};Start the database and Adminer:
cd server
make db-compose-upRun database migrations:
make db-migrate-upStart the backend server:
make server-runIn another terminal, start the frontend:
cd client
npm run devStart all services:
cd server
make compose-up- Start PostgreSQL database
- Run migrations:
make db-migrate-up - Start backend:
make server-run - Start frontend:
cd client && npm run dev
Once the server is running, access the API documentation:
- OpenAPI YAML: http://localhost:8000/api/v1/openapi.yaml
- OpenAPI JSON: http://localhost:8000/api/v1/openapi.json
- Interactive Docs: http://localhost:8000/api/v1/docs
cd server
make db-migrate-upmake db-migrate-downcd server
# Run server
make server-run
# Run Telegram bot
make bot-run
# Lint code
make lint
# Fix linting issues
make lint-fix
# Generate Swagger documentation
make swagcd client
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Lint code
npm run lint
# Fix linting issues
npm run lint-fixSee the .env example above for all available configuration options.
Edit client/public/config.js to configure:
- Bot username
- API URL
cd server
docker compose up --builddocker compose down