A comprehensive Brazilian tax calculator that helps professionals compare Person Jurídica (PJ) vs Consolidação das Leis do Trabalho (CLT) employment regimes with accurate 2025 tax calculations. 100% Production Ready with automated validation, security hardening, and complete testing coverage.
Live at: pjouclt.com.br | Staging: staging.pjouclt.com.br
This platform helps Brazilian professionals make informed decisions about their employment regime by comparing the financial outcomes of working as:
- PJ (Pessoa Jurídica): Independent contractor under Simples Nacional taxation
- CLT (Consolidação das Leis do Trabalho): Formal employment with labor law protections
✅ Accurate 2025 Tax Calculations
- INSS (R$ 8,157.41 ceiling)
- IRPF (R$ 3,036 exemption threshold)
- Simples Nacional with Fator R optimization
- Complete CLT benefits (13th salary, vacation, FGTS)
✅ Comprehensive Comparison
- Real-time PJ vs CLT analysis
- Break-even scenarios
- Risk assessment
- Net income calculations
✅ LGPD Compliant
- Privacy-first architecture
- No personal data storage
- Local calculations (client-side)
- Transparent data handling
✅ Multi-Language Support
- Portuguese (Brazil) - Primary
- English - International
- Spanish - Latin America
Visit pjouclt.com.br and enter:
- Your monthly salary (CLT) or revenue (PJ)
- Number of dependents
- PJ activity type (services, commerce, industry)
- Optional: Current benefits and work hours
Get instant comparison results with detailed tax breakdowns!
# Clone and install
git clone https://github.com/maxh33/pj-clt-calculator.git
cd pj-clt-calculator
npm install
# Start development server
npm run dev
# Visit http://localhost:3000# Copy environment template
cp .env.template .env.local
# Configure required variables
NEXT_PUBLIC_SITE_URL=http://localhost:3000
POSTGRES_PASSWORD=your_secure_password
JWT_SECRET=your_jwt_secret_key
EMAIL_HOST=smtp.zoho.com
EMAIL_USER=pjouclt@yourdomain.com
RESEND_API_KEY=re_xxxxxxxxxx- How to Use - Calculator usage guide
- Understanding Results - Interpreting tax calculations
- Tax Tables 2025 - Current Brazilian tax rates
- Documentation Index - Complete navigation
- Testing Guide - Intelligent multi-tier testing
- Deployment Guide - VPS deployment setup
- API Reference - Admin and metrics endpoints
- Port Conflict Solution - VPS database setup
- CLAUDE.md - AI-assisted development instructions
- Active Tasks - Current development work
- Project Status - Production readiness
- INSS Calculation: Progressive rates up to R$ 8,157.41 ceiling
- IRPF Calculation: Federal income tax with deductions
- 13th Salary: Extra monthly salary in December
- Vacation Pay: 30 days + 1/3 additional
- FGTS: 8% employer deposit
- Benefits: Health insurance, meal vouchers, transportation
- Simples Nacional: Progressive taxation (Anexo III/V)
- Fator R: Payroll-based tax optimization (≥28% of revenue)
- Pro-labore: Optimized salary distribution
- INSS: Separate calculation on pro-labore
- Flexibility: No CLT guarantees, but higher potential income
- Net Income Comparison: Real disposable income after all taxes and benefits
- Break-even Analysis: Salary/revenue needed for regime parity
- Risk Assessment: Stability vs income potential
- Scenario Planning: What-if analysis for different income levels
| Tax Type | Description | Rates |
|---|---|---|
| INSS (CLT) | Social security (employee) | 7.5% to 14% progressive |
| IRPF | Federal income tax | 0% to 27.5% progressive |
| Simples Nacional | PJ unified tax (Anexo III) | 6% to 33% based on revenue |
| Simples Nacional | PJ unified tax (Anexo V + Fator R) | 15.5% to 30.5% progressive |
| FGTS | Employment guarantee fund | 8% (employer contribution) |
- Framework: Next.js 15 (App Router)
- Language: TypeScript 5.8 (Strict mode)
- Styling: Tailwind CSS 3.4
- Database: PostgreSQL 16
- Deployment: Docker + Traefik + VPS
- Testing: Playwright (E2E + Component)
- i18n: Custom dictionary system (PT/EN/ES)
src/
├── app/
│ ├── [lang]/ # Internationalized routes
│ │ ├── calculadora/ # Main calculator page
│ │ ├── guia-pj-clt/ # Educational guides
│ │ └── consultor/ # Professional referral
│ └── api/
│ ├── calculator/ # Tax calculation endpoints
│ ├── contact/ # Contact form with email
│ └── admin/ # LGPD compliance endpoints
├── lib/
│ ├── calculations/ # Tax engines (CLT, PJ, comparison)
│ ├── config/ # Calculator configuration
│ ├── i18n/ # Multi-language dictionaries
│ └── validations/ # Input validation (Brazilian context)
└── components/
├── calculator/ # Calculator UI components
├── sections/ # Page sections
└── forms/ # Contact and consultation forms
graph LR
A[User Input] --> B[Validation]
B --> C[CLT Engine]
B --> D[PJ Engine]
C --> E[Comparison Logic]
D --> E
E --> F[Results Display]
F --> G[Break-even Analysis]
F --> H[Risk Assessment]
Three-tier approach for efficient deployment:
# Critical Tests (100% required for deployment)
npm run test:critical # Security, accessibility, production readiness
# Core Tests (85% threshold)
npm run test:core # Contact forms, navigation, i18n, email
# Enhancement Tests (70% threshold)
npm run test:enhancement # UI/UX, keyboard navigation, performance# Validate production readiness
npm run production:check
# Build and validate for deployment
npm run production:validate
# Deployment readiness check
npm run test:validate-deployment- 🔒 Critical Tests: 100% pass rate (blocks deployment)
- 🎯 Core Tests: ≥85% threshold (flexible)
- ✨ Enhancement Tests: ≥70% threshold (non-blocking)
- 📊 Overall: ≥80% for deployment approval
📖 Complete testing guide: docs/testing/README.md
# Production deployment
docker-compose -f docker-compose.prod.yml up -d
# Staging deployment
docker-compose -f docker-compose.staging.yml up -d
# View logs
docker logs pj-clt-calculator-prod -fNo port conflicts - containers communicate via internal Docker network:
# Connect to database
npm run db:connect # Staging
npm run db:connect:prod # Production
# Create backup
npm run db:backup # Staging
npm run db:backup:prod # Production
# View statistics
npm run db:stats # Staging
# Test connection
npm run db:test # StagingOr use helper scripts directly:
# Linux/Mac
./scripts/db-connect.sh staging psql
# Windows
scripts\db-connect.bat staging psql- SSL: Automatic via Traefik + Let's Encrypt
- Monitoring: Prometheus metrics at
/api/metrics - Health Checks:
/api/healthendpoint - Networking:
monitoring_shared_monitoring_network(external) - Domains:
- Production:
pjouclt.com.br - Staging:
staging.pjouclt.com.br
- Production:
📖 Deployment guide: docs/deployment/overview.md
✅ Privacy-First Architecture
- No personal data stored on servers
- Client-side calculations
- Explicit user consent for contact forms
- Data export and deletion endpoints
✅ Security Features
- CSRF protection on all forms
- Input sanitization and validation
- Rate limiting (100 requests/15 minutes)
- Secure JWT-based admin authentication
- CSP headers and XSS prevention
- ⚡ 90+ Lighthouse Scores out of the box
- 🖼️ Image Optimization: WebP format, lazy loading
- 📦 Code Splitting: Route-based optimization
- 📱 Mobile-First: Responsive design, touch-optimized
- 🔍 Dynamic Robots.txt: Environment-aware crawling
- 📝 Multi-Language Sitemaps: PT/EN/ES with proper hreflang
- 🌐 Structured Data: Organization, Calculator, FAQ schemas
- 🔗 Social Sharing: Open Graph and Twitter Cards
- 📍 Local SEO: Brazilian business context
# Enable analytics in .env
NEXT_PUBLIC_ANALYTICS_ENABLED=true
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXXPre-configured Events:
- Calculator usage tracking
- Contact form submissions
- Newsletter signups
- Professional referral clicks
npm run dev # Development server (port 3000)
npm run dev:alt # Alternative port (3001)
npm run build # Production build
npm start # Start production servernpm test # All test categories
npm run test:critical # Critical tests only
npm run test:headed # Visual test execution
npm run test:debug # Step-by-step debugging
npm run test:docker # Docker environment testnpm run db:connect # Connect to staging DB
npm run db:backup # Create backup
npm run db:stats # View statistics
npm run db:migrate # Run migrations
npm run db:seed # Seed datanpm run calculator:validate # Validate tax calculations
npm run calculator:update-rates # Update tax tablesnpm run production:check # Validate readiness
npm run production:validate # Build + validate- Tax calculation engines (CLT, PJ, Fator R)
- Multi-language support (PT, EN, ES)
- LGPD compliance
- Production deployment
- VPS port conflict resolution
- Tax automation system (n8n + Crawl4AI)
- Advanced scenario planning
- PDF report generation
- Professional referral system
- User accounts (save calculations)
- Historical tax table comparisons
- Industry-specific presets
- API for integration
📖 Full roadmap: docs/project/roadmap.md
Found a calculation error or have a feature idea?
- Check existing GitHub Issues
- Create new issue with:
- Clear description
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Screenshots if applicable
Brazilian tax laws change regularly. To update:
- Modify:
src/lib/data/tax-rates.ts - Run:
npm run calculator:validate - Submit PR with official source reference
- 📧 Email: pjouclt@kodalabs.dev
- 💬 WhatsApp: Available on website
- 📖 FAQ: docs/guides/faq.md
- 📚 Documentation: docs/README.md
- 🤖 AI Development: CLAUDE.md
- 🐛 Issues: GitHub Issues
This project is proprietary software. All rights reserved.
For licensing inquiries, contact: pjouclt@kodalabs.dev
Developed by: KodaLabs Development
Tax Expertise: Based on official Brazilian government tax tables (2025)
Technology Partners:
- Next.js by Vercel
- PostgreSQL by PostgreSQL Global Development Group
- Traefik by Traefik Labs
🔧 Major Fixes:
- ✅ TypeScript build errors resolved (dictionary type inconsistencies)
- ✅ VPS port conflict resolution (internal Docker networking)
- ✅ Database helper scripts for port-free access
- ✅ Documentation aligned with calculator project
🚀 Deployment Status:
- ✅ TypeScript compilation passing
- ✅ Docker builds successful
- ✅ Container auto-startup working
- ✅ Database connectivity verified
- ✅ Security and accessibility compliant
📚 Documentation:
Ready to compare PJ vs CLT? Visit pjouclt.com.br 🚀
For developers: Check CLAUDE.md for AI-assisted development workflow.