1.6 KiB
1.6 KiB
Sojorn Backend Engine (Golang)
Production-grade Golang backend migrated from Supabase Edge Functions.
Tech Stack
- Language: Go 1.21+
- Framework: Gin Gonic
- Database: PostgreSQL with PostGIS
- Auth: JWT (compatible with Supabase)
- Logging: Zerolog
- Deployment: Docker / Systemd
Getting Started
Prerequisites
- Go 1.21 or higher
- PostgreSQL 15+ with PostGIS extension
golang-migrateCLI (for migrations)
Setup
- Clone the repository
- Copy
.env.exampleto.envand fill in your details:cp .env.example .env - Install dependencies:
go mod download - Run migrations:
make migrate-up
Running Locally
go run cmd/api/main.go
The server will start on http://localhost:8080.
API Documentation
Auth & Profiles
POST /api/v1/signup: Complete profile creation after authGET /api/v1/profiles/:id: Get user profileGET /api/v1/profile: Get current user profile
Posts & Feed
POST /api/v1/posts: Create a new post or beaconGET /api/v1/feed: Get personal feed
Deployment
Using Systemd (Ubuntu/Debian)
- Edit
scripts/deploy.shwith your VPS details. - Run the deployment script:
./scripts/deploy.sh
Using Docker
docker build -t sojorn-api .
docker run -p 8080:8080 --env-file .env sojorn-api
Migration Notes
- RLS policies have been moved to application-level middleware.
- Supabase-specific triggers for metrics are maintained in SQL migrations.
- E2EE session management is ported to handlers/services.