/how-to-build-lovable

How to build Simple CMS with Lovable?

Hands-on guide to build a simple CMS with Lovable using clear steps, code examples and deployment tips to launch a fast, maintainable content site

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 Simple CMS with Lovable?

You can build a Simple CMS in Lovable by using a small React frontend + Supabase as the storage backend, configuring Supabase credentials in Lovable Secrets, and letting Lovable edit/create the frontend and API files through Chat Mode. No terminal is needed inside Lovable; any Supabase table creation is done in the Supabase dashboard (outside Lovable) and Lovable will use the Secrets UI to store keys. Below are step-by-step Lovable prompts you can paste into Lovable chat to implement the CMS.

 

What we’re building / changing

 

A minimal CMS with an admin editor and a public listing page. Admin can create, edit, publish, and delete posts stored in a Supabase table. Frontend in src/, client-side Supabase calls, and a simple Auth check using a secret admin token stored in Lovable Secrets.

 

Lovable-native approach

 

We’ll use Chat Mode to add and edit files (React pages, components, and a small API client). Use Lovable Preview to run and test the app. Use Lovable Cloud Secrets UI to store SUPABASE_URL and SUPABASE_ANON_KEY and an ADMIN_TOKEN. No terminal needed. If you want DB schema created automatically, that part is outside Lovable (use Supabase dashboard).

 

Meta-prompts to paste into Lovable

 

  • Prompt A — Add frontend pages and Supabase client

    Goal: Create React pages and Supabase client for CMS.

    Files to create/modify:

    • create src/lib/supabaseClient.ts — initialize Supabase using env vars
    • create src/pages/index.tsx — public listing of published posts
    • create src/pages/admin.tsx — admin UI with list + editor
    • create src/components/PostEditor.tsx — title/content editor and save/delete buttons

    Acceptance criteria: Done when Preview shows a public list at / and an admin page at /admin that can call Supabase and show empty state.

    Secrets needed: SUPABASE_URL and SUPABASE_ANON\_KEY set in Lovable Cloud Secrets UI.

    Implementation notes: Include comments in files explaining where to change table name 'posts'.

  • Prompt B — Admin auth and admin-only actions

    Goal: Protect admin UI by checking a header token set via Secrets and a client-side check against ADMIN\_TOKEN secret.

    Files to create/modify:

    • modify src/pages/admin.tsx — add a prompt to enter admin token and store in sessionStorage for session-only admin mode

    Acceptance criteria: Done when visiting /admin asks for token and only shows editor after correct token matches Lovable secret value (use Secrets UI to set ADMIN\_TOKEN).

    Secrets needed: ADMIN\_TOKEN in Lovable Cloud Secrets UI.

  • Prompt C — Supabase table setup (outside Lovable)

    Goal: Create the 'posts' table in Supabase dashboard.

    Steps (outside Lovable):

    • Create table posts with columns: id UUID primary key (default gen_random_uuid()), title text, content text, published boolean default false, created\_at timestamp default now()

    Acceptance criteria: Done when Supabase shows the table and you can insert a row via the dashboard.

 

How to verify in Lovable Preview

 

  • Open Preview, go to / → see published posts (empty initially).
  • Go to /admin → enter ADMIN\_TOKEN (set in Secrets) → create a post → mark published → verify it appears on /.

 

How to Publish / re-publish

 

  • Use Lovable Publish button to push the site live. Ensure Secrets are set in Lovable Cloud before publishing.
  • If using GitHub sync/export for more control, use Lovable’s GitHub integration to push code; DB setup remains in Supabase dashboard (outside Lovable).

 

Common pitfalls in Lovable (and how to avoid them)

 

  • Missing Secrets: Preview may run but Supabase calls fail—set SUPABASE_URL and SUPABASE_ANON\_KEY in Lovable Secrets UI.
  • Table not created: The app will return empty results—create the 'posts' table in the Supabase dashboard (outside Lovable).
  • Assuming terminal: Don’t expect to run migrations inside Lovable. Any DB schema or advanced deployment step must be done in Supabase dashboard or via GitHub workflows outside Lovable.
  • Over-permissive keys: For production, use row-level security and appropriate keys; for quick demo, anon key is OK but not secure.

 

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 content versioning & rollback to Simple CMS

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

AI AI Prompt

How to add attachment uploads with a Preview-safe fallback

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

AI AI Prompt

How to add shareable draft preview links

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 Simple CMS with AI Code Generators

The fastest, safest pattern is: keep AI generation and CMS storage separate (AI = content creator, DB = source of truth), store all secrets in Lovable Secrets, implement generation behind a server API route that uses those secrets, test in Lovable Preview, and export to GitHub only when you need out-of-Lovable operations (migrations, specialized CI). This avoids exposing keys, keeps previews reproducible, and respects Lovable’s no-terminal constraint.

 

High-level workflow

 

  • Use Lovable Chat Mode and file diffs to create/iterate frontend, API routes, and tests.
  • Put keys in Lovable Secrets UI (OPENAI_API_KEY, SUPABASE_URL, SUPABASE_KEY).
  • Generate content via an internal API that calls OpenAI, then save the result to Supabase.
  • Preview in Lovable to validate flows. Publish / GitHub sync only when you need external tooling or manual DB migrations.

 

Minimal working example (Next.js-style API + client)

 

// pages/api/generate-and-save.js
import { createClient } from '@supabase/supabase-js'

// create Supabase client using secrets configured in Lovable Secrets UI
const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_KEY)

export default async function handler(req, res) {
  // // only POST accepted
  if (req.method !== 'POST') return res.status(405).end()

  const { title, prompt } = req.body

  // // call OpenAI Chat Completion using the API key in secrets
  const chatResp = await fetch('https://api.openai.com/v1/chat/completions', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`
    },
    body: JSON.stringify({
      model: 'gpt-3.5-turbo',
      messages: [{ role: 'user', content: prompt }],
      max_tokens: 800
    })
  })
  const chatJson = await chatResp.json()
  const content = chatJson?.choices?.[0]?.message?.content ?? ''

  // // save generated content into Supabase table "articles"
  const { data, error } = await supabase
    .from('articles')
    .insert([{ title, content }])
    .select()

  if (error) return res.status(500).json({ error: error.message })
  res.status(200).json({ article: data[0] })
}

 

// client-side usage
async function createArticle() {
  // // call Lovable-hosted API route (works in Preview)
  const res = await fetch('/api/generate-and-save', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ title: 'My Post', prompt: 'Write a short blog post about...' })
  })
  const json = await res.json()
  console.log(json)
}

 

Practical tips & gotchas in Lovable

 

  • Secrets: Add OPENAI_API_KEY, SUPABASE_URL, SUPABASE_KEY in Lovable Secrets UI. Never hard-code in files. Preview reads them too.
  • No terminal: For DB migrations use Supabase dashboard SQL editor or export to GitHub and run migrations via external CI — you can’t run CLI commands inside Lovable.
  • Iterate with Chat Mode: Ask Lovable to produce file diffs/patches for API tweaks or tests, then Preview to exercise end-to-end behavior.
  • Rate & cost control: Add input validation and limits to avoid runaway OpenAI calls (tokens/calls/month). Log usage to Supabase for auditing.
  • Export to GitHub: Use when you need branches, CI, or to run build scripts. Keep secrets out of repo and manage them in your deployment environment.

 


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.