5.8 KiB
Sojorn Edge Functions - Deployment Guide
All Edge Functions for Sojorn backend are ready to deploy.
Functions Built (13 total)
User Management
- signup - Create user profile + initialize trust state
- profile - Get/update user profiles
- follow - Follow/unfollow users
- block - Block/unblock users (one-tap, silent)
Content Publishing
- publish-post - Create posts with tone detection
- publish-comment - Create comments (mutual-follow only)
Engagement
- appreciate - Appreciate posts (boost-only, no downvotes)
- save - Save/unsave posts (private bookmarks)
- report - Report content/users
Feeds
- feed-personal - Chronological feed from follows
- feed-sojorn - Algorithmic FYP with authentic engagement
- trending - Category-scoped trending
System
- 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)
# 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
# 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{ "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{ "display_name": "New Name", "bio": "New bio" } -
POST /follow- Follow user{ "user_id": "uuid" } -
DELETE /follow- Unfollow user -
POST /block- Block user{ "user_id": "uuid" } -
DELETE /block- Unblock user
Content
-
POST /publish-post- Create post{ "category_id": "uuid", "body": "Post content" } -
POST /publish-comment- Create comment{ "post_id": "uuid", "body": "Comment content" }
Engagement
-
POST /appreciate- Appreciate post{ "post_id": "uuid" } -
DELETE /appreciate- Remove appreciation -
POST /save- Save post{ "post_id": "uuid" } -
DELETE /save- Unsave post -
POST /report- Report content/user{ "target_type": "post|comment|profile", "target_id": "uuid", "reason": "Detailed reason (10-500 chars)" }
Feeds
GET /feed-personal?limit=50&offset=0- Personal feedGET /feed-sojorn?limit=50&offset=0- For You PageGET /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
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
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
# 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 friendly post on Sojorn."
}'
4. Get personal feed
curl "https://zwkihedetedlatyvplyz.supabase.co/functions/v1/feed-personal" \
-H "Authorization: Bearer $TOKEN"
Next Steps
- Deploy Edge Functions (use npx method above)
- Set CRON_SECRET for harmony calculation:
npx supabase secrets set CRON_SECRET="s2jSNk6RWyTNVo91RlV/3o2yv3HZPj4TvaTrL9bqbH0=" - Test the full flow (signup → post → appreciate → comment)
- Build Flutter client
- Schedule harmony cron job
Friendly Microcopy
All functions include friendly, 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 friendly, structural moderation from day one.