--- status: "published" title: 'Testimonials Plugin in the Next.js Supabase SaaS Starter kit' label: 'Testimonials Plugin' order: 3 description: 'Learn how to install the Testimonials plugin in the Next.js Supabase SaaS Starter kit.' --- This plugin allows Makerkit users to easily collect and manage testimonials from their customers. It integrates seamlessly with the existing Makerkit structure and provides both backend and frontend components. ## Features 1. Testimonial submission form and manual entry 2. Admin panel for managing testimonials 3. API endpoints for CRUD operations 4. Widgets components for showing testimonials on the website ## Installation To install the plugin, run the following command: ```bash npx @makerkit/cli plugins add testimonial ``` The codemod will automatically: - Add the `@kit/testimonial` dependency and install packages - Create the translation file at `apps/web/i18n/messages/en/testimonials.json` - Add the `testimonials` namespace to your i18n settings - Add the testimonials sidebar item to the admin panel - Create the Supabase migration file for the testimonials table ### Run the migrations After installation, run the migration and regenerate types: ```bash pnpm run supabase:web:reset pnpm run supabase:web:typegen ``` The admin pages and sidebar item are automatically set up by the CLI. You can find them at: - `apps/web/app/[locale]/admin/testimonials/page.tsx` — Testimonials list - `apps/web/app/[locale]/admin/testimonials/[id]/page.tsx` — Testimonial detail page ## Displaying the Testimonial Form To display the testimonial form on your website, you can import the form component from the plugin and use it in your page. Create a new component, and import the form: ```tsx 'use client'; import { useState } from 'react'; import { TestimonialContainer, TestimonialForm, TestimonialSuccessMessage, VideoTestimonialForm, } from '@kit/testimonial/client'; export function Testimonial() { const [success, setSuccess] = useState(false); const onSuccess = () => setSuccess(true); if (success) { return ; } return ( } enableTextReview={true} enableVideoReview={true} textReviewComponent={} videoReviewComponent={} textButtonText="Write your thoughts" videoButtonText="Share a video message" backButtonText="Switch review method" /> ); } function SuccessMessage() { return (

Thank you for your feedback!

Your review has been submitted successfully.

); } function WelcomeMessage() { return (

We'd love to hear your feedback!

Your opinion helps us improve our service.

); } ``` Please customize the components as needed to fit your website's design. ## API Endpoints Please add the GET and POST endpoints to fetch the testimonials at `apps/web/app/api/testimonials/route.ts`: ```ts import { createTestimonialsRouteHandler, createVideoTestimonialRouteHandler, } from '@kit/testimonial/server'; export const GET = createTestimonialsRouteHandler; export const POST = createVideoTestimonialRouteHandler; ``` ## Widgets To display the testimonials on your website, you can use the following widget: ```tsx import { TestimonialWallWidget } from '@kit/testimonial/widgets'; export default function TestimonialWidgetPage() { return (
); } ``` Done! You now have a fully functional Testimonial Collection plugin integrated with your Makerkit application.