### Setup Fee + Metered Usage Configuration Source: https://makerkit.dev/docs/next-supabase-turbo/billing/lemon-squeezy Example configuration for a subscription with a setup fee and metered usage for 'requests'. The setup fee is charged once upon subscription creation. ```javascript { id: 'api-monthly', name: 'API Monthly', paymentType: 'recurring', interval: 'month', lineItems: [ { id: '123456', name: 'API Access', cost: 0, type: 'metered', unit: 'requests', setupFee: 10, // $10 base fee tiers: [ { upTo: 1000, cost: 0 }, { upTo: 'unlimited', cost: 0.001 }, ], }, ], } ``` -------------------------------- ### Start Supabase CLI and Local Database Source: https://makerkit.dev/docs/next-supabase-turbo/content/supabase Use these commands to start the Supabase CLI and apply database migrations. Ensure you have the latest Supabase CLI installed. ```bash pnpm --filter web supabase start pnpm --filter web supabase migration up ``` -------------------------------- ### Add and Run Setup Tasks for Registry Source: https://makerkit.dev/docs/next-supabase-turbo/api/registry-api Demonstrates how to add setup tasks to a registry and then run them. Setup tasks are idempotent and can be added multiple times. ```typescript // Add setup tasks emailRegistry.addSetup('initialize', async () => { console.log('Initializing email service...'); // Verify API keys, warm up connections, etc. }); emailRegistry.addSetup('initialize', async () => { console.log('Loading email templates...'); }); // Run all setup tasks (idempotent) await emailRegistry.setup('initialize'); await emailRegistry.setup('initialize'); // No-op, already ran ``` -------------------------------- ### Start Development Environment Source: https://makerkit.dev/docs/next-supabase-turbo/installation/common-commands Starts the Next.js development server and local Supabase instance simultaneously. ```bash pnpm run supabase:web:start && pnpm dev ``` -------------------------------- ### Start Development Services Source: https://makerkit.dev/docs/next-supabase-turbo/development/approaching-local-development Run this command to start both the Next.js application and Supabase services locally. Alternatively, you can start them individually. ```bash # Start all services (Next.js app + Supabase) pnpm dev # Or start individually pnpm --filter web dev # Next.js app (port 3000) pnpm run supabase:web:start # Local Supabase ``` -------------------------------- ### Install Roadmap Plugin Source: https://makerkit.dev/docs/next-supabase-turbo/plugins/roadmap-plugin Run this command to install the Roadmap plugin and its dependencies. The CLI will guide you through selecting the Kanban and Roadmap plugins. ```bash npx @makerkit/cli plugins add ``` -------------------------------- ### Startup Font Example Source: https://makerkit.dev/docs/next-supabase-turbo/customization/fonts Example of importing and using the DM Sans font for headings and body text. ```javascript import { DM_Sans as SansFont } from 'next/font/google'; // Headings and body: DM Sans ``` -------------------------------- ### Start Local WordPress Development Server Source: https://makerkit.dev/docs/next-supabase-turbo/content/wordpress Run the Docker Compose setup for local WordPress development or use the pnpm command from the root of the project. ```shell # From packages/cms/wordpress/ docker-compose up ``` ```shell pnpm --filter @kit/wordpress run start ``` -------------------------------- ### Install OTP Package Source: https://makerkit.dev/docs/next-supabase-turbo/api/otp-api Install the OTP package if you are not using Makerkit. ```bash pnpm add @kit/otp ``` -------------------------------- ### Start Developer Tools Source: https://makerkit.dev/docs/next-supabase-turbo/dev-tools Run this command to start the developer tools application. The tools will then be accessible via http://localhost:3010. ```bash pnpm dev ``` -------------------------------- ### Setup Fee with Metered Usage (Lemon Squeezy) Source: https://makerkit.dev/docs/next-supabase-turbo/billing/metered-usage Configures a metered product in Lemon Squeezy with a one-time setup fee. ```javascript { id: '123456', name: 'API Access', cost: 0, type: 'metered', unit: 'requests', setupFee: 49, // One-time charge on subscription creation tiers: [ { upTo: 1000, cost: 0 }, { upTo: 'unlimited', cost: 0.001 }, ], } ``` -------------------------------- ### Install and Typecheck Project Source: https://makerkit.dev/docs/next-supabase-turbo/installation/v3-migration Run these commands to install dependencies and check TypeScript types after migration. ```bash pnpm install && pnpm typecheck ``` -------------------------------- ### Install Umami Plugin Source: https://makerkit.dev/docs/next-supabase-turbo/analytics/umami-analytics-provider Install the Umami plugin using the MakerKit CLI. This command wires up the plugin automatically. ```bash npx @makerkit/cli@latest plugins add umami ``` -------------------------------- ### Start Local Supabase Source: https://makerkit.dev/docs/next-supabase-turbo/installation/common-commands Starts the local Supabase instance. Requires Docker to be running. ```bash pnpm run supabase:web:start ``` -------------------------------- ### Complete Navigation and Theme Configuration Example Source: https://makerkit.dev/docs/next-supabase-turbo/customization/layout-style A comprehensive example demonstrating different layouts for personal and team workspaces, sidebar behavior, and theme settings. This configuration is suitable for a team-focused SaaS application. ```env # Personal account: simple header navigation NEXT_PUBLIC_USER_NAVIGATION_STYLE=header # Team workspace: full sidebar with collapsed default NEXT_PUBLIC_TEAM_NAVIGATION_STYLE=sidebar NEXT_PUBLIC_TEAM_SIDEBAR_COLLAPSED=true NEXT_PUBLIC_SIDEBAR_COLLAPSIBLE_STYLE=icon NEXT_PUBLIC_ENABLE_SIDEBAR_TRIGGER=true # Theme settings NEXT_PUBLIC_DEFAULT_THEME_MODE=system NEXT_PUBLIC_ENABLE_THEME_TOGGLE=true ``` -------------------------------- ### Install SigNoz Plugin Source: https://makerkit.dev/docs/next-supabase-turbo/monitoring/signoz Install the SigNoz plugin for your project using the Makerkit CLI. ```bash npx @makerkit/cli@latest plugins add signoz ``` -------------------------------- ### Setup Initialization Groups Source: https://makerkit.dev/docs/next-supabase-turbo/api/registry-api Illustrates using different groups for setup tasks to control initialization timing. This allows for quick checks at startup and more expensive operations to be run later. ```typescript emailRegistry.addSetup('verify-credentials', async () => { // Quick check at startup }); emailRegistry.addSetup('warm-cache', async () => { // Expensive operation, run later }); // At startup await emailRegistry.setup('verify-credentials'); // Before first email await emailRegistry.setup('warm-cache'); ``` -------------------------------- ### Data Migration Example Source: https://makerkit.dev/docs/next-supabase-turbo/development/migrations Example SQL for a data migration to backfill a 'priority' column based on the 'status' column in the 'projects' table. ```sql -- Backfill priority based on status update public.projects set priority = case when status = 'active' then 1 when status = 'archived' then 0 else 0 end where priority is null; ``` -------------------------------- ### Example Environment Variables Source: https://makerkit.dev/docs/next-supabase-turbo/dev-tools/environment-variables These are example environment variables that can be added to your application. ```env NEXT_PUBLIC_ANALYTICS_ENABLED=true NEXT_PUBLIC_ANALYTICS_API_KEY=value ``` -------------------------------- ### Install Mixpanel SDK Source: https://makerkit.dev/docs/next-supabase-turbo/analytics/custom-analytics-provider Install the Mixpanel browser SDK as a dependency for the analytics package. ```bash pnpm add mixpanel-browser --filter "@kit/analytics" ``` -------------------------------- ### Start Email Preview Server Source: https://makerkit.dev/docs/next-supabase-turbo/translations/email-translations Starts the email preview server for testing translated email templates locally. Navigate to http://localhost:3001 to view previews. ```bash # Start the email preview server cd packages/email-templates pnpm dev ``` -------------------------------- ### Install Testimonials Plugin Source: https://makerkit.dev/docs/next-supabase-turbo/plugins/testimonials-plugin Run this command to install the Testimonials plugin. It automatically adds dependencies, creates translation files, and configures the admin panel. ```bash npx @makerkit/cli plugins add testimonial ``` -------------------------------- ### Add Lookup Table Example Source: https://makerkit.dev/docs/next-supabase-turbo/development/migrations Example SQL for creating a lookup table for project statuses. Use `create table if not exists` to avoid errors if the table already exists. ```sql -- Status enum as lookup table create table if not exists public.project_statuses ( id text primary key, label text not null, sort_order integer not null default 0 ); insert into public.project_statuses (id, label, sort_order) values ('active', 'Active', 1), ('archived', 'Archived', 2), ('deleted', 'Deleted', 3) on conflict (id) do nothing; ``` -------------------------------- ### Complete Billing Schema Example Source: https://makerkit.dev/docs/next-supabase-turbo/billing/billing-schema A comprehensive example demonstrating how to define multiple products with various pricing plans, including free, pro (monthly/yearly), team (per-seat), and enterprise tiers. ```typescript import { createBillingSchema } from '@kit/billing'; const provider = process.env.NEXT_PUBLIC_BILLING_PROVIDER ?? 'stripe'; export default createBillingSchema({ provider, products: [ // Free tier (custom plan, no billing) { id: 'free', name: 'Free', description: 'Get started for free', currency: 'USD', plans: [ { id: 'free', name: 'Free', paymentType: 'recurring', interval: 'month', custom: true, label: '$0', href: '/auth/sign-up', buttonLabel: 'Get Started', lineItems: [], }, ], }, // Pro tier with monthly/yearly { id: 'pro', name: 'Pro', description: 'For professionals and small teams', currency: 'USD', badge: 'Popular', highlighted: true, features: [ 'Unlimited projects', 'Priority support', 'Advanced analytics', 'Custom integrations', ], plans: [ { id: 'pro-monthly', name: 'Pro Monthly', paymentType: 'recurring', interval: 'month', trialDays: 14, lineItems: [ { id: 'price_pro_monthly', name: 'Pro Plan', cost: 29, type: 'flat', }, ], }, { id: 'pro-yearly', name: 'Pro Yearly', paymentType: 'recurring', interval: 'year', trialDays: 14, lineItems: [ { id: 'price_pro_yearly', name: 'Pro Plan', cost: 290, type: 'flat', }, ], }, ], }, // Team tier with per-seat pricing { id: 'team', name: 'Team', description: 'For growing teams', currency: 'USD', features: [ 'Everything in Pro', 'Team management', 'SSO authentication', 'Audit logs', ], plans: [ { id: 'team-monthly', name: 'Team Monthly', paymentType: 'recurring', interval: 'month', lineItems: [ { id: 'price_team_monthly', name: 'Team Seats', cost: 0, type: 'per_seat', tiers: [ { upTo: 5, cost: 0 }, { upTo: 'unlimited', cost: 15 }, ], }, ], }, ], }, // Enterprise tier { id: 'enterprise', name: 'Enterprise', description: 'For large organizations', currency: 'USD', features: [ 'Everything in Team', 'Dedicated support', 'Custom contracts', 'SLA guarantees', ], plans: [ { id: 'enterprise', name: 'Enterprise', paymentType: 'recurring', interval: 'month', custom: true, label: 'Custom', href: '/contact', buttonLabel: 'Contact Sales', lineItems: [], }, ], }, ], }); ``` -------------------------------- ### Install Docker on Ubuntu Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/vps Installs Docker CE, the command-line interface, and containerd.io. This is essential for running your application in containers. ```bash # Add Docker's official GPG key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # Set up repository echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null # Install Docker apt update apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin ``` -------------------------------- ### Install Node.js using NVM Source: https://makerkit.dev/docs/next-supabase-turbo/installation/clone-repository Install and switch to Node.js version 20.x using NVM to meet the project's requirements. ```bash nvm install 20 nvm use 20 ``` -------------------------------- ### Install Supabase CMS Plugin Source: https://makerkit.dev/docs/next-supabase-turbo/content/supabase Run this command to install the Supabase CMS plugin using the Makerkit CLI. ```bash npx @makerkit/cli plugins install ``` -------------------------------- ### SMTP Host Configuration Example (Resend) Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/supabase Example SMTP host for email delivery. Ensure this matches your chosen SMTP provider. ```text smtp.resend.com ``` -------------------------------- ### Complete Card Button Example Source: https://makerkit.dev/docs/next-supabase-turbo/components/card-button A full example demonstrating how to compose CardButton, CardButtonHeader, CardButtonTitle, CardButtonContent, and CardButtonFooter components. ```jsx import { CardButton, CardButtonTitle, CardButtonHeader, CardButtonContent, CardButtonFooter } from '@kit/ui/card-button'; function MyCardButton() { return ( console.log('Card clicked')}> Featured Item

