Follow these steps to run and test the entire application from start to finish.
- Log in to your Supabase Dashboard.
- Create a new project.
- Go to SQL Editor in the left sidebar.
- Copy the content of
supabase/schema.sql(from your project files) and paste it into the query editor. - Click Run to create the tables.
- Go to Project Settings > API.
- Copy the
Project URLandanon publickey.
- Open Telegram and chat with @BotFather.
- Send
/newbot, name it (e.g., "BaliVibeTestBot"), and get the API Token. - Create a new Telegram Group.
- Add your new bot to the group as a member (and make it Admin if possible, but member is usually fine).
- Important: You need the
CHAT_IDof this group.- Simplest way: Add
@RawDataBotto the group, it will print a JSON. Look for"chat": { "id": -100xxxxxxx }. Copy that number (including the negative sign). - Remove
@RawDataBotafterwards.
- Simplest way: Add
- In VS Code, rename
.env.exampleto.env.local. - Fill in the values:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key TELEGRAM_BOT_TOKEN=your_bot_token TELEGRAM_GROUP_CHAT_ID=your_group_chat_id
Open your terminal in VS Code (Ctrl + ~) and run:
- Install Dependencies (if you haven't yet):
npm install
- Seed Database (Populate with tours):
You should see "✅ Seeding complete!"
npx tsx scripts/seed.ts
You will need two terminal tabs running simultaneously.
Submit the following commands:
Terminal 1: The Web App
npm run devWait for "Ready in ... ms". Open http://localhost:3000.
Terminal 2: The Telegram Bot
Open a new terminal (Click + in terminal panel) and run:
npx tsx bot/index.tsYou should see "Bot is running..."
- Go to
http://localhost:3000in your browser. - You should see the "BaliVibe Tours" hero and a list of tours.
- Click "View Details" on "Ubud Cultural Day Trip".
- Click "Book Now".
- Fill in the form:
- Date: Select tomorrow.
- Guests: 2.
- Phone: Any number.
- Pickup: "Grand Hyatt Bali".
- Click "Confirm Booking".
- You should be redirected to a "Booking Received!" page.
- Check your Telegram Group: You should see a message from your bot:
"🆕 NEW BOOKING REQUEST ... Who wants to take this?" [✅ Yes, I can do it 👍] [❌ No, I cannot 👎]
- Act as a Driver: Click the "✅ Yes" button in Telegram.
- The bot should reply "✅ You got the job!".
- The original message should update to say "✅ ACCEPTED... Assigned to: @yourusername".
- Go to
http://localhost:3000/admin - Go to Bookings (
/admin/bookings). - You should see your new booking there.
- The "Assigned Guide" column should show the name corresponding to the Telegram user (if linked in
guidestable) or match the ID logic.