Skip to content

IMPHNEN/taskflow-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TaskFlow Backend

An AI-Driven Project Management Platform for Solo Entrepreneurs and Small Teams

TaskFlow is a comprehensive project management API that leverages artificial intelligence to streamline project planning, execution, and validation. The platform automates complex workflows including project scope generation, repository setup, visual mockup creation, market validation, and advanced analytics - empowering users to transform ideas into successful projects with unprecedented efficiency.


πŸš€ Project Purpose

TaskFlow addresses the challenges faced by solo entrepreneurs and small teams in managing complex projects by providing:

  • Intelligent Project Planning: AI-powered generation of Business Requirements Documents (BRD) and Product Requirements Documents (PRD)
  • Automated Repository Management: Seamless GitHub integration with automated issue creation and milestone tracking
  • Market Intelligence: Multi-agent market validation system with competitor analysis and opportunity assessment
  • Visual Prototyping: Automated mockup generation using Lovable AI for rapid visualization
  • Smart Task Management: AI-driven task breakdown and prioritization
  • Advanced Analytics: Comprehensive project insights and performance metrics

πŸ€– AI Features Overview

Core AI Services

Service Purpose AI Models Supported Key Features
BRD Generator Business Requirements Documents OpenAI, Groq, Gemini, Mistral Automated business analysis, stakeholder identification, requirement extraction
PRD Generator Product Requirements Documents OpenAI, Groq, Gemini, Mistral Feature specification, technical requirements, user story generation
Task Generator Intelligent Task Creation OpenAI, Groq, Gemini, Mistral Task breakdown, dependency mapping, effort estimation
Market Validation Multi-Agent Market Analysis OpenAI, Gemini, Groq Competitor research, market sizing, opportunity analysis
GitHub Setup Repository Automation OpenAI, Groq, Gemini, Mistral Automated repo creation, issue generation, milestone planning
Preview Generator Visual Mockup Creation Lovable AI via OpenRouter Website mockups, UI prototyping, design automation

AI Agent Architecture

  • Multi-Model Support: Flexible AI provider configuration (OpenAI, Groq, Google Gemini, Mistral)
  • Memory Management: Persistent context storage using Mem0ai for enhanced AI interactions
  • Multi-Agent Teams: Specialized agents for market research, analysis, and reporting
  • Tool Integration: Tavily for web research, Firecrawl for content extraction, GitHub API for automation

πŸ“‹ Prerequisites & Configuration

System Requirements

  • Python: 3.11 or higher
  • Database: PostgreSQL (via Supabase)
  • Memory: 4GB RAM minimum, 8GB recommended
  • Storage: 2GB available space

Required API Keys

Service Required For How to Obtain
Supabase Database & Authentication supabase.com
OpenAI GPT models platform.openai.com
Groq Fast inference models console.groq.com
Google AI Gemini models ai.google.dev
Mistral Mistral models console.mistral.ai
OpenRouter Preview generation openrouter.ai
Tavily Market research tavily.com
Firecrawl Content extraction firecrawl.dev
Lovable UI mockup generation Contact Lovable for access

πŸ› οΈ Installation & Development Workflow

Quick Start

# Clone the repository
git clone https://github.com/your-org/taskflow-backend.git
cd taskflow-backend

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env with your API keys and configuration

# Run the application
python run.py

Docker Setup

# Build the Docker image
docker build -t taskflow-backend .

# Run with environment file
docker run -p 8000:8000 --env-file .env taskflow-backend

# Or run with docker-compose (if available)
docker-compose up --build

Development Setup

# Install development dependencies
pip install -r requirements.txt

# Set up pre-commit hooks (optional)
pre-commit install

# Run in development mode
uvicorn app.main:app --host 0.0.0.0 --port 8000

# Access the API documentation
# http://localhost:8000/api/docs (Swagger UI)
# http://localhost:8000/api/redoc (ReDoc)

Environment Configuration

Create a .env file based on .env.example:

# Core Services
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your_supabase_anon_key
FRONTEND_URL=http://localhost:3000

# AI Model Configuration
DEFAULT_MODEL_TYPE=groq
DEFAULT_MODEL_ID=llama-3.3-70b-versatile

# API Keys
GROQ_API_KEY=your_groq_key
OPENAI_API_KEY=your_openai_key
GOOGLE_API_KEY=your_google_key
MISTRAL_API_KEY=your_mistral_key
OPENROUTER_API_KEY=your_openrouter_key
TAVILY_API_KEY=your_tavily_key
FIRECRAWL_API_KEY=your_firecrawl_key

# Service Settings
ENABLE_DEBUG_MODE=False
ENABLE_MARKDOWN=True
RESULTS_DIR=results

πŸ“ Detailed Folder Structure

