Content Calendar Analysis API Backend

This directory contains the backend API for the Content Calendar Analysis application.

Structure

  • index.ts - Main entry point for the API
  • database/ - Database schema and queries
    • schema.ts - Database table definitions
    • queries.ts - Database operations
  • routes/ - API route handlers
    • auth.ts - Authentication endpoints
    • analysis.ts - Content analysis endpoints
  • swagger.ts - API documentation

API Endpoints

Authentication

  • POST /api/auth/register - Register a new lead
  • POST /api/auth/login - Login with existing credentials
  • POST /api/auth/logout - Logout and invalidate session
  • GET /api/auth/session - Get current session information

Analysis

  • POST /api/analysis/generate - Generate a new content calendar analysis
  • GET /api/analysis/:id - Get a specific analysis by UUID
  • GET /api/analysis - List all analyses for the authenticated lead

Environment Variables

  • GEMINI_API_KEY - Google Gemini API key for content generation

Database

The application uses SQLite for data storage with the following tables:

  • leads_v1 - User information and credentials
  • sessions_v1 - Authentication sessions
  • analyses_v1 - Stored content calendar analyses