Open-source persona automation framework with LLM-agnostic design.
Build your AI-powered social media persona that learns your voice, generates content, and maintains consistent engagement across platforms.
- π Security-First: Rate limiting, input sanitization, audit logging, encrypted API key storage
- π€ LLM Agnostic: Use OpenAI, Anthropic, or local Ollama models
- π Content Queue: Human-in-the-loop approval before posting
- π Analytics: Track engagement, costs, and content performance
- π Platform Connectors: LinkedIn, X/Twitter, Instagram support
- π³ Production Ready: Docker, Redis, PostgreSQL, BullMQ job queue
personamirror/
βββ apps/
β βββ api/ # Express API server
β βββ agent/ # BullMQ background workers
β βββ web/ # SvelteKit frontend
βββ packages/
β βββ llm-bridge/ # Multi-provider LLM abstraction
β βββ persona-schema/ # TypeScript types & validation
β βββ platform-adapters/# Social platform adapters
β βββ shared-utils/ # Logging, validation, security
βββ migrations/ # Supabase SQL migrations
βββ docker-compose.dev.yml
- Node.js 18+
- pnpm 8+
- Docker & Docker Compose
- Clone the repository
git clone https://github.com/persona-mirror/personamirror.git
cd personamirror- Install dependencies
pnpm install- Set up environment
cp .env.example .env
# Edit .env with your configuration- Start development services
pnpm docker:up- Run database migrations
pnpm db:migrate- Start development server
pnpm devThe API will be running at http://localhost:3001
Create a .env file with:
# Database
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/personamirror
# Redis
REDIS_URL=redis://localhost:6379
# Supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-key
SUPABASE_ANON_KEY=your-anon-key
# Security
JWT_SECRET=your-jwt-secret
ENCRYPTION_KEY=your-encryption-key
# Platform APIs (optional)
LINKEDIN_CLIENT_ID=your-linkedin-id
LINKEDIN_CLIENT_SECRET=your-linkedin-secretGET /health- System health checkGET /health/detailed- Detailed diagnosticsGET /health/live- Kubernetes liveness probeGET /health/ready- Kubernetes readiness probe
POST /api/personas/extract- Extract persona from postsGET /api/personas- List your personasGET /api/personas/:id- Get specific personaDELETE /api/personas/:id- Archive persona
POST /api/content/generate- Generate contentPOST /api/content/validate- Validate content for platform
GET /api/queue- List content queueGET /api/queue/:id- Get queue itemPUT /api/queue/:id- Update queue itemPOST /api/queue/:id/approve- Approve for postingDELETE /api/queue/:id- Delete queue item
- Rate Limiting: 100 requests per 15 minutes per user
- Input Sanitization: XSS and SQL injection protection
- API Key Encryption: Client-side encryption before storage
- Row Level Security: Database-level access control
- Audit Logging: All actions logged with timestamps
- CORS: Configurable origin restrictions
- Helmet.js: Security headers (CSP, HSTS, XSS protection)
# Unit tests
pnpm test:unit
# Integration tests
pnpm test:integration
# All tests
pnpm test# Type checking
pnpm typecheck
# Linting
pnpm lint
# Build all packages
pnpm build# Run migrations
pnpm db:migrate
# Reset database
pnpm db:reset# Start services
pnpm docker:up
# Stop services
pnpm docker:down
# View logs
docker-compose -f docker-compose.dev.yml logs -fServices included:
- PostgreSQL 15 (port 5432)
- Redis 7 (port 6379)
- Helmet.js - Security headers
- Rate Limiting - Redis-backed rate limiting
- Auth Middleware - JWT validation with Supabase
- Input Sanitization - XSS and SQL injection prevention
- RLS Policies - Database-level access control
- Audit Logging - Comprehensive security logging
- Redis-backed - Reliable job processing
- Retry Logic - Exponential backoff on failures
- Scheduled Jobs - Cron-based automation
- Dead Letter Queue - Failed job handling
- Multi-Provider - OpenAI, Anthropic, Ollama
- Cost Tracking - Per-request cost calculation
- Retry Logic - Automatic retries with backoff
- Circuit Breaker - Failover protection
- Usage Metrics - Token and cost tracking
users- User profilespersonas- Extracted personas with tone rulescontent_queue- Content approval workflowapi_keys- Encrypted API credentialsaudit_logs- Security audit trailllm_usage- Cost tracking per provider
See migrations/ for complete schema.
- Connect GitHub repo to Railway
- Add environment variables
- Deploy automatically on push
- Import GitHub repo
- Set framework to SvelteKit
- Configure environment variables
- Deploy
# Build production image
docker build -t personamirror-api -f apps/api/Dockerfile .
# Run with environment
docker run -p 3001:3001 --env-file .env personamirror-api/health- Overall system health/health/detailed- Service-specific health/health/live- Kubernetes liveness/health/ready- Kubernetes readiness
- Structured JSON logs with Winston
- Daily rotation with 14-day retention
- Error tracking with separate error logs
- Request tracing with unique request IDs
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
- Follow TypeScript strict mode
- Write tests for new features
- Update documentation
- Follow conventional commits
MIT License - see LICENSE for details.
Built with β€οΈ by Roshan Ravani
Ship it. Stop planning.