- Remove nested git repository from bugulma/frontend/.git - Add all frontend files to main repository tracking - Convert from separate frontend/backend repos to unified monorepo - Preserve all frontend code and development history as tracked files - Eliminate nested repository complexity for simpler development workflow This creates a proper monorepo structure with frontend and backend coexisting in the same repository for easier development and deployment.
5.2 KiB
Backend Endpoints Needed
This document lists all backend endpoints that need to be implemented to complete the frontend-to-backend migration.
AI/LLM Endpoints
Already documented in BACKEND_AI_ENDPOINTS.md:
- ✅
POST /api/ai/extract/text - ✅
POST /api/ai/extract/file - ✅
POST /api/ai/analyze/symbiosis - ✅
POST /api/ai/web-intelligence - ✅
POST /api/ai/search-suggestions - ✅
POST /api/ai/generate/description - ✅
POST /api/ai/generate/historical-context - ✅
POST /api/ai/chat
Additional needed:
POST /api/ai/chat/stream- Streaming chat (SSE or WebSocket)
Proposal Endpoints
List Proposals
GET /api/proposals
Query Parameters:
organization_id(optional) - Filter by organizationstatus(optional) - Filter by status (pending, accepted, rejected)type(optional) - Filter by type (incoming, outgoing)
Response:
{
"proposals": [
{
"id": "prop-1",
"from_org_id": "org-1",
"to_org_id": "org-2",
"resource_id": "resource-1",
"resource_type": "input",
"resource_name": "Waste Heat",
"message": "Proposal message...",
"status": "pending",
"created_at": "2024-01-01T00:00:00Z"
}
],
"count": 1
}
Get Proposal
GET /api/proposals/:id
Response:
{
"id": "prop-1",
"from_org_id": "org-1",
"to_org_id": "org-2",
"resource_id": "resource-1",
"resource_type": "input",
"resource_name": "Waste Heat",
"message": "Proposal message...",
"status": "pending",
"created_at": "2024-01-01T00:00:00Z"
}
Create Proposal
POST /api/proposals
Request:
{
"from_org_id": "org-1",
"to_org_id": "org-2",
"resource_id": "resource-1",
"resource_type": "input",
"resource_name": "Waste Heat",
"message": "Proposal message..."
}
Response:
{
"id": "prop-1",
"status": "pending",
"created_at": "2024-01-01T00:00:00Z",
...
}
Update Proposal Status
PUT /api/proposals/:id/status
Request:
{
"status": "accepted" // or "rejected", "pending"
}
Response:
{
"id": "prop-1",
"status": "accepted",
"updated_at": "2024-01-01T00:00:00Z"
}
Get Proposals for Organization
GET /api/proposals/organization/:orgId
Query Parameters:
type(optional) - "incoming" or "outgoing"
Response:
{
"incoming": [...],
"outgoing": [...]
}
Matching Endpoints
Direct Symbiosis Matches
GET /api/matching/organization/:orgId/direct
Response:
{
"providers": [
{
"partner_id": "org-2",
"partner_name": "Partner Corp",
"resource": "Waste Heat",
"resource_flow_id": "flow-1"
}
],
"consumers": [
{
"partner_id": "org-3",
"partner_name": "Consumer Corp",
"resource": "Steam",
"resource_flow_id": "flow-2"
}
]
}
Note: This should use ResourceFlows from the backend, not the old needs/offers model.
Analytics Endpoints
Connection Statistics
GET /api/analytics/connections
Response:
{
"total_connections": 42,
"active_connections": 15,
"potential_connections": 27
}
Supply and Demand Analysis
GET /api/analytics/supply-demand
Response:
{
"top_needs": [
{ "item": "Waste Heat", "count": 12 },
{ "item": "Steam", "count": 8 }
],
"top_offers": [
{ "item": "Cooling Water", "count": 15 },
{ "item": "CO2", "count": 10 }
]
}
Dashboard Statistics
GET /api/analytics/dashboard
Response:
{
"total_organizations": 50,
"total_sites": 75,
"total_resource_flows": 200,
"total_matches": 150,
"active_proposals": 25,
"recent_activity": [...]
}
Organization Endpoints
Search Organizations
GET /api/organizations/search
Query Parameters:
q(optional) - Search querysectors(optional) - Comma-separated sector IDssort(optional) - Sort option (name_asc, name_desc, sector_asc, etc.)limit(optional) - Result limitoffset(optional) - Pagination offset
Response:
{
"organizations": [...],
"count": 10,
"total": 50
}
Similar Organizations
GET /api/organizations/:id/similar
Query Parameters:
limit(optional, default: 5) - Number of results
Response:
{
"organizations": [
{
"id": "org-2",
"name": "Similar Corp",
"sector": "manufacturing",
"similarity_score": 0.85
}
]
}
Implementation Priority
Phase 1 - Critical (Security & Data)
- ✅ Chat endpoints (security)
- ✅ Proposal endpoints (data persistence)
- ✅ Direct symbiosis matching (business logic)
Phase 2 - Important (Performance)
- Analytics endpoints
- Organization search endpoint
- Similar organizations endpoint
Phase 3 - Optimization
- Caching strategies
- Rate limiting
- WebSocket/SSE for real-time updates
Notes
- All endpoints require authentication (Bearer token) except where noted
- Use consistent error response format:
{ "error": "message", "code": "ERROR_CODE" } - Consider pagination for list endpoints
- Add rate limiting for AI endpoints
- Consider caching for analytics endpoints