/how-to-build-lovable

How to build Online test booking with Lovable?

Build an online test booking system with Lovable: step-by-step guide to add scheduling, payments and notifications to increase bookings, save time

Book a free  consultation
4.9
Clutch rating 🌟
600+
Happy partners
17+
Countries served
190+
Team members
Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to build Online test booking with Lovable?

You can build an online test-booking app in Lovable without a terminal by using Chat Mode to create React pages/components, adding the Supabase client, storing keys in Lovable Cloud Secrets, and testing in Preview. Create the UI and client-side calls to Supabase (no server code required), set up tables in the Supabase dashboard (outside Lovable via SQL editor), then Publish from Lovable after confirming Secrets are set. This works well in Lovable because Preview will build the app and use the Secrets you configure; no CLI needed.

 

What we’re building / changing

 

Implement a simple online test booking flow: a booking page that lists available test slots (from Supabase), allows a user to reserve a slot (creates a booking row), and shows confirmations. Data lives in Supabase; Lovable hosts the frontend and reads credentials from Lovable Cloud Secrets.

 

Lovable-native approach

 

Use Chat Mode edits to create/modify files (React components and a Supabase client), set Supabase keys in Lovable Cloud Secrets, use Preview to test the flow, and Publish from the Lovable UI. Schema creation in Supabase uses the Supabase dashboard SQL editor (outside Lovable). If you need server functions or migrations that require CLI, export to GitHub and run them locally (labelled below).

 

Meta-prompts to paste into Lovable

 

Prompt 1 — scaffold client and Supabase helper

  • Goal: Add supabase client and package.json dependency.
  • Files to create/modify: update package.json (add dependency "@supabase/supabase-js": "^2.0.0"), create src/lib/supabaseClient.ts
  • Acceptance criteria (done when): package.json includes "@supabase/supabase-js"; src/lib/supabaseClient.ts exists and exports a configured client using environment variables NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON\_KEY.
  • Secrets/setup: Add two secrets in Lovable Cloud Secrets UI: NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON\_KEY (values from your Supabase project).
// create src/lib/supabaseClient.ts
import { createClient } from '@supabase/supabase-js'

// Supabase public keys must be NEXT_PUBLIC_* so the frontend can read them at build/runtime
const url = process.env.NEXT_PUBLIC_SUPABASE_URL
const anon = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY

export const supabase = createClient(url!, anon!)

 

Prompt 2 — create booking page and basic UI

  • Goal: Create a page at /booking that lists slots and allows a user to book.
  • Files to create: src/pages/booking.tsx (or src/booking.jsx if your app structure differs)
  • Acceptance criteria: Visiting /booking in Preview shows available slots fetched from Supabase and a working "Book" button that inserts a booking row (name + email) and shows confirmation.
// create src/pages/booking.tsx
import React, { useEffect, useState } from 'react'
import { supabase } from '../lib/supabaseClient'

// simple client-only UI: fetch slots and insert a booking on click
export default function Booking() {
  const [slots, setSlots] = useState<any[]>([])
  const [name, setName] = useState('')
  const [email, setEmail] = useState('')
  const [message, setMessage] = useState('')

  useEffect(() => {
    async function load() {
      // fetch available slots (assumes table "slots")
      const { data } = await supabase.from('slots').select('*').order('start', { ascending: true })
      setSlots(data || [])
    }
    load()
  }, [])

  async function book(slotId: string) {
    const { error } = await supabase.from('bookings').insert([{ slot_id: slotId, name, email }])
    if (error) setMessage('Booking failed: ' + error.message)
    else setMessage('Booked successfully!')
  }

  return (
    <div>
      <h1>Book a Test</h1>
      <input placeholder="Name" value={name} onChange={e => setName(e.target.value)} />
      <input placeholder="Email" value={email} onChange={e => setEmail(e.target.value)} />
      <ul>
        {slots.map(s => (
          <li key={s.id}>
            {new Date(s.start).toLocaleString()} - <button onClick={() => book(s.id)}>Book</button>
          </li>
        ))}
      </ul>
      <div>{message}</div>
    </div>
  )
}

 

Prompt 3 — Supabase schema (outside Lovable)

  • Goal: Create the required tables in Supabase.
  • Action (outside Lovable): In Supabase Dashboard > SQL Editor, run the SQL below.
  • Acceptance criteria: Tables slots and bookings exist and Preview can read/write rows.
-- run in Supabase SQL editor
create table if not exists slots (
  id uuid primary key default gen_random_uuid(),
  start timestamp with time zone not null
);

create table if not exists bookings (
  id uuid primary key default gen_random_uuid(),
  slot_id uuid references slots(id),
  name text not null,
  email text not null,
  created_at timestamptz default now()
);

 

How to verify in Lovable Preview

 

  • Open Preview and navigate to /booking.
  • Verify: slots list appears (if none, add a slot in Supabase dashboard manually), fill name/email and click Book; Preview shows "Booked successfully!" and the new row appears in Supabase bookings table.

 

How to Publish / re-publish

 

  • Set Secrets: Confirm NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON\_KEY exist in Lovable Cloud Secrets for the Publish environment.
  • Publish: Click Publish in Lovable. The published site will use the stored Secrets at build/runtime.
  • Re-publish after changes: Make edits in Chat Mode, Preview test, then Publish again.

 

Common pitfalls in Lovable (and how to avoid them)

 

  • Missing Secrets: Preview might run locally but Publish can fail if Secrets are not set. Always add NEXT_PUBLIC_\* keys in Lovable Cloud Secrets.
  • Using service_role key in client: Never expose service_role key in client; use anon key and RLS policies in Supabase if needed.
  • No slots visible: Ensure you created rows in slots via Supabase dashboard or SQL; Lovable cannot create DB schema for you.
  • Need server logic/migrations: If you require server functions or migrations via CLI, export to GitHub from Lovable and run those locally (outside Lovable; terminal required). Label these steps "outside Lovable".

 

