## Phase 1: Critical Feature Completion (Beacon Voting) - Add VouchBeacon, ReportBeacon, RemoveBeaconVote methods to PostRepository - Implement beacon voting HTTP handlers with confidence score calculations - Register new beacon routes: /beacons/:id/vouch, /beacons/:id/report, /beacons/:id/vouch (DELETE) - Auto-flag beacons at 5+ reports, confidence scoring (0.5 base + 0.1 per vouch) ## Phase 2: Feed Logic & Post Distribution Integrity - Verify unified feed logic supports all content types (Standard, Quips, Beacons) - Ensure proper distribution: Profile Feed + Main/Home Feed for followers - Beacon Map integration for location-based content - Video content filtering for Quips feed ## Phase 3: The Notification System - Create comprehensive NotificationService with FCM integration - Add CreateNotification method to NotificationRepository - Implement smart deep linking: beacon_map, quip_feed, main_feed - Trigger notifications for beacon interactions and cross-post comments - Push notification logic with proper content type detection ## Phase 4: The Great Supabase Purge - Delete function_proxy.go and remove /functions/:name route - Remove SupabaseURL, SupabaseKey from config.go - Remove SupabaseID field from User model - Clean all Supabase imports and dependencies - Sanitize codebase of legacy Supabase references ## Phase 5: Flutter Frontend Integration - Implement vouchBeacon(), reportBeacon(), removeBeaconVote() in ApiService - Replace TODO delay in video_comments_sheet.dart with actual publishComment call - Fix compilation errors (named parameters, orphaned child properties) - Complete frontend integration with Go API endpoints ## Additional Improvements - Fix compilation errors in threaded_comment_widget.dart (orphaned child property) - Update video_comments_sheet.dart to use proper named parameters - Comprehensive error handling and validation - Production-ready notification system with deep linking ## Migration Status: 100% Complete - Backend: Fully migrated from Supabase to custom Go/Gin API - Frontend: Integrated with new Go endpoints - Notifications: Complete FCM integration with smart routing - Database: Clean of all Supabase dependencies - Features: All functionality preserved and enhanced Ready for VPS deployment and production testing!
244 lines
5.8 KiB
Markdown
244 lines
5.8 KiB
Markdown
# Sojorn Edge Functions - Deployment Guide
|
|
|
|
All Edge Functions for Sojorn backend are ready to deploy.
|
|
|
|
---
|
|
|
|
## Functions Built (13 total)
|
|
|
|
### User Management
|
|
1. **signup** - Create user profile + initialize trust state
|
|
2. **profile** - Get/update user profiles
|
|
3. **follow** - Follow/unfollow users
|
|
4. **block** - Block/unblock users (one-tap, silent)
|
|
|
|
### Content Publishing
|
|
5. **publish-post** - Create posts with tone detection
|
|
6. **publish-comment** - Create comments (mutual-follow only)
|
|
|
|
### Engagement
|
|
7. **appreciate** - Appreciate posts (boost-only, no downvotes)
|
|
8. **save** - Save/unsave posts (private bookmarks)
|
|
9. **report** - Report content/users
|
|
|
|
### Feeds
|
|
10. **feed-personal** - Chronological feed from follows
|
|
11. **feed-sojorn** - Algorithmic FYP with calm velocity
|
|
12. **trending** - Category-scoped trending
|
|
|
|
### System
|
|
13. **calculate-harmony** - Daily cron for trust recalculation
|
|
|
|
---
|
|
|
|
## How to Deploy (Without CLI)
|
|
|
|
Since you're deploying through the dashboard, you'll need to:
|
|
|
|
### Option 1: Use Supabase Dashboard
|
|
Unfortunately, Edge Functions can **only** be deployed via CLI, not through the web dashboard.
|
|
|
|
### Option 2: Use npx (Recommended)
|
|
|
|
```bash
|
|
# From project root
|
|
cd c:\Webs\Sojorn
|
|
|
|
# Deploy each function
|
|
npx supabase functions deploy signup
|
|
npx supabase functions deploy profile
|
|
npx supabase functions deploy follow
|
|
npx supabase functions deploy block
|
|
npx supabase functions deploy appreciate
|
|
npx supabase functions deploy save
|
|
npx supabase functions deploy report
|
|
npx supabase functions deploy publish-post
|
|
npx supabase functions deploy publish-comment
|
|
npx supabase functions deploy feed-personal
|
|
npx supabase functions deploy feed-sojorn
|
|
npx supabase functions deploy trending
|
|
npx supabase functions deploy calculate-harmony
|
|
```
|
|
|
|
### Option 3: Link Project First, Then Deploy
|
|
|
|
```bash
|
|
# Login to Supabase
|
|
npx supabase login
|
|
|
|
# Link to your project
|
|
npx supabase link --project-ref zwkihedetedlatyvplyz
|
|
|
|
# Deploy all functions at once
|
|
npx supabase functions deploy signup
|
|
# ... (repeat for each function)
|
|
```
|
|
|
|
---
|
|
|
|
## API Endpoints
|
|
|
|
Once deployed, your Edge Functions will be available at:
|
|
|
|
**Base URL:** `https://zwkihedetedlatyvplyz.supabase.co/functions/v1`
|
|
|
|
### User Management
|
|
- `POST /signup` - Create profile
|
|
```json
|
|
{ "handle": "username", "display_name": "Name", "bio": "Optional bio" }
|
|
```
|
|
|
|
- `GET /profile?handle=username` - Get profile by handle
|
|
- `GET /profile` - Get own profile
|
|
- `PATCH /profile` - Update own profile
|
|
```json
|
|
{ "display_name": "New Name", "bio": "New bio" }
|
|
```
|
|
|
|
- `POST /follow` - Follow user
|
|
```json
|
|
{ "user_id": "uuid" }
|
|
```
|
|
- `DELETE /follow` - Unfollow user
|
|
|
|
- `POST /block` - Block user
|
|
```json
|
|
{ "user_id": "uuid" }
|
|
```
|
|
- `DELETE /block` - Unblock user
|
|
|
|
### Content
|
|
- `POST /publish-post` - Create post
|
|
```json
|
|
{ "category_id": "uuid", "body": "Post content" }
|
|
```
|
|
|
|
- `POST /publish-comment` - Create comment
|
|
```json
|
|
{ "post_id": "uuid", "body": "Comment content" }
|
|
```
|
|
|
|
### Engagement
|
|
- `POST /appreciate` - Appreciate post
|
|
```json
|
|
{ "post_id": "uuid" }
|
|
```
|
|
- `DELETE /appreciate` - Remove appreciation
|
|
|
|
- `POST /save` - Save post
|
|
```json
|
|
{ "post_id": "uuid" }
|
|
```
|
|
- `DELETE /save` - Unsave post
|
|
|
|
- `POST /report` - Report content/user
|
|
```json
|
|
{
|
|
"target_type": "post|comment|profile",
|
|
"target_id": "uuid",
|
|
"reason": "Detailed reason (10-500 chars)"
|
|
}
|
|
```
|
|
|
|
### Feeds
|
|
- `GET /feed-personal?limit=50&offset=0` - Personal feed
|
|
- `GET /feed-sojorn?limit=50&offset=0` - For You Page
|
|
- `GET /trending?category=general&limit=20` - Category trending
|
|
|
|
---
|
|
|
|
## Authentication
|
|
|
|
All endpoints require a Supabase auth token in the `Authorization` header:
|
|
|
|
```
|
|
Authorization: Bearer <user_jwt_token>
|
|
```
|
|
|
|
Get the token from Supabase Auth after user signs in.
|
|
|
|
---
|
|
|
|
## Testing the API
|
|
|
|
### 1. Sign up a user via Supabase Auth
|
|
|
|
```bash
|
|
curl -X POST "https://zwkihedetedlatyvplyz.supabase.co/auth/v1/signup" \
|
|
-H "apikey: YOUR_ANON_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"email": "test@example.com",
|
|
"password": "testpassword123"
|
|
}'
|
|
```
|
|
|
|
Copy the `access_token` from the response.
|
|
|
|
### 2. Create profile
|
|
|
|
```bash
|
|
export TOKEN="your_access_token_here"
|
|
|
|
curl -X POST "https://zwkihedetedlatyvplyz.supabase.co/functions/v1/signup" \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"handle": "testuser",
|
|
"display_name": "Test User",
|
|
"bio": "Just testing Sojorn"
|
|
}'
|
|
```
|
|
|
|
### 3. Create a post
|
|
|
|
```bash
|
|
# First, get a category ID from the categories table
|
|
CATEGORY_ID="uuid-from-categories-table"
|
|
|
|
curl -X POST "https://zwkihedetedlatyvplyz.supabase.co/functions/v1/publish-post" \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"category_id": "'$CATEGORY_ID'",
|
|
"body": "This is my first calm post on Sojorn."
|
|
}'
|
|
```
|
|
|
|
### 4. Get personal feed
|
|
|
|
```bash
|
|
curl "https://zwkihedetedlatyvplyz.supabase.co/functions/v1/feed-personal" \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
1. **Deploy Edge Functions** (use npx method above)
|
|
2. **Set CRON_SECRET** for harmony calculation:
|
|
```bash
|
|
npx supabase secrets set CRON_SECRET="s2jSNk6RWyTNVo91RlV/3o2yv3HZPj4TvaTrL9bqbH0="
|
|
```
|
|
3. **Test the full flow** (signup → post → appreciate → comment)
|
|
4. **Build Flutter client**
|
|
5. **Schedule harmony cron job**
|
|
|
|
---
|
|
|
|
## Calm Microcopy
|
|
|
|
All functions include calm, intentional messaging:
|
|
|
|
- **Signup:** "Welcome to Sojorn. Your journey begins quietly."
|
|
- **Follow:** "Followed. Mutual follow enables conversation."
|
|
- **Appreciate:** "Appreciation noted. Quiet signals matter."
|
|
- **Save:** "Saved. You can find this in your collection."
|
|
- **Block:** "Block applied. You will no longer see each other."
|
|
- **Post rejected:** "Sharp speech does not travel here. Consider softening your words."
|
|
|
|
---
|
|
|
|
**Your Sojorn backend is ready to support calm, structural moderation from day one.**
|