This is the frontend for BlogStorm Publish. It provides an interface for submitting content ideas, monitoring their progression through AI enhancement stages, and managing publishing schedules.
The application is built with:
- React + TypeScript
- Shadcn UI components
- TanStack Query for data fetching
- Jest + React Testing Library
- WebSocket for real-time updates
First, install dependencies:
npm install
Create a .env.local
file with:
LLM_API_URL=http://localhost:3001
PUBLISH_API_URL=http://localhost:3000
Start the development server:
npm run dev
The application is organized into the following directories:
src/
├── components/ # Reusable UI components
├── features/ # Main feature implementations
├── hooks/ # Custom React hooks
├── lib/ # Utilities and helpers
├── pages/ # Page components
├── services/ # API integration
└── types/ # TypeScript types
The application interacts with two backend services: the Orchestration API and the LLM Pipeline API. Here's how they work together:
When submitting new content for processing, the UI sends a POST request to /api/content/submit
with the following structure:
interface ContentSubmission {
content: {
initialIdeas: string;
type: 'blog_post';
preferences: {
tone: 'casual' | 'professional';
targetLength: 'short' | 'medium' | 'long';
};
};
scheduling: {
type: 'immediate' | 'scheduled' | 'recurring';
publishAt?: string; // ISO-8601 datetime
recurrence?: {
pattern: 'daily' | 'weekly' | 'monthly';
dayOfWeek?: number;
timeOfDay: string; // HH:mm format
};
};
}
The application maintains real-time content status through two mechanisms:
- WebSocket Connection: Subscribes to real-time updates about content processing:
interface ContentUpdate {
contentId: string;
status: 'queued' | 'processing' | 'ready' | 'published' | 'failed';
currentStage: string;
progress: {
completedStages: string[];
nextStage: string;
estimatedCompletion: string;
};
}
- Status Polling: Regular GET requests to
/api/content/status/:id
for detailed status information when WebSocket updates aren't available.
The UI displays queue information by polling /api/content/queue
, which returns:
interface QueueStatus {
activeJobs: number;
queueLength: number;
estimatedWaitTime: number;
nextProcessingSlot: string;
}
Content scheduling is managed through PATCH requests to /api/content/:id/schedule
:
interface ScheduleUpdate {
newSchedule: {
publishAt: string;
recurrence?: {
pattern: 'daily' | 'weekly' | 'monthly';
dayOfWeek?: number;
timeOfDay: string;
};
};
}
Run tests:
npm test
npm
Run linting:
npm run lint
The application currently provides:
Content Creation:
- Real-time progress tracking of AI enhancements
Schedule Management:
- Calendar interface for content scheduling
- Queue status visualization
- Schedule modification tools