Skip to main content
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 pagination
  • GET /api/v1/clients/{id} - Get single
  • POST /api/v1/clients - Create
  • PATCH /api/v1/clients/{id} - Partial update
  • DELETE /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:
  1. plans - Subscription tiers (Pro, Enterprise)
  2. agencies - Marketing agencies (tenants)
  3. users - All users with roles
  4. clients - Agency’s clients (seats)
  5. documents - Generated content
  6. templates - PDF templates
  7. scheduled_content - Future generations
  8. generation_jobs - Job tracking
  9. api_keys - External API keys (encrypted)
See DEVELOPER-PRD.md Section 4 for complete schema.

Content Generation Pipeline

  1. Topic Analysis - Parse and expand topic
  2. Keyword Research - Generate search terms
  3. Web Research - Fetch and analyze sources (Claude)
  4. Industry Analysis - Context from industry knowledge
  5. Outline Generation - Structure the document
  6. Content Writing - Generate each section (Claude)
  7. Statistics Extraction - Pull data points
  8. Chart Generation - Create visualizations
  9. PDF Rendering - WeasyPrint HTML→PDF
See 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

  1. Create/update Pydantic schema in schemas/
  2. Add service method in services/
  3. Create route in api/v1/
  4. Add to router in api/v1/router.py
  5. Write tests

Adding a New Frontend Page

  1. Create page in app/(dashboard)/feature/page.tsx
  2. Create components in components/feature/
  3. Add API functions in lib/api/feature.ts
  4. Create query hooks in hooks/queries/use-feature.ts
  5. Add to navigation if needed

Adding a New Database Table

  1. Create model in models/
  2. Export in models/__init__.py
  3. Create migration: alembic revision --autogenerate -m "add_table"
  4. Apply: alembic upgrade head
  5. Create corresponding schema, service, and routes

Deployment

Target platform: Dokploy on DigitalOcean See DEVELOPER-PRD.md Section 20 for:
  • Dockerfile configurations
  • docker-compose files
  • Dokploy configuration
  • Environment setup

Important Notes

  1. Never commit secrets - Use environment variables
  2. Always filter by agency_id - Multi-tenant isolation
  3. Use async everywhere - FastAPI is async-first
  4. Validate all inputs - Pydantic for backend, Zod for frontend
  5. Handle errors gracefully - User-friendly error messages
  6. Log important operations - Structured logging with structlog

Getting Help

If you need more context:
  1. Read the relevant section in DEVELOPER-PRD.md
  2. Check UI-UX-DESIGN-SPEC.md for design decisions
  3. Look at existing similar code in the codebase
  4. Ask for clarification if requirements are unclear

Quick Reference