taskflow-backend/
β”œβ”€β”€ πŸ“„ API_DOCUMENTATION.md         # Comprehensive API reference
β”œβ”€β”€ 🐳 Dockerfile                   # Container configuration
β”œβ”€β”€ πŸ“„ requirements.txt             # Python dependencies
β”œβ”€β”€ πŸš€ run.py                       # Application entry point
β”œβ”€β”€ βš™οΈ pyproject.toml               # Project configuration
└── πŸ“¦ app/                         # Main application code
    β”œβ”€β”€ 🎯 main.py                  # FastAPI application setup
    β”œβ”€β”€ βš™οΈ config.py                # Configuration and service initialization
    β”œβ”€β”€ πŸ”’ middleware/              # Authentication and request middleware
    β”‚   └── auth.py                 # JWT authentication logic
    β”œβ”€β”€ πŸ“Š models/                  # Pydantic data models
    β”‚   β”œβ”€β”€ user.py                 # User and authentication models
    β”‚   β”œβ”€β”€ project.py              # Project management models
    β”‚   β”œβ”€β”€ task.py                 # Task and workflow models
    β”‚   β”œβ”€β”€ brd.py                  # Business Requirements models
    β”‚   β”œβ”€β”€ prd.py                  # Product Requirements models
    β”‚   β”œβ”€β”€ market_research.py      # Market validation models
    β”‚   β”œβ”€β”€ github_setup.py         # Repository automation models
    β”‚   └── mockup.py               # Preview generation models
    β”œβ”€β”€ πŸ›£οΈ routes/                  # API endpoint definitions
    β”‚   β”œβ”€β”€ user/                   # User-facing endpoints
    β”‚   β”‚   β”œβ”€β”€ auth.py             # Authentication endpoints
    β”‚   β”‚   β”œβ”€β”€ project.py          # Project management API
    β”‚   β”‚   β”œβ”€β”€ task.py             # Task management API
    β”‚   β”‚   β”œβ”€β”€ setting.py          # User preferences API
    β”‚   β”‚   └── index.py            # User information API
    β”‚   β”œβ”€β”€ admin/                  # Admin panel endpoints
    β”‚   β”‚   └── auth.py             # Admin authentication
    β”‚   └── super/                  # Super admin endpoints
    β”‚       └── auth.py             # Super admin authentication
    β”œβ”€β”€ 🧠 services/                # AI-powered business logic
    β”‚   β”œβ”€β”€ config.py               # AI model configurations
    β”‚   β”œβ”€β”€ models.py               # AI model factory and utilities
    β”‚   β”œβ”€β”€ memory_storage_service.py # Memory management for AI agents
    β”‚   β”œβ”€β”€ brd_generator.py        # Business Requirements AI service
    β”‚   β”œβ”€β”€ prd_generator.py        # Product Requirements AI service
    β”‚   β”œβ”€β”€ task_generator.py       # Intelligent task creation
    β”‚   β”œβ”€β”€ market_validation.py    # Multi-agent market analysis
    β”‚   β”œβ”€β”€ github_setup.py         # Repository automation service
    β”‚   β”œβ”€β”€ preview_generator.py    # Visual mockup generation
    β”‚   β”œβ”€β”€ templates/              # AI prompt templates
    β”‚   └── toolkits/               # Custom AI tools and integrations
    └── πŸ”§ utils/                   # Utility functions
        β”œβ”€β”€ ai_utils.py             # AI helper functions
        β”œβ”€β”€ background_tasks.py     # Asynchronous task processing
        β”œβ”€β”€ error_handler.py        # Error handling utilities
        └── github_utils.py         # GitHub API utilities

β”œβ”€β”€ πŸ“š examples/                    # Usage examples and demos
β”‚   β”œβ”€β”€ generate_brd.py             # BRD generation example
β”‚   β”œβ”€β”€ generate_prd.py             # PRD generation example
β”‚   β”œβ”€β”€ generate_tasks.py           # Task generation example
β”‚   β”œβ”€β”€ run_market_validation.py    # Market validation example
β”‚   β”œβ”€β”€ generate_github_repo.py     # GitHub automation example
β”‚   β”œβ”€β”€ generate_preview.py         # Mockup generation example
β”‚   β”œβ”€β”€ document_generation_flow.py # Complete workflow example
β”‚   └── data/                       # Sample data and outputs
β”‚       β”œβ”€β”€ sample_brd.md
β”‚       β”œβ”€β”€ sample_prd.md
β”‚       └── sample_tasks.json

β”œβ”€β”€ πŸ”§ github_setup/               # GitHub automation tools
β”‚   β”œβ”€β”€ repo_content_generator.py   # Repository content automation
β”‚   β”œβ”€β”€ build-github-mcp.txt        # GitHub MCP configuration
β”‚   └── task_hierarchy.json         # Task structure templates