Validity bar

 

All instructions use Lovable-native features: Chat Mode file edits, Preview, Publish, and Lovable Cloud Secrets. Schema creation uses the Supabase dashboard (Supabase SQL editor). No fake Lovable menus or terminal commands are suggested. If you need server-side code requiring CLI, export to GitHub and run migrations locally — that step is explicitly outside Lovable.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

How to add idempotent booking creation with audit logging

This prompt helps an AI assistant understand your setup and guide to build the feature

AI AI Prompt

How to add per-user booking rate limiting + admin inspection

This prompt helps an AI assistant understand your setup and guide to build the feature

AI AI Prompt

How to add a cached, fuzzy search for available test slots

This prompt helps an AI assistant understand your setup and guide to build the feature

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation
Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

Best Practices for Building a Online test booking with AI Code Generators

You should design the booking app to keep business-critical logic in the backend (atomic booking via DB function), use Supabase for storage/auth, keep secrets in Lovable Cloud Secrets, use Lovable’s Chat edits/Preview/Publish for iterative development, and treat AI code generators as accelerators — always review, test, and wrap generated code in reviewed RPCs/transactions before trusting it for bookings.

 

Architecture & first principles

 

Keep the source of truth in the database (Supabase/Postgres). Implement atomic booking in the DB (a Postgres RPC/function) so concurrent requests can’t double-book. Use Lovable’s Secrets UI to store service\_role keys, and use server-side RPCs called from a protected API route. Use Lovable Preview to exercise flows and GitHub sync to export when you need CI/deploy control.

  • Auth: Supabase Auth or external provider. Keep user identity on server side for booking calls.
  • Booking logic: Postgres function that validates availability and inserts in one transaction.
  • AI code generators: use for scaffolding, tests, and docs — not for transactional logic without review.

 

Minimal safe pattern (real code)

 

-- // Create tables and a transactional RPC function in Supabase SQL editor
create table slots (
  id uuid primary key default gen_random_uuid(),
  start timestamptz not null,
  capacity int not null
);

create table bookings (
  id uuid primary key default gen_random_uuid(),
  slot_id uuid references slots(id),
  user_id uuid not null,
  created_at timestamptz default now()
);

create or replace function create_booking(p_slot uuid, p_user uuid)
returns uuid as $$
declare
  v_capacity int;
  v_booked int;
  v_booking_id uuid;
begin
  select capacity into v_capacity from slots where id = p_slot for update;
  if not found then
    raise exception 'slot not found';
  end if;

  select count(*) into v_booked from bookings where slot_id = p_slot;

  if v_booked >= v_capacity then
    raise exception 'no_capacity';
  end if;

  insert into bookings(slot_id, user_id) values (p_slot, p_user) returning id into v_booking_id;
  return v_booking_id;
end;
$$ language plpgsql security definer;

 

// // Next.js (app/api/book/route.js) server route calls the RPC
import { createClient } from '@supabase/supabase-js';

// // Use Lovable Secrets to set SUPABASE_URL & SUPABASE_SERVICE_ROLE
const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_ROLE);

export async function POST(req) {
  // // parse body for slot_id; ensure user is authenticated server-side
  const { slot_id, user_id } = await req.json();

  const { data, error } = await supabase.rpc('create_booking', { p_slot: slot_id, p_user: user_id });
  if (error) return new Response(JSON.stringify({ error: error.message }), { status: 400 });

  return new Response(JSON.stringify({ booking_id: data }), { status: 200 });
}

 

Lovable workflow — practical steps

 

  • Scaffold using AI generator inside Lovable Chat Mode to create files and routes. Review diffs before applying.
  • Secrets — set SUPABASE_URL and SUPABASE_SERVICE\_ROLE in Lovable Cloud Secrets UI (never commit keys).
  • Preview — use Preview to click through booking flow and watch server logs in Lovable (if available).
  • Publish or GitHub sync — export to GitHub for CI, or Publish from Lovable when ready.

 

Safety, testing, and AI-generator guardrails

 

  • Code review — always inspect AI-generated SQL/JS for edge cases and injection risks.
  • Unit & integration tests — write tests that simulate concurrent booking attempts (race conditions).
  • Monitoring — log booking failures and rate-limit endpoints.
  • Payments & PCI — don’t handle card data directly; use Stripe and keep secrets in Lovable Secrets.

 

Follow this pattern: move sensitive/atomic logic into DB RPCs, keep keys in Lovable Secrets, iterate with Chat Mode + Preview, and sync to GitHub for production CI/deploy. Use AI generators for speed, but always validate and test the generated code before publishing.


Recognized by the best

Trusted by 600+ businesses globally

From startups to enterprises and everything in between, see for yourself our incredible impact.

RapidDev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with.

They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

Arkady
CPO, Praction
Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost.

He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Donald Muir
Co-Founder, Arc
RapidDev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space.

They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Mat Westergreen-Thorne
Co-CEO, Grantify
RapidDev is an excellent developer for custom-code solutions.

We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Emmanuel Brown
Co-Founder, Church Real Estate Marketplace
Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 

This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Samantha Fekete
Production Manager, Media Production Company
The pSEO strategy executed by RapidDev is clearly driving meaningful results.

Working with RapidDev has delivered measurable, year-over-year growth. Comparing the same period, clicks increased by 129%, impressions grew by 196%, and average position improved by 14.6%. Most importantly, qualified contact form submissions rose 350%, excluding spam.

Appreciation as well to Matt Graham for championing the collaboration!

Michael W. Hammond
Principal Owner, OCD Tech

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We’ll discuss your project and provide a custom quote at no cost.