Giter VIP home page Giter VIP logo

29_ai-companion's Introduction

[23-store-overview](video here)

Project info

Stack - Next 14 + TypeScript + Tailwind + Supabase + Stripe + MYSQL




Clone repository

Step 1.1 - clone repository (variant 1)

alt text

or Step 1.1 - clone repository (variant 2)

git clone https://github.com/nicitaacom/29_ai-companion/

Step 1.2 - install deps

pnpm i



Step 2 - setup .env

2.1 - supabase

Login in supabase - https://app.supabase.com/sign-in Login in supabase

2.2 - supabase

Click new project

2.3 - supabase

Set up supabase project

2.4 - supabase

Copy .env

2.5 - supabase

Paste .env

2.6 - supabase setup

1. category
create table
  public.category (
    id uuid not null default uuid_generate_v4 (),
    name character varying(255) not null,
    constraint category_pkey primary key (id)
  ) tablespace pg_default;
2. companion
create table
  public.companion (
    id uuid not null default uuid_generate_v4 (),
    user_id uuid not null default gen_random_uuid (),
    username character varying(255) not null,
    src character varying(255) not null,
    name text not null,
    description text not null,
    instructions text not null,
    seed text not null,
    created_at timestamp with time zone not null default timezone ('UTC'::text, now()),
    updated_at timestamp with time zone not null default timezone ('UTC'::text, now()),
    category_id uuid not null,
    constraint companion_pkey primary key (id),
    constraint companion_category_id_fkey foreign key (category_id) references category (id) on update cascade on delete cascade,
    constraint public_companion_user_id_fkey foreign key (user_id) references auth.users (id) on update cascade on delete cascade
  ) tablespace pg_default;

allow select for authenticated user

Target role - authenticated

true

allow to delete their own companions

(user_id = auth.uid())
3. messages
create table
  public.messages (
    id uuid not null default uuid_generate_v4 (),
    role public.role not null,
    content text not null,
    created_at timestamp with time zone not null default timezone ('UTC'::text, now()),
    updated_at timestamp with time zone not null default timezone ('UTC'::text, now()),
    companion_id uuid not null,
    user_id character varying(255) not null,
    constraint message_pkey primary key (id)
  ) tablespace pg_default;

allow insert for authenticated users

Target role - authenticated

true

allow select for authenticated users

Target role - authenticated

true
4. user_subscription
create table
  public.user_subscription (
    id uuid not null default uuid_generate_v4 (),
    user_id character varying(255) not null,
    stripe_customer_id character varying(255) null,
    stripe_subscription_id character varying(255) null,
    stripe_price_id character varying(255) null,
    stripe_current_period_end timestamp with time zone null,
    constraint usersubscription_pkey primary key (id),
    constraint usersubscription_stripecustomerid_key unique (stripe_customer_id),
    constraint usersubscription_stripesubscriptionid_key unique (stripe_subscription_id),
    constraint usersubscription_userid_key unique (user_id)
  ) tablespace pg_default;
4. user_subscription
create table
  public.users (
    id uuid not null,
    created_at timestamp with time zone not null default now(),
    email text not null,
    avatar_url text null,
    providers text[] not null default '{}'::text[],
    role text[] not null default '{USER}'::text[],
    constraint users_duplicate_pkey primary key (id),
    constraint users_id_fkey foreign key (id) references auth.users (id) on update cascade on delete cascade
  ) tablespace pg_default;

allow select user based on user id

(id = auth.uid())

allow updated user based on user id

(id = auth.uid())

2.7 - NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME

https://youtu.be/PGPGcKBpAk8?t=17601

2.8 - PINECONE + UPSTASH + OPENAI

https://youtu.be/PjYWpd7xkaM?t=15618

Note that PINECONE_ENVIRONMENT='gcp-starter' for 02.2024 for free plan on GCP

2.9 - REPLICATE_API_TOKEN

https://youtu.be/PjYWpd7xkaM?t=17350

2.11 - STRIPE_API_KEY

https://youtu.be/PjYWpd7xkaM?t=18978

2.11 - STRIPE_WEBHOOK_SECRET

https://youtu.be/PjYWpd7xkaM?t=20218

29_ai-companion's People

Contributors

nicitaacom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.