ContractStrategist is a comprehensive employment negotiation platform that helps users develop personalized strategies for job offer negotiations. The application combines user profiling, employer research, AI-powered conversation assistance, and strategic guidance to maximize negotiation outcomes. Built as a full-stack web application, it features a React frontend with shadcn/ui components and an Express.js backend with PostgreSQL database integration.
Preferred communication style: Simple, everyday language.
- Framework: React 18 with TypeScript for type safety and modern development
- Routing: Wouter for lightweight client-side routing
- UI Framework: shadcn/ui component library built on Radix UI primitives for accessible, customizable components
- Styling: Tailwind CSS with CSS variables for theming and responsive design
- State Management: TanStack Query (React Query) for server state management and caching
- Form Handling: React Hook Form with Zod validation for type-safe form management
- Build Tool: Vite for fast development and optimized production builds
- Runtime: Node.js with Express.js framework for RESTful API development
- Language: TypeScript with ES modules for modern JavaScript features
- Database ORM: Drizzle ORM for type-safe database operations with PostgreSQL
- API Design: RESTful endpoints for user profiles, negotiations, conversations, and AI services
- Storage Strategy: Dual storage implementation with in-memory fallback and PostgreSQL persistence
- Middleware: Express middleware for JSON parsing, CORS handling, and request logging
- Primary Database: PostgreSQL with Neon serverless database hosting
- ORM: Drizzle ORM with schema-first approach for type safety
- Migration System: Drizzle Kit for database schema migrations
- Session Management: PostgreSQL session store with connect-pg-simple
- Schema Design: Normalized tables for users, profiles, negotiations, and industry insights
- User Management: Custom user system with profile-based authentication
- Session Handling: Express sessions with PostgreSQL storage backend
- Data Access: User-scoped data access patterns for multi-tenant security
- Demo Mode: Simplified authentication for demonstration purposes
- AI Services: Grok API (XAI) integration for conversation assistance with real-time X posts data
- Database Hosting: Neon PostgreSQL serverless database
- Payment Processing: Stripe integration for secure payment handling
- Development Tools: Replit-specific plugins for development environment integration
- Component Libraries: Extensive Radix UI ecosystem for accessible UI components
- Styling: Google Fonts integration for typography and design consistency
- Base Cost: ~$0.017 per message (Grok API + infrastructure costs)
- Markup Model: 1500% above cost (16x multiplier) = ~$0.27 per message baseline
- Tier System: Three tiers (Essentials, Professional, Executive) with progressively advanced features
Essentials Tier:
- AI-powered negotiation conversations
- Basic market compensation data
- Standard response time
- Conversation history (30 days)
Professional Tier:
- All Essentials features, plus:
- Save and resume negotiations
- Offer simulator & comparison
- Legal & tax implications by location
- Regional cost-of-living adjustments
- Industry-specific playbooks
- Priority support
- Unlimited conversation history
Executive Tier:
- All Professional features, plus:
- Multi-offer orchestration
- Executive compensation benchmarks
- Equity & stock option analysis
- Custom AI prompt templates
- PDF export of strategies
- API access for integrations
- Dedicated account support
- Early access to new features
-
Per-Message Packages (Essentials Tier):
- Starter: 10 credits for $2.70 ($0.27/message - 1500% markup)
- Professional: 50 credits for $13.50 ($0.27/message - 1500% markup)
- Expert: 150 credits for $40.50 ($0.27/message - 1500% markup)
-
Per-Conversation Packages (Essentials Tier - 20 messages/conversation):
- Single: 20 credits for $5.40 ($0.27/message)
- Three: 60 credits for $16.20 ($5.40/conversation)
- Five: 100 credits for $27.00 ($5.40/conversation)
-
Monthly Subscriptions (Tiered Access):
- Essentials Monthly: 100 credits/month for $27.00 (Essentials tier features)
- Professional Monthly: 250 credits/month for $67.50 (Professional tier features)
- Executive Monthly: 1000 credits/month for $270.00 (Executive tier features)
- Server-side pricing validation: All pricing derived from shared constants, never trusted from client
- Payment confirmation: Stripe PaymentIntent verification before crediting accounts
- Idempotent processing: Prevents duplicate credit grants for same payment
- User-scoped access: All operations restricted to authenticated user's data
Client-Side (VITE_ prefix):
VITE_FIREBASE_API_KEY- Firebase web API keyVITE_FIREBASE_PROJECT_ID- Firebase project identifierVITE_FIREBASE_APP_ID- Firebase application IDVITE_STRIPE_PUBLIC_KEY- Stripe publishable key for client-side integration
Server-Side:
FIREBASE_PROJECT_ID- Firebase project ID for server authentication (required)FIREBASE_SERVICE_ACCOUNT_KEY- JSON string of Firebase service account credentials (required for production)PRODUCTION_ORIGINS- Comma-separated list of allowed production origins for CORS (e.g., "https://yourdomain.com,https://www.yourdomain.com")XAI_API_KEY- Grok API key for AI-powered conversationsSTRIPE_SECRET_KEY- Stripe secret key for payment processingDATABASE_URL- PostgreSQL connection stringNODE_ENV- Set to "production" for production deployment
Development Mode:
- Uses
FIREBASE_PROJECT_IDor falls back toVITE_FIREBASE_PROJECT_ID - Firebase Admin SDK operates with projectId only
- Suitable for local development and testing
Production Mode:
- Requires
FIREBASE_SERVICE_ACCOUNT_KEYenvironment variable - Service account must have Firebase Authentication Admin permissions
- Generate service account key from Firebase Console → Project Settings → Service Accounts
- Store the JSON key as a string in the environment variable
To generate Firebase service account key:
- Go to Firebase Console → Project Settings → Service Accounts
- Click "Generate New Private Key"
- Download the JSON file
- Minify the JSON (remove whitespace) and set as
FIREBASE_SERVICE_ACCOUNT_KEY
Implemented Security Measures:
- Rate limiting: 100 req/15min globally, 30 req/15min for AI endpoints
- Helmet security headers enabled
- Strict CORS origin validation (no wildcard in production)
- Authentication required on all protected endpoints
- File upload restrictions: 10MB max, strict MIME type whitelist
- Payment security: Server-side validation, idempotent processing
- Error handling: No stack traces or sensitive data exposed to clients
- Response logging with sensitive data redaction (clientSecret, fileData, etc.)
Additional Production Recommendations:
- Enable Content Security Policy (CSP) in Helmet configuration
- Configure Stripe webhooks for asynchronous payment events
- Set up monitoring and alerting for authentication failures
- Regular security audits and dependency updates