X4RCE is a powerful AI workforce management platform that helps you create and manage specialized teams of AI agents. These agents collaborate to accomplish your tasks and projects efficiently.
- AI Team Creation: Generate specialized AI teams based on your project needs
- Task Management: Create and assign tasks to your AI team
- Team Chat: Communicate directly with your AI team
- Collaborative Workflow: AI agents work together in a defined sequence
- Subscription Tiers: Free trial, Starter, and Pro plans with different resource limits
- Admin Dashboard: Comprehensive admin tools for user and system management
- Getting Started
- Project Structure
- Key Components
- Database Schema
- API Integration
- Deployment
- Admin Configuration
- Contributing
- License
- Node.js (v18 or higher)
- npm (v8 or higher)
- Supabase account
- OpenAI API key (for AI agent functionality)
- Google Gemini API key (optional, for alternative AI provider)
- Stripe account (for subscription management)
-
Clone the repository:
git clone https://github.com/heyimsteve/x4rce.git cd x4rce
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
Create a .env
file in the root directory with the following variables:
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
VITE_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
VITE_STRIPE_SECRET_KEY=your_stripe_secret_key
x4rce/
βββ public/ # Static assets
βββ src/
β βββ components/ # Shared UI components
β βββ features/ # Feature-based modules
β β βββ admin/ # Admin dashboard
β β βββ agents/ # AI agent management
β β βββ auth/ # Authentication
β β βββ plans/ # Subscription plans
β β βββ settings/ # User settings
β β βββ shared/ # Shared components
β β βββ support/ # Support ticket system
β β βββ tasks/ # Task management
β β βββ workforces/ # Project management
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utility libraries
β βββ services/ # Service layer
β β βββ agent/ # Agent collaboration services
β β βββ llm/ # Language model services
β βββ store/ # Redux store
β βββ styles/ # Global styles
β βββ types/ # TypeScript type definitions
β βββ App.tsx # Main application component
β βββ main.tsx # Application entry point
βββ supabase/
β βββ functions/ # Supabase Edge Functions
β βββ migrations/ # Database migrations
βββ .env # Environment variables
βββ package.json # Project dependencies
βββ tailwind.config.js # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
The platform uses Supabase Authentication for user management. Features include:
- Email/password sign-up and sign-in
- Profile management
- Session handling
// Example usage of authentication
import { useAuth } from './features/auth/hooks/useAuth';
const { user, signIn, signUp, signOut } = useAuth();
Workforces are the main organizational unit, representing projects with specific goals:
- Create and manage projects
- Generate AI team workflows
- View project analytics
// Example of creating a workforce
const { createWorkforce } = useCreateWorkforce();
const workforce = await createWorkforce('Project Name', 'Project Description');
AI agents are specialized team members with specific roles:
- Create agents with defined roles and responsibilities
- Customize agent behavior
- Manage agent execution order
// Example of creating an agent
const { createAgent } = useCreateAgent();
const success = await createAgent({
name: 'Agent Name',
position: 'Research Analyst',
role: 'You are a research analyst responsible for...',
responsibilities: 'Conduct research, analyze data...',
provider: 'openai',
workforceId: 'workforce-id',
status: 'active'
});
Tasks are assignments for your AI team:
- Create tasks with detailed descriptions
- Execute tasks to trigger AI agent collaboration
- View task results and agent contributions
// Example of creating a task
const { createTask } = useCreateTask();
const success = await createTask({
title: 'Task Title',
description: 'Detailed task description...',
workforceId: 'workforce-id',
status: 'pending'
});
Communicate directly with your AI team:
- Ask questions to your AI team
- Get responses from the most appropriate agent
- Clear chat history as needed
// Example of sending a message
const { sendMessage } = useTeamChat(workforceId);
await sendMessage('Can you help me with...');
Manage user subscriptions and resource limits:
- Free trial, Starter, and Pro plans
- Usage tracking for workforces, agents, and tasks
- ReUp packages for additional resources
// Example of checking subscription
const { subscription, usageLimits } = useSubscription();
Built-in support ticket system:
- Create and manage support tickets
- Attach files to tickets
- Track ticket status
// Example of creating a support ticket
const { createTicket } = useCreateTicket();
const success = await createTicket({
subject: 'Ticket Subject',
description: 'Detailed description...',
priority: 'normal',
files: []
});
Comprehensive admin tools (for admin users only):
- User management
- Subscription management
- Global API key configuration
- Usage limits configuration
// Example of admin function
const { updateUserSubscription } = useUserDetails(userId);
await updateUserSubscription('pro');
The application uses Supabase as its database with the following main tables:
workforces
: Projects containing AI teamsagents
: AI team members with specific rolestasks
: Assignments for AI teamstask_messages
: Messages from AI agents during task executionworkforce_chat
: Team chat messagessubscriptions
: User subscription informationusage_limits
: Resource limits and usage trackingsupport_tickets
: Support ticket systemticket_responses
: Responses to support ticketsadmin_settings
: Global admin configuration
The platform integrates with several external APIs:
Used for generating AI agent responses and images.
// Example of OpenAI integration
const openai = new OpenAIService();
await openai.initialize();
const response = await openai.generateResponse(prompt);
Alternative AI provider for agent responses.
// Example of Gemini integration
const gemini = new GeminiService();
await gemini.initialize();
const response = await gemini.generateResponse(prompt);
Handles subscription payments and billing.
// Example of Stripe integration
const { redirectToCheckout } = useStripeCheckout();
await redirectToCheckout(tier, customerId);
The project is configured for deployment on Netlify:
- Connect your GitHub repository to Netlify
- Set up the required environment variables
- Configure the build settings:
- Build command:
npm run build
- Publish directory:
dist
- Build command:
The netlify.toml
file in the repository handles the configuration automatically.
The admin email is hardcoded in two locations in the codebase. To change the admin email, you need to modify both files:
-
In
src/App.tsx
:// Find this line: const isAdmin = user?.email === 'heyimsteve.com@gmail.com'; // Change it to your admin email: const isAdmin = user?.email === 'your-admin-email@example.com';
-
In
src/components/Sidebar.tsx
:// Find this line: const isAdmin = user?.email === 'heyimsteve.com@gmail.com'; // Change it to your admin email: const isAdmin = user?.email === 'your-admin-email@example.com';
-
In Supabase database functions:
You'll need to update the admin email check in several database functions. The easiest way to do this is to create a new migration file in the
supabase/migrations
directory with the following content:-- Create function to update admin email in all functions CREATE OR REPLACE FUNCTION update_admin_email( old_email text, new_email text ) RETURNS void LANGUAGE plpgsql AS $$ DECLARE func_name text; func_def text; updated_def text; BEGIN -- Loop through all functions that check for admin email FOR func_name, func_def IN SELECT p.proname, pg_get_functiondef(p.oid) FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid WHERE n.nspname = 'public' AND pg_get_functiondef(p.oid) LIKE '%' || old_email || '%' LOOP -- Replace old email with new email updated_def := replace(func_def, old_email, new_email); -- Execute the updated function definition EXECUTE updated_def; END LOOP; END; $$;
Then run this function through the Supabase SQL editor:
SELECT update_admin_email('heyimsteve.com@gmail.com', 'your-admin-email@example.com');
After making these changes, the new email will have admin privileges throughout the application.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.