β”œβ”€β”€ πŸ“Š market_validation/           # Market research tools
β”‚   β”œβ”€β”€ mv.ipynb                    # Market validation notebook
β”‚   └── taskflow_market_validation.py # Standalone validation script

β”œβ”€β”€ πŸ—„οΈ migrations/                 # Database schema and setup
β”‚   β”œβ”€β”€ database.sql                # Database schema
β”‚   └── clean_database.sql          # Database cleanup scripts

β”œβ”€β”€ πŸ“„ prd_generation/              # Document generation tools
β”‚   β”œβ”€β”€ brd_generation.py           # BRD generation utilities
β”‚   β”œβ”€β”€ task_generator_pydantic.py  # Task generation models
β”‚   └── README.md                   # PRD generation documentation

└── πŸ“ˆ results/                     # Generated outputs and reports
    └── market_validation_report_*.md # Market validation reports

🎯 Usage Examples

1. Generate Business Requirements Document

from app.services.brd_generator import BRDGeneratorService

# Initialize the service
brd_service = BRDGeneratorService()

# Generate BRD
project_description = "A mobile app for food delivery with real-time tracking"
result = await brd_service.generate_brd(project_description, "project-123")

print(result["brd_content"])  # Generated BRD in markdown format

2. Run Market Validation

from app.services.market_validation import MarketValidationService

# Initialize the multi-agent market validation service
market_service = MarketValidationService()

# Run comprehensive market analysis
project_description = "AI-powered fitness coaching app"
result = await market_service.run_market_validation(project_description, "project-456")

print(f"Market Size: {result['market_analysis']['market_size']}")
print(f"Competition Level: {result['market_analysis']['competition_level']}")

3. Automate GitHub Repository Setup

from app.services.github_setup import GitHubSetupService

# Initialize GitHub automation service
github_service = GitHubSetupService()

# Create repository with automated issues and milestones
project_data = {
    "name": "TaskFlow Mobile App",
    "description": "Mobile project management application",
    "tech_stack": ["React Native", "Node.js", "PostgreSQL"]
}

result = await github_service.setup_github_repository(project_data, "project-789")
print(f"Repository created: {result['repository_url']}")

4. Generate Visual Mockups

from app.services.preview_generator import PreviewGeneratorService

# Initialize preview generation service
preview_service = PreviewGeneratorService()

# Generate website mockup
project_description = "E-commerce platform for handmade crafts"
result = await preview_service.generate_preview(project_description, "project-101")

print(f"Preview URL: {result['preview_url']}")
print(f"Generated Files: {result['generated_files']}")

5. API Usage Examples

Authentication

# Register a new user
curl -X POST "http://localhost:8000/api/user/register" \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "password": "secure123"}'

# Login
curl -X POST "http://localhost:8000/api/user/#" \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "password": "secure123"}'

Project Management

# Create a new project
curl -X POST "http://localhost:8000/api/user/projects" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Project", "description": "Project description"}'

# Generate project documentation
# You can find example inputs for the project description field in the file: examples/data/sample_project_description.txt

curl -X POST "http://localhost:8000/api/user/projects/{project_id}/generate-brd" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"project_description": "Detailed project description"}'

πŸš€ Deployment

Docker Production Deployment

# Build production image
docker build -t taskflow-backend:latest .

# Run with production configuration
docker run -d \
  --name taskflow-backend \
  -p 80:8000 \
  --env-file .env.production \
  --restart unless-stopped \
  taskflow-backend:latest

Environment Setup for Production

# Production environment variables
SUPABASE_URL=https://your-prod-project.supabase.co
SUPABASE_KEY=your_production_key
FRONTEND_URL=https://your-frontend-domain.com

# Production AI model configuration
DEFAULT_MODEL_TYPE=openai
DEFAULT_MODEL_ID=gpt-4o-mini

# Security settings
ENABLE_DEBUG_MODE=False
ENABLE_SHOW_TOOL_CALLS=False

# etc...
# see .env.example for more details

πŸ“š API Documentation

Comprehensive API documentation is available at:

  • Swagger UI: http://localhost:8000/api/docs
  • ReDoc: http://localhost:8000/api/redoc
  • OpenAPI Spec: http://localhost:8000/api/openapi.json

For detailed endpoint documentation, see API_DOCUMENTATION.md.


πŸ§ͺ Testing

# Run all tests
python -m pytest

# Run specific test file
python -m pytest tests/test_services.py

# Run with coverage
python -m pytest --cov=app

# Test specific AI service
python examples/generate_brd.py
python examples/run_market_validation.py

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“„ License

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


πŸ†˜ Support


Built with ❀️ for the entrepreneurial community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5