Content Writer

AI Content Writer Tool

Introduction

Content generation tool designed to assist users in creating high-quality social media posts, blog entries, and other content types efficiently. Utilizing advanced AI models, the platform offers a variety of customization options to match the user's style and preferences.

AI Content Writer Tool

Quickstart Guide

Installation

  1. Clone the repository:
terminal
git clone https://github.com/1811-Labs-LLC/BuilderKit-Starter.git [YOUR_APP_NAME]
 
cd [YOUR_APP_NAME]
 
git checkout content-writer

Remove the origin remote to ensure that you can work locally without pushing the changes back to the original repository.

terminal
git remote remove origin

However, note that after removing the remote, you won't be able to switch between the branches, so you'll need to clone the repository again if you want to work on another branch.

  1. Install dependencies:

    terminal
    npm install
  2. Environment Variables:

    Copy the required variables from .env.example to .env.local as mentioned and update the values.

    terminal
    cp .env.example .env.local

    Or, manually create a .env.local file in the root directory with the following env variables (make sure to update the values with your actual keys):

    .env.local
    # Host
    NEXT_PUBLIC_APP_URL=<your-app-url>
     
    # Supabase
    NEXT_PUBLIC_SUPABASE_URL=<your-supabase-url>
    NEXT_PUBLIC_SUPABASE_ANON_KEY=<your-supabase-anon-key>
     
    # OpenAI
    OPENAI_API_KEY=<your-openai-api-key>
     
    # Google Analytics
    NEXT_PUBLIC_GOOGLE_ANALYTICS_KEY=<your-google-analytics-key>

Setup Supabase

If you have not setup the supabase yet, go through the detailed documentation to set up the supabase for BuilderKit.ai. Make sure that you are creating the user table as mentioned in the supabase setup doc as it is required for the tool.

  1. Create Content Writer Table in Supabase:

    sql
    -- Create a table for AI Content Creation
    create table content_creations (
       id uuid not null default uuid_generate_v4(),
       created_at timestamp with time zone not null default now(),
       user_id uuid null,
       topic text not null,
       style text not null,
       word_limit text not null,
       voice text not null,
       results text not null,
       constraint content_creations_pkey primary key (id),
       constraint content_creations_user_id_fkey foreign key (user_id) references users (id)
    );
     
    -- Set up Row Level Security (RLS)
    alter table content_creations
    enable row level security;
     
    create policy "Users can insert their own row." on content_creations
       for insert with check (true);
     
    create policy "Users can update own row" on content_creations
       for update using (auth.uid() = user_id);
     
    create policy "Users can read own row" on content_creations
       for select using (auth.uid() = user_id);
     
    create policy "Users can delete own row" on content_creations
       for delete using (auth.uid() = user_id);

    For all the tables, we enable the RLS policy by default with necessary permissions as mentioned in the script.

  2. Sync Supabase Types:

    To sync the supabase table schema with your project follow the steps here.

Running the Application

  1. Run the development server:

    terminal
    npm run dev

    This will start the development server on http://localhost:3000 (opens in a new tab).

  2. Build for production:

    terminal
    npm run build

    This command compiles the application for production usage.

  3. Start the production server:

    terminal
    npm start

    This will start the application in production mode.

Additional Scripts

  • Prepare Husky for Git hooks:

    terminal
    npm run prepare
  • Validate the code with Linting, Formatting & Typecheck:

    terminal
    npm run validate

Make the tool publicly accessible by removing the login process

  1. Go to src/app/(dashboard)/layout.tsx and comment the following section from line:15 to line:20 as shown in the image below:

    Remove Layout Login Check
  2. Also, go to src/app/api/generate/route.tsx and comment the following section from line:12 to line:17 as shown in the image below:

    Remove Api Login Check

These sections reads the user data and checks if the user is signed in or not. By commenting this section it does not check the user validation.

Requirements