🛠️ Setup Instructions
Follow these steps to get the CICADA project running on your local machine:-
Clone the Repository:
Open your terminal and run:
(Replace
yourusernamewith the actual repository owner if different.) -
Install Dependencies:
Using npm, install the project dependencies:
-
Environment Variable Configuration:
- Copy the example environment file:
- Open the newly created
.envfile and update it with your Supabase project credentials:You can find these in your Supabase project settings (Project Settings > API). - The
.envfile also lists placeholders for server-side OAuth credentials (GOOGLE_CLIENT_ID,GITHUB_CLIENT_ID, etc.) andGEMINI_API_KEY. These are typically configured directly in your Supabase project settings (Authentication > Providers for OAuth, and Environment Variables for Edge Functions for Gemini API Key). Do not prefix these secret keys withVITE_as that would expose them to the client.
- Copy the example environment file:
-
Supabase Project Configuration:
-
Database Setup:
- Navigate to the SQL Editor in your Supabase dashboard (Database > SQL Editor).
- Execute the SQL scripts from the
supabase/seed/directory in the following order:Documents_table.sql(Creates document tables and RLS)Vectors_table.sql(Creates vector tables for embeddings and RLS)Logs_table.sql(Creates logs table)Document_function.sql(Creates thematch_documentsPostgreSQL function)
- This will set up the necessary tables, RLS policies, and database functions.
-
Storage Buckets:
- In your Supabase dashboard, navigate to Storage.
- Create two buckets:
private-files(Keep “Public bucket” unchecked)public-files(Check “Public bucket”)
- The RLS policies for storage access are defined in
Documents_table.sqland will be applied automatically if they don’t already exist for these bucket names.
-
Edge Functions:
- Deploy the Edge Functions located in the
supabase/functions/directory to your Supabase project. You can do this using the Supabase CLI:ReplaceYOUR_PROJECT_REFwith your actual Supabase project reference. - The key functions are:
getDashboardStats: Fetches statistics for the admin dashboard.parseUploadedDocuments: Processes uploaded documents, extracts text, generates embeddings, and AI insights using Gemini.test(renamed or should becleoChatbased on content): Handles RAG chat functionality with Gemini. Ensure this function is named appropriately in your deployment (cleoChatseems to be the intended name for the chat function).
- Important: Set the
GEMINI_API_KEYenvironment variable for these functions in your Supabase project settings (Project Settings > Edge Functions > Your Function > Environment Variables).
- Deploy the Edge Functions located in the
-
Authentication Providers (OAuth):
- In your Supabase dashboard, go to Authentication > Providers.
- Enable and configure the OAuth providers you wish to use (e.g., Google, GitHub, Facebook). You’ll need to provide the Client ID and Client Secret obtained from each provider. The redirect URI will be
https://<your-supabase-project-ref>.supabase.co/auth/v1/callback.
-
Database Setup: