GitHunt
BR

bradmca/pulse-tag-c-sharp

C# implementation of PulseTag, an intelligent social media utility designed to maximize post engagement through AI-driven trend analysis. It bridges the gap between content creation and discovery by analysing social media posts in real-time and generating optimized hashtag strategies.

PulseTag - AI-Driven Hashtag Generator (.NET)

Screenshot 2026-02-04 112300

A powerful web application built with .NET 10 that analyzes your social media posts in real-time, suggesting the top trending hashtags to maximize post reach and engagement. Perfect for influencers and marketers who want to stay ahead of the trend curve.

๐Ÿš€ Features

  • ๐Ÿค– AI-Powered Analysis: Uses OpenRouter AI to analyze post content and generate relevant hashtags
  • ๐Ÿ“ฑ Multi-Platform Support: Works with LinkedIn, Twitter/X, and general web content
  • ๐Ÿ”’ Secure: Implements SSRF protection, input sanitization, and secure API key handling
  • โšก High Performance: Built with ASP.NET Core and Blazor for optimal performance
  • ๐Ÿณ Docker Support: Fully containerized for easy deployment
  • ๐Ÿงช Tested: Comprehensive unit tests with xUnit
  • ๐Ÿ“Š CI/CD Ready: GitHub Actions workflow for automated testing and deployment

๐Ÿ—๏ธ Architecture

Tech Stack

  • Backend: ASP.NET Core 10 Web API
  • Frontend: Blazor Web App (Server-Side Rendering)
  • AI Integration: OpenAI SDK with OpenRouter
  • Web Scraping: Playwright for .NET
  • Testing: xUnit with Moq
  • Containerization: Docker & Docker Compose
  • CI/CD: GitHub Actions

Solution Structure

PulseTag/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ PulseTag.Api/          # Web API
โ”‚   โ”œโ”€โ”€ PulseTag.Web/          # Blazor Frontend
โ”‚   โ””โ”€โ”€ PulseTag.Shared/       # Shared Models
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ PulseTag.Api.Tests/    # Unit Tests
โ”œโ”€โ”€ .github/workflows/         # CI/CD Pipelines
โ”œโ”€โ”€ docker-compose.yml         # Docker Compose Configuration
โ””โ”€โ”€ PulseTag.sln              # Solution File

๐Ÿš€ Quick Start

Prerequisites

  • .NET 10.0 SDK
  • Docker (optional)
  • OpenRouter API Key (free at openrouter.ai)

Local Development

  1. Clone the repository

    git clone https://github.com/bradmca/pulse-tag-c-sharp.git
    cd pulse-tag
  2. Set up configuration

    Create src/PulseTag.Api/appsettings.Development.json:

    {
      "OpenRouter": {
        "ApiKey": "your-openrouter-api-key",
        "Model": "microsoft/phi-3-medium-128k-instruct:free"
      },
      "LinkedIn": {
        "Cookies": "your-linkedin-cookies-optional"
      }
    }
  3. Run the solution

    # Run both API and Web
    dotnet run --project src/PulseTag.Api
    dotnet run --project src/PulseTag.Web
  4. Access the applications

    For Docker deployment:

    For local development:

Docker Deployment

  1. Using Docker Compose

    # Create .env file with your configuration
    cp .env.example .env
    # Edit .env with your API keys
    
    # Run with Docker Compose
    docker-compose up -d
  2. Access the applications

๐Ÿ“– API Documentation

Analyze Endpoint

POST /api/analyze
Content-Type: application/json

{
  "url": "https://linkedin.com/posts/example"
}

Response:

{
  "originalText": "Your post content...",
  "hashtags": {
    "safe": ["Marketing", "Business"],
    "rising": ["GrowthHacking", "GenAI"],
    "niche": ["B2BMarketingTips"]
  }
}

Health Check

GET /api/health

๐Ÿ”ง Configuration

Environment Variables

Variable Description Default
OpenRouter__ApiKey OpenRouter API key Required
OpenRouter__Model AI model to use microsoft/phi-3-medium-128k-instruct:free
LinkedIn__Cookies LinkedIn cookies for authenticated access Optional
AllowedOrigins CORS allowed origins http://localhost:3000
ApiBaseUrl API base URL for frontend http://localhost:8000

Supported Platforms

  • LinkedIn: Works with public posts. Use cookies for private posts.
  • Twitter/X: Requires individual tweet URLs (must contain /status/).
  • General Websites: Can extract content from most web pages.

๐Ÿงช Testing

Run the test suite:

# Run all tests
dotnet test

# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"

๐Ÿš€ Deployment

Production Deployment

  1. Environment Setup

    # Create production settings
    cp src/PulseTag.Api/appsettings.json src/PulseTag.Api/appsettings.Production.json
    # Update with production values
  2. Docker Deployment

    # Build and deploy
    docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
  3. Kubernetes

    # Apply Kubernetes manifests
    kubectl apply -f k8s/

๐Ÿ”’ Security Features

  • SSRF Protection: URL validation to only allow approved domains
  • Input Sanitization: Prevents prompt injection attacks
  • Secure Headers: CORS, CSP, and other security headers
  • Rate Limiting: Built-in rate limiting capabilities
  • No Hardcoded Secrets: All secrets via environment variables

๐Ÿค 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 at https://github.com/bradmca/pulse-tag-c-sharp

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • OpenRouter for providing free AI model access
  • Playwright for reliable web scraping
  • Blazor for the modern web framework
  • .NET for the powerful runtime

๐Ÿ“ž Support

If you have any questions or issues, please open an issue on GitHub.

โญ If this project helps you, please give it a star!

bradmca/pulse-tag-c-sharp | GitHunt