Skip to content

Trifusion-Dynamics/TFX-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

179 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ TFX AI - Full-Stack AI-Powered Development Platform

Next.js FastAPI PostgreSQL TypeScript Tailwind Python

πŸ“‹ Table of Contents

🌟 Overview

TFX AI is a cutting-edge full-stack web application that showcases modern AI-powered development capabilities. Built with Next.js 15 and FastAPI, it provides a comprehensive platform for AI services, project management, and client interactions.

🎯 Key Highlights

  • πŸ€– AI-Powered Tools: Resume analyzer, text generator, and QA bot using Google Gemini AI
  • πŸ‘₯ User Management: Complete authentication system with role-based access control
  • πŸ’Ό Portfolio Management: Dynamic project showcase with filtering and search
  • πŸ’° Pricing Plans: Flexible service pricing with multiple tiers
  • πŸ“ Content Management: Blog posts, case studies, and testimonials
  • πŸ”’ Security: JWT authentication, rate limiting, and input validation

✨ Features

πŸ€– AI Tools Module

  • Resume Analyzer: AI-powered resume analysis and feedback
  • Text Generator: Intelligent text generation for various use cases
  • QA Bot: Contextual question answering system
  • Usage Tracking: Comprehensive AI tool usage analytics

πŸ‘₯ User Management

  • Authentication: Secure JWT-based login/registration
  • Role System: Admin and User roles with different permissions
  • Profile Management: User profile updates and avatar upload
  • Email Verification: Account verification via email

πŸ’Ό Portfolio System

  • Project Showcase: Dynamic portfolio with categories (AI, Web, SaaS)
  • Tech Stack Display: Technology stack visualization
  • Featured Projects: Highlighted projects section
  • Search & Filter: Advanced project filtering capabilities

πŸ’° Business Features

  • Service Catalog: Comprehensive service offerings
  • Pricing Plans: Multiple pricing tiers with features
  • Client Testimonials: Customer feedback showcase
  • Contact Forms: Lead generation and contact management

πŸ“ Content Management

  • Blog System: Article publishing and management
  • Case Studies: Detailed project case studies
  • SEO Optimization: Meta tags and structured data
  • Responsive Design: Mobile-first design approach

πŸ—οΈ Architecture

Frontend (Next.js 15)

frontend/
β”œβ”€β”€ app/                    # App Router structure
β”‚   β”œβ”€β”€ (auth)/            # Authentication pages
β”‚   β”œβ”€β”€ (dashboard)/       # Dashboard pages
β”‚   β”œβ”€β”€ api/              # API routes
β”‚   └── globals.css       # Global styles
β”œβ”€β”€ components/           # Reusable components
β”‚   β”œβ”€β”€ ui/              # UI components (shadcn/ui)
β”‚   β”œβ”€β”€ forms/           # Form components
β”‚   └── layout/          # Layout components
β”œβ”€β”€ lib/                 # Utility functions
└── types/              # TypeScript definitions

Backend (FastAPI)

backend/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/v1/          # API endpoints
β”‚   β”œβ”€β”€ core/            # Core functionality
β”‚   β”œβ”€β”€ models/          # Database models
β”‚   β”œβ”€β”€ schemas/         # Pydantic schemas
β”‚   β”œβ”€β”€ services/        # Business logic
β”‚   └── utils/           # Utilities
β”œβ”€β”€ alembic/            # Database migrations
└── tests/              # Test files

Database (PostgreSQL - NeonDB)

  • Users: Authentication and profiles
  • Projects: Portfolio items
  • Services: Service catalog
  • AI Tool Usage: Usage analytics
  • Content: Blog posts, testimonials, case studies
  • Pricing: Service pricing plans

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • Python 3.14+
  • PostgreSQL (NeonDB recommended)
  • Git

1. Clone the Repository

git clone <repository-url>
cd tfxai

2. Backend Setup

cd backend

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

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env with your database URL and API keys

# Setup database
python standalone_db_setup.py

# Start development server
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

3. Frontend Setup

cd frontend

# Install dependencies
npm install

# Configure environment
cp .env.local.example .env.local
# Edit .env.local with your API URLs

# Start development server
npm run dev

4. Access the Application

πŸ”‘ Default Login

  • Admin: admin@tfxai.com / Admin@123
  • Test User: test@tfxai.com / Test@123

πŸ“ Project Structure

tfxai/
β”œβ”€β”€ README.md              # This file
β”œβ”€β”€ .gitignore            # Git ignore rules
β”œβ”€β”€ docker-compose.yml    # Docker configuration
β”œβ”€β”€ .env.example          # Environment template
β”‚
β”œβ”€β”€ backend/              # FastAPI backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/v1/      # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py  # Authentication
β”‚   β”‚   β”‚   β”œβ”€β”€ users.py # User management
β”‚   β”‚   β”‚   β”œβ”€β”€ projects.py # Portfolio
β”‚   β”‚   β”‚   β”œβ”€β”€ ai_tools.py # AI services
β”‚   β”‚   β”‚   └── admin.py # Admin endpoints
β”‚   β”‚   β”œβ”€β”€ core/        # Core functionality
β”‚   β”‚   β”‚   β”œβ”€β”€ config.py # Settings
β”‚   β”‚   β”‚   β”œβ”€β”€ security.py # Auth
β”‚   β”‚   β”‚   └── dependencies.py # DI
β”‚   β”‚   β”œβ”€β”€ models/      # SQLAlchemy models
β”‚   β”‚   β”œβ”€β”€ schemas/     # Pydantic schemas
β”‚   β”‚   β”œβ”€β”€ services/    # Business logic
β”‚   β”‚   └── utils/       # Utilities
β”‚   β”œβ”€β”€ alembic/         # Database migrations
β”‚   β”œβ”€β”€ requirements.txt # Python dependencies
β”‚   └── .env            # Environment variables
β”‚
└── frontend/            # Next.js frontend
    β”œβ”€β”€ app/            # App Router
    β”‚   β”œβ”€β”€ (auth)/     # Auth pages
    β”‚   β”œβ”€β”€ (dashboard)/# Dashboard
    β”‚   β”œβ”€β”€ api/        # API routes
    β”‚   └── globals.css # Styles
    β”œβ”€β”€ components/     # Reusable components
    β”‚   β”œβ”€β”€ ui/        # shadcn/ui components
    β”‚   β”œβ”€β”€ forms/     # Form components
    β”‚   └── layout/    # Layout components
    β”œβ”€β”€ lib/           # Utilities
    β”œβ”€β”€ types/         # TypeScript types
    β”œβ”€β”€ public/        # Static assets
    └── package.json   # Dependencies

πŸ”§ Configuration

Backend Environment Variables (.env)

# App Configuration
APP_NAME=TFX AI
APP_ENV=development
APP_PORT=8000
SECRET_KEY=your-super-secret-key

# Database
DATABASE_URL=postgresql+asyncpg://user:pass@host/db

# JWT Authentication
JWT_SECRET=your-jwt-secret
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=15

# Email Service
MAIL_USERNAME=your@gmail.com
MAIL_PASSWORD=your_app_password
MAIL_FROM=your@gmail.com

# AI Services
GEMINI_API_KEY=your_gemini_api_key

# File Upload
CLOUDINARY_CLOUD_NAME=your_cloud
CLOUDINARY_API_KEY=your_key
CLOUDINARY_API_SECRET=your_secret

Frontend Environment Variables (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_APP_URL=http://localhost:3000

πŸ“š API Documentation

Authentication Endpoints

  • POST /api/v1/auth/register - User registration
  • POST /api/v1/auth/login - User login
  • POST /api/v1/auth/refresh - Token refresh
  • GET /api/v1/users/me - Get current user

AI Tools Endpoints

  • POST /api/v1/ai-tools/analyze-resume - Resume analysis
  • POST /api/v1/ai-tools/generate-text - Text generation
  • POST /api/v1/ai-tools/qa-bot - QA bot
  • GET /api/v1/ai-tools/history - Usage history

Portfolio Endpoints

  • GET /api/v1/projects - List projects
  • GET /api/v1/projects/{slug} - Get project details
  • GET /api/v1/services - List services
  • GET /api/v1/pricing - Get pricing plans

Admin Endpoints

  • GET /api/v1/admin/dashboard - Dashboard stats
  • GET /api/v1/admin/users - User management
  • POST /api/v1/admin/projects - Create project

πŸ“– Interactive API Docs

Visit http://localhost:8000/docs for interactive API documentation.

πŸ› οΈ Development

Backend Development

# Run tests
pytest

# Database migrations
alembic revision --autogenerate -m "Description"
alembic upgrade head

# Code formatting
black app/
isort app/

# Type checking
mypy app/

Frontend Development

# Run tests
npm test

# Build for production
npm run build

# Lint code
npm run lint

# Type checking
npm run type-check

Database Management

# Setup database
python standalone_db_setup.py

# Check database status
python check_db.py

# Reset database
python setup_database.py

πŸš€ Deployment

Backend Deployment (Docker)

FROM python:3.14-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
EXPOSE 8000

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

Frontend Deployment (Vercel)

# Build for production
npm run build

# Deploy to Vercel
vercel --prod

Environment Setup

  • Production: Use production database URLs
  • Environment Variables: Set all required env vars
  • SSL: Enable HTTPS for production
  • Monitoring: Set up logging and monitoring

🀝 Contributing

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

πŸ“ Development Guidelines

  • Follow code conventions (Prettier, Black)
  • Write tests for new features
  • Update documentation
  • Use meaningful commit messages

πŸ“Š Tech Stack

Frontend Technologies

  • Next.js 15 - React framework with App Router
  • TypeScript - Type-safe JavaScript
  • Tailwind CSS - Utility-first CSS framework
  • shadcn/ui - Modern UI component library
  • Framer Motion - Animation library
  • Zustand - State management
  • React Hook Form - Form handling
  • Axios - HTTP client

Backend Technologies

  • FastAPI - Modern Python web framework
  • SQLAlchemy - ORM with async support
  • PostgreSQL - Database (NeonDB)
  • Pydantic - Data validation
  • JWT - Authentication tokens
  • bcrypt - Password hashing
  • Alembic - Database migrations

AI & External Services

  • Google Gemini AI - AI model integration
  • Cloudinary - File storage
  • SMTP - Email service
  • Redis - Caching (optional)

πŸ”’ Security Features

  • JWT Authentication: Secure token-based auth
  • Password Hashing: bcrypt encryption
  • Rate Limiting: API abuse prevention
  • Input Validation: Pydantic schemas
  • CORS Protection: Cross-origin security
  • SQL Injection Prevention: ORM protection
  • HTTPS Ready: SSL configuration

πŸ“ˆ Performance

  • Database Optimization: Indexed queries
  • Caching Strategy: Redis integration
  • Image Optimization: Cloudinary CDN
  • Code Splitting: Next.js optimization
  • Lazy Loading: Component-level loading
  • API Rate Limiting: Performance protection

πŸ› Troubleshooting

Common Issues

  1. Database Connection: Check DATABASE_URL format
  2. AI API Errors: Verify GEMINI_API_KEY
  3. CORS Issues: Check allowed origins
  4. Build Errors: Clear node_modules and reinstall

Debug Mode

# Backend debug mode
uvicorn app.main:app --reload --log-level debug

# Frontend debug mode
NEXT_PUBLIC_DEBUG=true npm run dev

πŸ“„ License

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

πŸ™ Acknowledgments

  • Next.js Team - Amazing React framework
  • FastAPI - Modern Python web framework
  • NeonDB - PostgreSQL hosting
  • Google Gemini - AI model capabilities
  • shadcn/ui - Beautiful UI components

πŸ“ž Support

For support and questions:


πŸ‘¨β€πŸ’» Developer

Arun Kumar Bind


πŸš€ Built with ❀️ by Arun Kumar Bind

⭐ Star this repo if it helped you!