This is a detailed description of the featured item.

Click to learn more
); } ``` -------------------------------- ### Example SQL Migration File Source: https://makerkit.dev/docs/next-supabase-turbo/development/migrations This is an example of a generated SQL migration file for creating a 'projects' table. Always review generated migrations for correctness, especially for destructive operations or missing constraints. ```sql -- Generated by Supabase CLI create table public.projects ( id uuid primary key default gen_random_uuid(), account_id uuid not null references public.accounts(id) on delete cascade, name text not null, description text, status text not null default 'active' check (status in ('active', 'archived')), created_at timestamptz not null default now(), updated_at timestamptz not null default now() ); alter table public.projects enable row level security; -- ... policies and triggers ``` -------------------------------- ### Install Package for Main App with pnpm Source: https://makerkit.dev/docs/next-supabase-turbo/troubleshooting/troubleshooting-module-not-found Install a new package specifically for the main application. Use the --filter flag to target the correct package. ```bash pnpm install my-package --filter web ``` -------------------------------- ### SMTP Port Configuration Example (Resend) Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/supabase Example SMTP port for email delivery. Ensure this matches your chosen SMTP provider. ```text 465 ``` -------------------------------- ### Install a Plugin using Makerkit CLI Source: https://makerkit.dev/docs/next-supabase-turbo/plugins/installing-plugins Use this command to add a plugin to your project. The CLI will prompt you to select which plugin to install. ```bash npx @makerkit/cli@latest plugins add ``` -------------------------------- ### Setup and Initialization Source: https://makerkit.dev/docs/next-supabase-turbo/api/account-api Import `createAccountsApi` from `@kit/accounts/api` and pass a Supabase server client. The client handles authentication automatically through RLS. ```APIDOC ## Setup and Initialization Import `createAccountsApi` from `@kit/accounts/api` and pass a Supabase server client. The client handles authentication automatically through RLS. ```javascript import { createAccountsApi } from '@kit/accounts/api'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; async function ServerComponent() { const client = getSupabaseServerClient(); const api = createAccountsApi(client); // Use API methods } ``` In Server Actions: ```javascript 'use server'; import { createAccountsApi } from '@kit/accounts/api'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; export async function myServerAction() { const client = getSupabaseServerClient(); const api = createAccountsApi(client); // Use API methods } ``` Always create the Supabase client and API instance inside your request handler, not at module scope. The client is tied to the current user's session. ``` -------------------------------- ### New API Route Example Source: https://makerkit.dev/docs/next-supabase-turbo/installation/navigating-codebase Add new API routes to `apps/web/app/api/`. This example shows a basic GET route using `enhanceRouteHandler`. ```typescript // apps/web/app/api/projects/route.ts import { enhanceRouteHandler } from '@kit/next/routes'; export const GET = enhanceRouteHandler(async ({ user }) => { // Your logic here }); ``` -------------------------------- ### Example Mixpanel Analytics Provider Implementation Source: https://makerkit.dev/docs/next-supabase-turbo/analytics/custom-analytics-provider A complete implementation of the `AnalyticsService` interface for Mixpanel. Ensure the Mixpanel SDK is installed and the environment variable `NEXT_PUBLIC_MIXPANEL_TOKEN` is set. ```typescript import { NullAnalyticsService } from './null-analytics-service'; import type { AnalyticsService } from './types'; class MixpanelService implements AnalyticsService { private mixpanel: typeof import('mixpanel-browser') | null = null; private token: string; constructor(token: string) { this.token = token; } async initialize(): Promise { if (typeof window === 'undefined') { return; } const mixpanel = await import('mixpanel-browser'); mixpanel.init(this.token, { track_pageview: false, // We handle this manually persistence: 'localStorage', }); this.mixpanel = mixpanel; } async identify(userId: string, traits?: Record): Promise { if (!this.mixpanel) return; this.mixpanel.identify(userId); if (traits) { this.mixpanel.people.set(traits); } } async trackPageView(path: string): Promise { if (!this.mixpanel) return; this.mixpanel.track('Page Viewed', { path }); } async trackEvent( eventName: string, eventProperties?: Record) : Promise { if (!this.mixpanel) return; this.mixpanel.track(eventName, eventProperties); } } export function createMixpanelService(): AnalyticsService { const token = process.env.NEXT_PUBLIC_MIXPANEL_TOKEN; if (!token) { console.warn('Mixpanel token not configured'); return new NullAnalyticsService(); } return new MixpanelService(token); } ``` -------------------------------- ### Configure Winston with OpenTelemetry for SigNoz Source: https://makerkit.dev/docs/next-supabase-turbo/monitoring/signoz Configure Winston logger with OpenTelemetry transport for SigNoz integration. This example shows basic Winston setup with timestamp and JSON format. ```typescript import winston from 'winston'; const { combine, timestamp, json } = winston.format; export const Logger = winston.createLogger({ level: process.env.LOG_LEVEL || 'info', format: combine( timestamp(), json() ), transports: [ new winston.transports.Console(), // Add OpenTelemetry transport for SigNoz ], }); ``` -------------------------------- ### Example Directory Structure of New App Source: https://makerkit.dev/docs/next-supabase-turbo/development/adding-turborepo-app Illustrates the expected directory structure for a new application created using `git subtree add`, which mirrors the `apps/web` template. ```bash apps/pdf-chat/ ├── app/ ├── components/ ├── config/ ├── lib/ ├── supabase/ ├── next.config.mjs ├── package.json └── ... ``` -------------------------------- ### Set CMS Provider in .env File Source: https://makerkit.dev/docs/next-supabase-turbo/content/cms Configure the CMS provider by setting the CMS_CLIENT environment variable in your .env file. This is part of the quick start setup for switching providers. ```dotenv # .env CMS_CLIENT=keystatic ``` -------------------------------- ### Gemini Configuration Example Source: https://makerkit.dev/docs/next-supabase-turbo/installation/ai-agents This file points to AGENTS.md files and outlines checks for agent instructions. ```markdown # .gemini/GEMINI.md - Check for the presence of AGENTS.md files in the project workspace - There may be additional AGENTS.md in sub-folders with additional specific instructions ``` -------------------------------- ### Data Table with ServerDataLoader Source: https://makerkit.dev/docs/next-supabase-turbo/components/data-table Shows how to integrate the DataTable component with ServerDataLoader for server-side data fetching and pagination. This example requires Supabase client setup and data loader configurations. ```javascript import { ServerDataLoader } from '@makerkit/data-loader-supabase-nextjs'; import { DataTable } from '@kit/ui/enhanced-data-table'; import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client'; function AccountsPage({ searchParams }) { const client = getSupabaseServerAdminClient(); const page = searchParams.page ? parseInt(searchParams.page) : 1; const filters = getFilters(searchParams); return ( {({ data, page, pageSize, pageCount }) => ( )} ); } ``` -------------------------------- ### Start Stripe Webhook Listener Source: https://makerkit.dev/docs/next-supabase-turbo/installation/running-project Forwards Stripe webhooks to your local development server, essential for testing subscription billing functionality. Requires the Stripe CLI to be installed and authenticated. ```bash pnpm run stripe:listen ``` -------------------------------- ### Stripe CLI Listen for Webhooks with Docker Source: https://makerkit.dev/docs/next-supabase-turbo/billing/stripe Start listening for Stripe webhook events and forwarding them to your local development server using Docker. Ensure the forward-to address matches your local server setup. ```bash pnpm run stripe:listen ``` ```bash docker run --rm -it --name=stripe \ -v ~/.config/stripe:/root/.config/stripe \ stripe/stripe-cli:latest listen \ --forward-to http://host.docker.internal:3000/api/billing/webhook ``` -------------------------------- ### Clone and Build Application on VPS Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/vps Clones your repository, installs dependencies, generates a Dockerfile, builds the Docker image, and runs the container. Requires sufficient VPS resources. ```bash # Create Personal Access Token on GitHub with repo access # Clone repository git clone https://@github.com/YOUR_USERNAME/your-repo.git cd your-repo # Install dependencies pnpm install # Generate Dockerfile pnpm run turbo gen docker # Create env file cp turbo/generators/templates/env/.env.local apps/web/.env.production.local nano apps/web/.env.production.local # Edit with your production values # Build Docker image docker build -t myapp:latest . # Run container docker run -d \ -p 3000:3000 \ --env-file apps/web/.env.production.local \ --name myapp \ --restart unless-stopped \ myapp:latest ``` -------------------------------- ### Premium Font Example Source: https://makerkit.dev/docs/next-supabase-turbo/customization/fonts Example of importing the Outfit font for headings and body text. ```javascript import { Outfit as SansFont } from 'next/font/google'; // Headings and body: Outfit ``` -------------------------------- ### Deploy Pre-Built Docker Image Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/vps Pulls a pre-built Docker image from a registry (like GHCR), creates an environment file, and runs the container. Recommended for most use cases. ```bash # Login to registry docker login ghcr.io # Pull your image docker pull ghcr.io/YOUR_USERNAME/myapp:latest # Create env file nano .env.production.local # Paste your environment variables # Run container docker run -d \ -p 3000:3000 \ --env-file .env.production.local \ --name myapp \ --restart unless-stopped \ ghcr.io/YOUR_USERNAME/myapp:latest ``` -------------------------------- ### GradientText Component Example Source: https://makerkit.dev/docs/next-supabase-turbo/components/marketing-components Example of using the GradientText component to apply a gradient to text. ```jsx function GradientTextExample() { return (

