Skip to content

NP5555/InstaFlow

Repository files navigation

InstaFlow

InstaFlow is an AI-powered Instagram management platform that helps users automate their Instagram activities using an intelligent agent. The application enables scheduling posts, analyzing engagement metrics, and leveraging AI to make data-driven decisions for Instagram content strategy.

Features

  • AI Agent Configuration: Set goals and personality for your AI agent to guide its decision-making
  • Content Scheduler: Plan and schedule Instagram posts, videos, and stories
  • Analytics Dashboard: Track follower growth, engagement metrics, and content performance
  • Action Logs: Monitor all activities performed by the AI agent
  • Secure Authentication: Login with email/password and securely store Instagram credentials

Tech Stack

  • Frontend: Next.js 14 with App Router, React, Tailwind CSS
  • Backend: Next.js API Routes
  • Database: Supabase (PostgreSQL)
  • Authentication: Supabase Auth
  • Instagram API: Instagram Private API
  • Charts: Chart.js
  • AI Decision Engine: Custom GAME framework implementation

Getting Started

Prerequisites

  • Node.js 18.x or higher
  • npm or yarn
  • Supabase account
  • Instagram account for testing

Environment Setup

  1. Clone the repository
git clone https://github.com/yourusername/instaflow.git
cd instaflow
  1. Install dependencies
npm install
  1. Create a .env.local file in the project root with the following variables:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_KEY=your-supabase-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-supabase-service-role-key

# Instagram API (for development)
INSTAGRAM_USERNAME=your-test-username
INSTAGRAM_PASSWORD=your-test-password

# Server Configuration
PORT=3000

Database Setup

  1. Create the following tables in your Supabase project:

Users Table

CREATE TABLE users (
  user_id UUID PRIMARY KEY REFERENCES auth.users(id),
  email TEXT NOT NULL,
  instagram_credentials JSONB,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

Agent Configurations Table

CREATE TABLE agent_configurations (
  config_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  user_id UUID REFERENCES users(user_id) NOT NULL,
  goals JSONB,
  personality JSONB
);

Content Schedule Table

CREATE TABLE content_schedule (
  schedule_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  user_id UUID REFERENCES users(user_id) NOT NULL,
  content_type TEXT NOT NULL,
  media_url TEXT,
  caption TEXT,
  scheduled_time TIMESTAMP WITH TIME ZONE NOT NULL
);

Action Logs Table

CREATE TABLE action_logs (
  log_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  user_id UUID REFERENCES users(user_id) NOT NULL,
  action_type TEXT NOT NULL,
  action_data JSONB,
  timestamp TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  outcome JSONB
);

Running the Application

  1. Start the development server
npm run dev
  1. Open your browser and navigate to http://localhost:3000

Project Structure

InstaFlow/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ page.jsx         # Login/Signup page
β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.jsx     # Agent configuration
β”‚   β”‚   β”œβ”€β”€ schedule/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.jsx     # Content scheduler
β”‚   β”‚   β”œβ”€β”€ analytics/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.jsx     # Analytics dashboard
β”‚   β”‚   β”œβ”€β”€ logs/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.jsx     # Action log viewer
β”‚   β”‚   β”œβ”€β”€ layout.jsx       # Dashboard layout with navigation
β”‚   β”‚   β”œβ”€β”€ page.jsx         # Dashboard home page
β”‚   β”œβ”€β”€ page.jsx             # Home page (redirects to auth or dashboard)
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ auth/[...]/route.js  # Supabase auth routes
β”‚   β”‚   β”œβ”€β”€ config/route.js      # Agent config CRUD
β”‚   β”‚   β”œβ”€β”€ schedule/route.js    # Content schedule CRUD
β”‚   β”‚   β”œβ”€β”€ actions/route.js     # Execute AI actions
β”‚   β”‚   β”œβ”€β”€ analytics/route.js   # Fetch analytics data
β”‚   β”œβ”€β”€ layout.jsx           # Root layout with Tailwind CSS
β”œβ”€β”€ components/              # Reusable React components
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ supabase.js          # Supabase client initialization
β”‚   β”œβ”€β”€ instagram.js         # Instagram API client
β”‚   β”œβ”€β”€ game.js              # Mock GAME framework
β”œβ”€β”€ public/                  # Static assets
β”œβ”€β”€ middleware.js            # Next.js middleware for auth protection
β”œβ”€β”€ package.json             # Dependencies
β”œβ”€β”€ tailwind.config.js       # Tailwind CSS configuration
β”œβ”€β”€ next.config.js           # Next.js configuration
β”œβ”€β”€ README.md                # Project documentation

Deployment

The application is designed to be deployed on Vercel:

vercel

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Instagram Private API for Instagram integration
  • Supabase for authentication and database
  • Next.js team for the amazing framework
  • Tailwind CSS for styling

About

InstaFlow is an AI-powered Instagram management platform that helps users automate their Instagram activities using an intelligent agent. The application enables scheduling posts, analyzing engagement metrics, and leveraging AI to make data-driven decisions for Instagram content strategy.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors