Get your AI-powered social media platform up and running in minutes
Get the codebase and install dependencies
git clone https://github.com/sushiselite/auto-social.git cd auto-social npm install cp env.example .env.local
Create your Supabase project and database
-- Users table CREATE TABLE users ( id UUID REFERENCES auth.users ON DELETE CASCADE PRIMARY KEY, username TEXT, preferences JSONB DEFAULT '{}', created_at TIMESTAMP WITH TIME ZONE DEFAULT TIMEZONE('utc'::text, now()) NOT NULL ); -- Ideas table CREATE TABLE ideas ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, user_id UUID REFERENCES users(id) ON DELETE CASCADE, content TEXT, type TEXT CHECK (type IN ('text', 'voice')), audio_url TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT TIMEZONE('utc'::text, now()) NOT NULL ); -- Tweets table CREATE TABLE tweets ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, user_id UUID REFERENCES users(id) ON DELETE CASCADE, idea_id UUID REFERENCES ideas(id) ON DELETE CASCADE, content TEXT, status TEXT CHECK (status IN ('generated', 'in_review', 'approved', 'published')) DEFAULT 'generated', scheduled_time TIMESTAMP WITH TIME ZONE, performance JSONB, viral_score INTEGER, authenticity_score INTEGER, engagement_score INTEGER, quality_score INTEGER, created_at TIMESTAMP WITH TIME ZONE DEFAULT TIMEZONE('utc'::text, now()) NOT NULL ); -- Training examples table CREATE TABLE training_examples ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, user_id UUID REFERENCES users(id) ON DELETE CASCADE, tweet_text TEXT NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT TIMEZONE('utc'::text, now()) NOT NULL ); -- Tweet feedback table CREATE TABLE tweet_feedback ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, tweet_id UUID REFERENCES tweets(id) ON DELETE CASCADE, user_id UUID REFERENCES users(id) ON DELETE CASCADE, comment TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT TIMEZONE('utc'::text, now()) NOT NULL ); -- Enable Row Level Security ALTER TABLE users ENABLE ROW LEVEL SECURITY; ALTER TABLE ideas ENABLE ROW LEVEL SECURITY; ALTER TABLE tweets ENABLE ROW LEVEL SECURITY; ALTER TABLE training_examples ENABLE ROW LEVEL SECURITY; ALTER TABLE tweet_feedback ENABLE ROW LEVEL SECURITY; -- Create policies CREATE POLICY "Users can view own data" ON users FOR SELECT USING (auth.uid() = id); CREATE POLICY "Users can update own data" ON users FOR UPDATE USING (auth.uid() = id); CREATE POLICY "Users can insert own data" ON users FOR INSERT WITH CHECK (auth.uid() = id); CREATE POLICY "Users can manage own ideas" ON ideas FOR ALL USING (auth.uid() = user_id); CREATE POLICY "Users can manage own tweets" ON tweets FOR ALL USING (auth.uid() = user_id); CREATE POLICY "Users can manage own training examples" ON training_examples FOR ALL USING (auth.uid() = user_id); CREATE POLICY "Users can manage own feedback" ON tweet_feedback FOR ALL USING (auth.uid() = user_id); -- Add indexes for performance CREATE INDEX IF NOT EXISTS idx_tweets_viral_score ON tweets(viral_score); CREATE INDEX IF NOT EXISTS idx_tweets_authenticity_score ON tweets(authenticity_score); CREATE INDEX IF NOT EXISTS idx_tweets_engagement_score ON tweets(engagement_score); CREATE INDEX IF NOT EXISTS idx_tweets_quality_score ON tweets(quality_score); -- Add constraints to ensure scores are within 0-100 range ALTER TABLE tweets ADD CONSTRAINT viral_score_range CHECK (viral_score >= 0 AND viral_score <= 100); ALTER TABLE tweets ADD CONSTRAINT authenticity_score_range CHECK (authenticity_score >= 0 AND authenticity_score <= 100); ALTER TABLE tweets ADD CONSTRAINT engagement_score_range CHECK (engagement_score >= 0 AND engagement_score <= 100); ALTER TABLE tweets ADD CONSTRAINT quality_score_range CHECK (quality_score >= 0 AND quality_score <= 100); -- Function to handle user creation CREATE OR REPLACE FUNCTION public.handle_new_user() RETURNS TRIGGER AS $$ BEGIN INSERT INTO public.users (id, username, preferences, created_at) VALUES ( NEW.id, COALESCE(NEW.raw_user_meta_data->>'name', NEW.email), '{ "defaultTone": "professional", "timezone": "UTC", "notifications": true, "autoSchedule": false }'::jsonb, NOW() ); RETURN NEW; END; $$ LANGUAGE plpgsql SECURITY DEFINER; -- Trigger to call the function when a new user signs up DROP TRIGGER IF EXISTS on_auth_user_created ON auth.users; CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.handle_new_user();
Set up Claude AI for tweet generation
Note: Claude API provides excellent content generation. You'll need to add credits to your account for production use.
Set up Whisper for voice transcription
Note: Whisper API is very cost-effective for transcription. Most voice memos will cost less than $0.01 to transcribe.
Set up Twitter API for direct posting (future feature)
Optional: Twitter API credentials are not required for current functionality. This is for future direct posting features. You can skip this step and the app will work perfectly for content creation and optimization.
Add these to your .env.local file
# Supabase Configuration NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key # AI Configuration ANTHROPIC_API_KEY=your_anthropic_api_key OPENAI_API_KEY=your_openai_api_key # Twitter API Configuration (Optional - for future features) TWITTER_API_KEY=your_twitter_api_key TWITTER_API_SECRET=your_twitter_api_secret TWITTER_ACCESS_TOKEN=your_twitter_access_token TWITTER_ACCESS_TOKEN_SECRET=your_twitter_access_token_secret TWITTER_BEARER_TOKEN=your_twitter_bearer_token # App Configuration NEXTAUTH_SECRET=your_nextauth_secret NEXTAUTH_URL=http://localhost:3000
Important: Never commit your .env.local file to version control. It contains sensitive API keys that should be kept private.
.env.local
file with your actual API keysnpm run dev
to start the development serverhttp://localhost:3000
in your browser