Unleash your creativity and build your SaaS faster than ever with Makerkit.

); } ``` -------------------------------- ### GradientSecondaryText Component Example Source: https://makerkit.dev/docs/next-supabase-turbo/components/marketing-components Example of using the GradientSecondaryText component to apply a gradient to text. ```jsx function GradientSecondaryTextExample() { return (

Unleash your creativity and build your SaaS faster than ever with Makerkit.

); } ``` -------------------------------- ### Quick Font Loading Check Source: https://makerkit.dev/docs/next-supabase-turbo/customization/fonts Command to start the development server and instructions to verify font loading in browser DevTools. ```bash # Quick check for font loading pnpm dev # Open DevTools > Network > Filter: Font # Verify your custom font files are loading ``` -------------------------------- ### Start Developer Tools and Check Production Mode Source: https://makerkit.dev/docs/next-supabase-turbo/dev-tools Run the developer tools in development mode and access the production preview to check variables. Ensure to resolve any warnings or errors displayed. ```bash # Start dev tools pnpm dev # Check Production mode at http://localhost:3010/variables # Resolve any warnings or errors ``` -------------------------------- ### EMAIL_SENDER Format Examples Source: https://makerkit.dev/docs/next-supabase-turbo/emails/email-configuration Examples of how to format the EMAIL_SENDER environment variable. The recommended format includes a display name. ```env # With display name (recommended) EMAIL_SENDER=YourApp # Email only EMAIL_SENDER=hello@yourapp.com ``` -------------------------------- ### Technical Font Example Source: https://makerkit.dev/docs/next-supabase-turbo/customization/fonts Example of importing IBM Plex Sans for body and IBM Plex Mono for code. ```javascript import { IBM_Plex_Sans as SansFont, IBM_Plex_Mono as MonoFont } from 'next/font/google'; // Body: IBM Plex Sans // Code: IBM Plex Mono ``` -------------------------------- ### Install Certbot for SSL Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/vps Install Certbot and its Nginx plugin to automate the process of obtaining and renewing SSL certificates. ```bash apt install -y certbot python3-certbot-nginx ``` -------------------------------- ### Install Paddle Plugin Source: https://makerkit.dev/docs/next-supabase-turbo/billing/paddle Fetch the Paddle plugin from the plugins repository using the Makerkit CLI. ```bash npx @makerkit/cli@latest plugins install ``` -------------------------------- ### Start Supabase and Check Inbucket Source: https://makerkit.dev/docs/next-supabase-turbo/translations/email-translations Instructions for testing email translations with Inbucket when running Supabase locally. Emails are captured by Inbucket for review. ```bash 1. Start Supabase: `pnpm supabase:web:start` 2. Open Inbucket: `http://localhost:54324` 3. Trigger an action that sends an email 4. Check Inbucket for the translated email ``` -------------------------------- ### Install Nginx Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/vps Installs Nginx, a high-performance web server and reverse proxy, which will be used to route traffic to your application. ```bash apt install -y nginx ``` -------------------------------- ### Enable Nginx Site and Restart Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/vps Enable your Nginx site configuration by creating a symbolic link, remove the default site, test the configuration, and restart Nginx to apply changes. ```bash # Create symlink ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/ # Remove default site rm /etc/nginx/sites-enabled/default # Test configuration nginx -t # Restart Nginx systemctl restart nginx ``` -------------------------------- ### Start Development Server Source: https://makerkit.dev/docs/next-supabase-turbo/development/database-webhooks Run your Next.js development server using pnpm. This command is typically used during local webhook testing. ```bash pnpm run dev ``` -------------------------------- ### SSH into your VPS Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/vps Connect to your newly provisioned server using SSH. Ensure you have your server's IP address and root access. ```bash ssh root@your-server-ip ``` -------------------------------- ### Basic Application Configuration (.env) Source: https://makerkit.dev/docs/next-supabase-turbo/configuration/application-configuration Set essential application configuration variables in your .env file for basic setup. These include site URL, product name, titles, descriptions, locale, theme mode, and theme colors. ```env NEXT_PUBLIC_SITE_URL=https://myapp.com NEXT_PUBLIC_PRODUCT_NAME="My SaaS App" NEXT_PUBLIC_SITE_TITLE="My SaaS App - Build Faster" NEXT_PUBLIC_SITE_DESCRIPTION="The easiest way to build your SaaS application" NEXT_PUBLIC_DEFAULT_LOCALE=en NEXT_PUBLIC_DEFAULT_THEME_MODE=light NEXT_PUBLIC_THEME_COLOR="#ffffff" NEXT_PUBLIC_THEME_COLOR_DARK="#0a0a0a" ``` -------------------------------- ### Complete Supabase Test Example Source: https://makerkit.dev/docs/next-supabase-turbo/development/database-tests This comprehensive example demonstrates setting up test users, creating a team, adding members with RLS bypass, and verifying RLS enforcement for different user roles. It highlights key principles for secure database testing. ```sql begin; create extension "basejump-supabase_test_helpers" version '0.0.6'; select no_plan(); -- Setup test users select makerkit.set_identifier('owner', 'owner@example.com'); select makerkit.set_identifier('member', 'member@example.com'); select makerkit.set_identifier('stranger', 'stranger@example.com'); -- Create team (as owner) select makerkit.authenticate_as('owner'); select public.create_team_account('TestTeam'); -- Add member using postgres role (bypasses RLS) set local role postgres; insert into accounts_memberships (account_id, user_id, account_role) values ( (select id from accounts where slug = 'testteam'), tests.get_supabase_uid('member'), 'member' ); -- Test member access (RLS enforced) select makerkit.authenticate_as('member'); select isnt_empty( $$ select * from accounts where slug = 'testteam' $$, 'Member can see their team' ); -- Test stranger cannot see team (RLS enforced) select makerkit.authenticate_as('stranger'); select is_empty( $$ select * from accounts where slug = 'testteam' $$, 'Stranger cannot see team due to RLS' ); -- Verify team actually exists (bypass RLS) set local role postgres; select isnt_empty( $$ select * from accounts where slug = 'testteam' $$, 'Team exists in database (confirms RLS is working, not missing data)' ); select * from finish(); rollback; ``` -------------------------------- ### Add Junction Table Example Source: https://makerkit.dev/docs/next-supabase-turbo/development/migrations Example SQL for creating a junction table to manage a many-to-many relationship between projects and users. ```sql -- Many-to-many relationship create table if not exists public.project_members ( project_id uuid not null references public.projects(id) on delete cascade, user_id uuid not null references auth.users(id) on delete cascade, role text not null default 'member', created_at timestamptz not null default now(), primary key (project_id, user_id) ); ``` -------------------------------- ### Example Redirect Response Source: https://makerkit.dev/docs/next-supabase-turbo/development/external-marketing-website This is an example of a successful 301 redirect response, indicating the client should permanently move to the new URL. ```http HTTP/1.1 301 Moved Permanently Location: https://your-marketing-site.com/pricing ``` -------------------------------- ### Install Basejump Test Helpers Extension Source: https://makerkit.dev/docs/next-supabase-turbo/development/database-tests Installs the necessary extension for simulating authentication and managing users in database tests. ```sql create extension "basejump-supabase_test_helpers" version '0.0.6'; ``` -------------------------------- ### Install PostHog Plugin Source: https://makerkit.dev/docs/next-supabase-turbo/analytics/posthog-analytics-provider Install the PostHog plugin using the MakerKit CLI. This command automatically wires up the plugin in your project. ```bash npx @makerkit/cli@latest plugins add posthog ``` -------------------------------- ### Create Comments GET Route Handler Source: https://makerkit.dev/docs/next-supabase-turbo/plugins/roadmap-plugin Set up the GET route handler for comments using the `createFetchCommentsRouteHandler` from the Roadmap plugin. ```typescript import { createFetchCommentsRouteHandler } from '@kit/roadmap/route-handler'; export const GET = createFetchCommentsRouteHandler; ``` -------------------------------- ### Verify New Application Structure Source: https://makerkit.dev/docs/next-supabase-turbo/development/adding-turborepo-app Lists the contents of the newly created application directory to verify it has the same structure as the original `apps/web` folder. ```bash ls apps/pdf-chat ``` -------------------------------- ### SMTP Username Configuration Example (Resend) Source: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/supabase Example SMTP username for email delivery. Ensure this matches your chosen SMTP provider. ```text resend ``` -------------------------------- ### Basic Server Action Example Source: https://makerkit.dev/docs/next-supabase-turbo/data-fetching/server-actions A fundamental Server Action demonstrating direct Supabase interaction for creating a task. Lacks built-in validation and authentication. ```typescript 'use server'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; export async function createTask(formData: FormData) { const supabase = getSupabaseServerClient(); const title = formData.get('title') as string; const { error } = await supabase.from('tasks').insert({ title }); if (error) { return { success: false, error: error.message }; } return { success: true }; } ``` -------------------------------- ### Add Components with Shadcn CLI Source: https://makerkit.dev/docs/next-supabase-turbo/customization/shadcn-cli Run this command from the 'packages/ui' directory to add components via the Shadcn CLI. ```bash cd packages/ui pnpm exec shadcn add ``` -------------------------------- ### Registry API Usage Example Source: https://makerkit.dev/docs/next-supabase-turbo/api/registry-api Illustrates how environment variables map to specific registry implementations for services like billing, mailers, and CMS. ```text Environment Variable Registry Your Code ───────────────────── ──────── ───────── BILLING_PROVIDER=stripe → billingRegistry → getBillingGateway() MAILER_PROVIDER=resend → mailerRegistry → getMailer() CMS_PROVIDER=keystatic → cmsRegistry → getCmsClient() ``` -------------------------------- ### Example Package Structure Source: https://makerkit.dev/docs/next-supabase-turbo/development/adding-turborepo-package Illustrates a typical file structure for a new feature package, including source files, components, hooks, server modules, and the `package.json`. ```treeview packages/@kit/notifications/ ├── src/ │ ├── index.ts │ ├── client.ts │ ├── server.ts │ ├── components/ │ │ └── notification-bell.tsx │ ├── hooks/ │ │ └── use-notifications.ts │ └── server/ │ └── send-notification.ts └── package.json ``` -------------------------------- ### Get Billing Service Instance Source: https://makerkit.dev/docs/next-supabase-turbo/billing/billing-api Instantiate the billing gateway service. You can get the service for the configured provider or specify a provider explicitly. ```typescript import { createBillingGatewayService } from '@kit/billing-gateway'; // Get service for the configured provider const service = createBillingGatewayService( process.env.NEXT_PUBLIC_BILLING_PROVIDER ); // Or specify a provider explicitly const stripeService = createBillingGatewayService('stripe'); ``` -------------------------------- ### Account API Setup Source: https://makerkit.dev/docs/next-supabase-turbo/api Instantiate the Account API client using the Supabase server client. ```typescript import { createAccountsApi } from '@kit/accounts/api'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; const client = getSupabaseServerClient(); const api = createAccountsApi(client); ```