This guide will help you set up and run your VPN subscription service using Supabase as the backend database.
- Docker and Docker Compose installed
- A Telegram Bot token (you can get one from @BotFather)
- A server with a public IP address
- Go to the SQL Editor in your Supabase dashboard at https://app.supabase.com
- Create a new query
- Paste the entire contents of the
backend/src/utils/supabase-schema.sql
file - Run the query to create all necessary tables and initial data
The sample data includes server addresses like server1.yourvpn.com
. You should update these to your actual server domains or IP addresses:
- Go to the "Table Editor" in your Supabase dashboard
- Select the "servers" table
- Update the "address" field for each server to your actual domain or IP address
- Make sure your
.env
file has the following settings:TELEGRAM_BOT_TOKEN
: Your Telegram bot tokenSUPABASE_URL
: Your project URL (https://xnigsihqhdydfrgrujrd.supabase.co)SUPABASE_KEY
: Your anon keySUPABASE_SERVICE_ROLE_KEY
: Your service role keyVPN_DOMAIN
: Your VPN service domain
Run the following command to start all services:
docker-compose up -d
This will start:
- The 3x-ui VPN panel on port 54321
- The backend API on port 3000
- The admin panel on port 8080
- Check if the services are running:
docker-compose ps
- Test the API connection:
curl http://localhost:3000/api/supabase-status
- Access the admin panel at http://your-server-ip:8080
The first user you need to create is an admin user. To do this:
- Send a message to your Telegram bot to create a regular user account
- In the Supabase dashboard, go to the "Table Editor" and select the "users" table
- Find your user and change the "role" field from "user" to "admin"
If you encounter any issues:
- Check the logs:
docker-compose logs backend
- Make sure your Supabase credentials are correct in the
.env
file - Verify that all tables were created in your Supabase database
- Ensure your server can reach the Supabase API (no firewall blocking outbound requests)
- Keep your
.env
file secure - Never expose your service role key
- Consider enabling SSL for your services in production