This project is a template Go-based backend API for Telegram bot and Mini App based VPN service.
-
Clone the repository:
git clone https://github.com/R4yya/bizarre-vpn-api.git cd bizarre-vpn-api
-
Install Go dependencies:
go mod download
-
Set up environment variables:
Rename
.env.example
to.env
and configure necessary environment variables like:API_PORT=:5000 DATABASE_PATH=./data/database.db SWAGGER_PATH=/docs
-
Generate Swagger documentation (optional for development):
swag init --parseDependency --dir ./cmd/api,./internal/api/handlers --output ./docs
-
Start the API server:
go run cmd/api/main.go
-
Start the Telegram bot:
go run cmd/bot/main.go
To build the project as an executable:
go build -ldflags "-s -w" -o bin/api cmd/api/main.go
go build -ldflags "-s -w" -o bin/bot cmd/bot/main.go
This will generate api
and bot
binaries in the bin
directory.
After building, run the binaries with:
./bin/api
./bin/bot
After running the API server, Swagger documentation is available at:
https://example-domain:<API_PORT>/<SWAGGER_PATH>/index.html
The Makefile includes targets for managing dependencies, building, and running the API and bot services.
Run this to see list of targets:
make help
Logs are saved in the logs
directory, with separate log files for the API and bot services.
Feel free to reach out or open issues for bugs or feature requests.