An agentic blog editor.
Navigate to the frontend directory and install dependencies:
cd frontend
bun installStart the development server:
bun run devBuild for production:
bun run buildAuthenticated API Requests
The frontend uses a centralized authentication utility for all API calls located at /frontend/src/services/authenticatedFetch.ts. This provides:
- Automatic JWT token inclusion
- Automatic token expiration handling
- Consistent error handling across the app
Usage:
import { apiGet, apiPost, apiPut, apiDelete } from '@/services/authenticatedFetch';
// GET request (authenticated)
const data = await apiGet<ResponseType>('/endpoint');
// POST request (authenticated)
const result = await apiPost<ResponseType>('/endpoint', { data });
// PUT request (authenticated)
const updated = await apiPut<ResponseType>('/endpoint', { data });
// DELETE request (authenticated)
await apiDelete<ResponseType>('/endpoint');
// Public endpoints (skip authentication)
const publicData = await apiGet<ResponseType>('/public-endpoint', { skipAuth: true });Error Handling:
The utility automatically handles authentication errors:
- Expired/invalid tokens are detected
- Tokens are cleared from localStorage
- Users are automatically redirected to login
- Toast notifications inform users of session expiration
Example:
import { apiPost, isAuthError } from '@/services/authenticatedFetch';
try {
const result = await apiPost<ChatResponse>('/agent', { messages });
} catch (error) {
if (isAuthError(error)) {
// User will be redirected to login automatically
console.log('Session expired');
} else {
// Handle other errors
console.error('API error:', error);
}
}All services have been migrated to use this utility:
artifacts.ts- Artifact managementconversations.ts- Chat conversationsblog.ts- Blog articlessources.ts- Article sourcesstorage/index.ts- File storagepages.ts- Page managementprojects.ts- Project managementuser.ts- User data
The Makefile commands are for the backend only:
Run build make command with tests:
make allBuild the application:
make buildRun the application:
make runLive reload the application:
make watchRun the test suite:
make testClean up binary from the last build:
make clean

