Skip to content

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.

License

Notifications You must be signed in to change notification settings

bradmca/pulse-tag-c-sharp

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!

About

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.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published