Normalized for Mintlify from
knowledge-base/aiconnected-apps-and-modules/modules/aiConnected-paper/paper-claude.mdx.CLAUDE.md - Content Strategist AI
This file provides guidance to Claude Code for working on the Content Strategist AI project.Project Overview
Content Strategist AI is a white-label SaaS platform that generates professional thought leadership content for marketing agencies and their clients. The platform produces executive-quality PDF documents with original research, statistics, data visualizations, and professional design. Key Documentation:DEVELOPER-PRD.md- Complete technical specification (12,000+ lines)UI-UX-DESIGN-SPEC.md- Design system and UI specifications
Technology Stack
Backend (Python/FastAPI)
- Framework: FastAPI 0.109+
- Database: PostgreSQL 15+ with SQLAlchemy 2.0+
- Task Queue: Celery 5.3+ with Redis
- PDF Generation: WeasyPrint 60+
- AI: Anthropic Claude API
Frontend (Next.js)
- Framework: Next.js 14+ with App Router
- Language: TypeScript 5.3+
- Styling: Tailwind CSS 3.4+ with shadcn/ui
- State: Zustand + TanStack Query
- Forms: React Hook Form + Zod
Project Structure
Development Commands
Backend
Frontend
Docker
Code Style Guidelines
Python
- Use type hints for all function parameters and return types
- Follow PEP 8 style guide
- Use async/await for I/O operations
- Docstrings for public functions (Google style)
- Maximum line length: 100 characters
TypeScript/React
- Use TypeScript strict mode
- Prefer functional components with hooks
- Use named exports (not default exports for components)
- Props interfaces should be named
ComponentNameProps - Use absolute imports (
@/components/...)
CSS/Tailwind
- Use Tailwind utility classes
- Extract repeated patterns to components
- Follow mobile-first responsive design
- Use CSS variables for theme colors (defined in globals.css)
Key Patterns
API Endpoints
All API endpoints follow REST conventions:GET /api/v1/clients- List with paginationGET /api/v1/clients/{id}- Get singlePOST /api/v1/clients- CreatePATCH /api/v1/clients/{id}- Partial updateDELETE /api/v1/clients/{id}- Delete
Authentication
- JWT tokens (access + refresh)
- Refresh token rotation on use
- Role-based access control (RBAC)
Multi-tenancy
- All data queries must filter by
agency_id - Agency resolved from JWT token or domain
- Super admins have cross-agency access
Error Handling
Backend returns consistent error format:State Management
- Server state (API data): TanStack Query
- Client state (UI, auth): Zustand
- Form state: React Hook Form
- URL state: Next.js searchParams
Database Schema Overview
Main entities:- plans - Subscription tiers (Pro, Enterprise)
- agencies - Marketing agencies (tenants)
- users - All users with roles
- clients - Agency’s clients (seats)
- documents - Generated content
- templates - PDF templates
- scheduled_content - Future generations
- generation_jobs - Job tracking
- api_keys - External API keys (encrypted)
DEVELOPER-PRD.md Section 4 for complete schema.
Content Generation Pipeline
- Topic Analysis - Parse and expand topic
- Keyword Research - Generate search terms
- Web Research - Fetch and analyze sources (Claude)
- Industry Analysis - Context from industry knowledge
- Outline Generation - Structure the document
- Content Writing - Generate each section (Claude)
- Statistics Extraction - Pull data points
- Chart Generation - Create visualizations
- PDF Rendering - WeasyPrint HTML→PDF
DEVELOPER-PRD.md Section 7 for implementation details.
Environment Variables
Backend (.env)
Frontend (.env.local)
Testing Strategy
Backend Tests
- Unit tests: Services, utilities
- Integration tests: API endpoints with test DB
- Use factories: factory-boy for test data
- Async tests: pytest-asyncio
Frontend Tests
- Component tests: React Testing Library
- Hook tests: renderHook utility
- E2E tests: Playwright (future)
Common Tasks
Adding a New API Endpoint
- Create/update Pydantic schema in
schemas/ - Add service method in
services/ - Create route in
api/v1/ - Add to router in
api/v1/router.py - Write tests
Adding a New Frontend Page
- Create page in
app/(dashboard)/feature/page.tsx - Create components in
components/feature/ - Add API functions in
lib/api/feature.ts - Create query hooks in
hooks/queries/use-feature.ts - Add to navigation if needed
Adding a New Database Table
- Create model in
models/ - Export in
models/__init__.py - Create migration:
alembic revision --autogenerate -m "add_table" - Apply:
alembic upgrade head - Create corresponding schema, service, and routes
Deployment
Target platform: Dokploy on DigitalOcean SeeDEVELOPER-PRD.md Section 20 for:
- Dockerfile configurations
- docker-compose files
- Dokploy configuration
- Environment setup
Important Notes
- Never commit secrets - Use environment variables
- Always filter by agency_id - Multi-tenant isolation
- Use async everywhere - FastAPI is async-first
- Validate all inputs - Pydantic for backend, Zod for frontend
- Handle errors gracefully - User-friendly error messages
- Log important operations - Structured logging with structlog
Getting Help
If you need more context:- Read the relevant section in
DEVELOPER-PRD.md - Check
UI-UX-DESIGN-SPEC.mdfor design decisions - Look at existing similar code in the codebase
- Ask for clarification if requirements are unclear
Quick Reference
| Task | Location |
|---|---|
| API Routes | backend/app/api/v1/ |
| Database Models | backend/app/models/ |
| Business Logic | backend/app/services/ |
| Background Tasks | backend/app/workers/ |
| PDF Templates | backend/app/templates/ |
| React Pages | frontend/src/app/ |
| React Components | frontend/src/components/ |
| API Client | frontend/src/lib/api/ |
| State Stores | frontend/src/stores/ |
| Type Definitions | frontend/src/types/ |