Implement REST API Backend for ACP Mobile App
Overview
The ACP Mobile companion app requires a REST API backend with real-time updates via Server-Sent Events (SSE). This issue tracks the implementation of the backend services needed to support the mobile application.
Documentation
Implementation Plan
Phase 1: Authentication (Week 1)
Endpoints:
POST /auth/login - Initiate OAuth flow, return authorization URL
POST /auth/token - Exchange authorization code for JWT tokens
POST /auth/refresh - Refresh access token using refresh token
Requirements:
- PKCE support for mobile security
- JWT tokens with configurable expiration (default: 1 hour)
- Automatic token rotation on refresh
- Red Hat SSO integration
Phase 2: Core APIs (Week 2)
Endpoints:
GET/POST /sessions - List and create AI coding sessions
GET/PATCH /sessions/{id} - Get and update session details
GET /sessions/{id}/logs - Get session execution logs
GET/POST/DELETE /repos - Manage connected repositories
GET/PATCH /user/profile - User profile management
GET/PATCH /user/preferences - User preferences (theme, notifications, quiet hours)
Data Models:
- Sessions: Track AI workflow execution with status, progress, and task history
- Repositories: User's connected GitHub repositories
- User preferences: Theme, notification settings, quiet hours configuration
Phase 3: Real-time Updates (Week 3)
SSE Event Types:
session.progress - Incremental progress updates (don't trigger cache invalidation)
session.updated - Partial session changes (client merges into cache)
session.status - Status transitions (trigger notifications if awaiting_review)
notification.new - New GitHub notification (invalidates cache)
notification.read - Notification marked as read (invalidates cache)
Requirements:
- Persistent SSE connection with automatic reconnection
- Events update client cache without full API refetch
- Exponential backoff on reconnection (1s → 30s max)
- Connection management for mobile (disconnect on background, reconnect on foreground)
Phase 4: GitHub Integration (Week 4)
Endpoints:
GET /notifications - List GitHub notifications with suggested workflows
PATCH /notifications/{id} - Mark notification as read
POST /notifications/{id}/mute - Mute notification thread
Workflow Suggestion Logic:
- Pull requests →
review workflow
- Issues with "bug" label →
bugfix workflow
- Feature requests →
plan workflow
- General issues →
research workflow
Phase 5: Polish & Production Readiness (Week 5)
Technical Requirements
Security
- All endpoints require authentication (except
/auth/*)
- OAuth 2.0 with PKCE for mobile security
- JWT tokens with Bearer authentication
- HTTPS only in production
- Input validation on all endpoints
- SQL injection and XSS prevention
Performance
- Response time: <2 seconds for most endpoints
- SSE: Streaming, indefinite connection support
- Efficient database queries with proper indexing
- Rate limiting on authenticated endpoints
Error Handling
- Standard error response format:
{
"error": "ErrorType",
"message": "Human-readable message",
"details": {}
}
- Status codes: 200 (success), 201 (created), 204 (no content), 400 (bad request), 401 (unauthorized), 404 (not found), 500 (server error)
- 401 responses trigger automatic client token refresh (max 1 retry)
Third-party Integrations
- Red Hat SSO - OAuth authentication provider
- GitHub API - Fetch notifications, repository metadata
- Expo Push Service - Send push notifications to mobile devices
- Claude API - Chat feature (future implementation)
Development Support
Client Mock Data
The mobile client includes comprehensive mocks for development:
- Mock authentication (bypass OAuth)
- Mock sessions with realistic data and SSE events
- Mock GitHub notifications
- Environment variable toggles for selective mocking
Environment Variables
EXPO_PUBLIC_API_BASE_URL=https://ambient-code.apps.rosa.vteam-stage.7fpc.p3.openshiftapps.com/api/v1
EXPO_PUBLIC_OAUTH_DOMAIN=sso.redhat.com
EXPO_PUBLIC_OAUTH_CLIENT_ID=acp-mobile
Reference Implementation
- Client code:
services/api/ (TypeScript API client)
- Type definitions:
types/ (data models)
- Mock services:
services/mock/ (expected behavior)
Acceptance Criteria
Contact
For questions or clarification: Jeremy Eder (jeder@redhat.com)
Related: This backend will power the ACP Mobile companion app for AI-assisted development workflows. The client is built with React Native + Expo and uses React Query for data management.
Implement REST API Backend for ACP Mobile App
Overview
The ACP Mobile companion app requires a REST API backend with real-time updates via Server-Sent Events (SSE). This issue tracks the implementation of the backend services needed to support the mobile application.
Documentation
docs/BACKEND_REQUIREMENTS.mdspecs/001-acp-mobile/contracts/acp-api.yamlhttps://ambient-code.apps.rosa.vteam-stage.7fpc.p3.openshiftapps.com/api/v1Implementation Plan
Phase 1: Authentication (Week 1)
Endpoints:
POST /auth/login- Initiate OAuth flow, return authorization URLPOST /auth/token- Exchange authorization code for JWT tokensPOST /auth/refresh- Refresh access token using refresh tokenRequirements:
Phase 2: Core APIs (Week 2)
Endpoints:
GET/POST /sessions- List and create AI coding sessionsGET/PATCH /sessions/{id}- Get and update session detailsGET /sessions/{id}/logs- Get session execution logsGET/POST/DELETE /repos- Manage connected repositoriesGET/PATCH /user/profile- User profile managementGET/PATCH /user/preferences- User preferences (theme, notifications, quiet hours)Data Models:
Phase 3: Real-time Updates (Week 3)
GET /sse/sessions)session.progress)session.status)session.updated)SSE Event Types:
session.progress- Incremental progress updates (don't trigger cache invalidation)session.updated- Partial session changes (client merges into cache)session.status- Status transitions (trigger notifications ifawaiting_review)notification.new- New GitHub notification (invalidates cache)notification.read- Notification marked as read (invalidates cache)Requirements:
Phase 4: GitHub Integration (Week 4)
Endpoints:
GET /notifications- List GitHub notifications with suggested workflowsPATCH /notifications/{id}- Mark notification as readPOST /notifications/{id}/mute- Mute notification threadWorkflow Suggestion Logic:
reviewworkflowbugfixworkflowplanworkflowresearchworkflowPhase 5: Polish & Production Readiness (Week 5)
POST /user/push-token)Technical Requirements
Security
/auth/*)Performance
Error Handling
{ "error": "ErrorType", "message": "Human-readable message", "details": {} }Third-party Integrations
Development Support
Client Mock Data
The mobile client includes comprehensive mocks for development:
Environment Variables
Reference Implementation
services/api/(TypeScript API client)types/(data models)services/mock/(expected behavior)Acceptance Criteria
Contact
For questions or clarification: Jeremy Eder (jeder@redhat.com)
Related: This backend will power the ACP Mobile companion app for AI-assisted development workflows. The client is built with React Native + Expo and uses React Query for data management.