Skip to content

Go backend for location tracker#1

Merged
NSchatz merged 20 commits into
mainfrom
feature/go-backend
Apr 1, 2026
Merged

Go backend for location tracker#1
NSchatz merged 20 commits into
mainfrom
feature/go-backend

Conversation

@NSchatz
Copy link
Copy Markdown
Owner

@NSchatz NSchatz commented Apr 1, 2026

Summary

  • Complete Go backend for self-hosted Life360 clone
  • REST API: auth, locations, circles, geofences, FCM tokens, WebSocket
  • PostgreSQL/PostGIS with auto-migrations and spatial queries
  • Real-time location broadcast via WebSocket hub
  • Geofence enter/leave detection with FCM push notifications
  • Docker Compose deployment (PostGIS + Go server)

Test plan

  • Unit tests pass for auth, api, geo, notify, ws packages
  • Integration tests for store layer (PostGIS)
  • End-to-end smoke test via Docker Compose
  • All endpoints verified with curl

🤖 Generated with Claude Code

NSchatz and others added 20 commits April 1, 2026 10:53
Initializes the Go module, minimal HTTP server with health endpoint,
Docker Compose with PostGIS, multi-stage Dockerfile, and supporting
config files (.env.example, .gitignore additions).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds PostGIS-enabled initial migration (users, circles, circle_members,
locations with geography indexes, geofences, schema_migrations) and a
migration runner that applies versioned SQL files transactionally on startup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Defines Go structs for all domain entities with JSON tags, using
google/uuid for IDs and pointer fields for optional location attributes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds CreateUser/GetUserByEmail/GetUserByID on Store, and CreateCircle
(with transaction + admin membership), GetCircleByInviteCode, AddMember
(ON CONFLICT DO NOTHING), GetMembers (JOIN with users), and GetUserCircles.
Integration tests use unique email suffixes for idempotent re-runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add chi-based HTTP server with /auth/register and /auth/login endpoints,
backed by an AuthStore interface for testability, with unit tests using a mock store.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements InsertLocations (bulk insert with ST_MakePoint), GetLatestLocations
(DISTINCT ON per circle member), GetHistory (time-range query), and
DeleteLocationsOlderThan. Adds TestInsertAndQueryLocations integration test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds POST /locations (202), GET /locations/latest, GET /locations/history with
JWT auth middleware. Introduces LocationStore interface on Server. Updates
NewServer signature and existing auth test to pass nil locations store.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add CircleStore interface, circle route handlers (create, join, get members,
get user circles), and update NewServer signature to accept circles store
separately from auth store. Move GetCircleByInviteCode/AddMember from
AuthStore to CircleStore throughout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add CreateGeofence, GetGeofences, UpdateGeofence, DeleteGeofence, and
FindContainingGeofences using ST_DWithin for spatial containment checks.
Add TestGeofenceCRUD integration test covering create, list, update,
spatial query (inside + outside), and delete.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add GeofenceStore interface and wire handleCreateGeofence, handleGetGeofences,
handleUpdateGeofence, handleDeleteGeofence routes. Validate name and
radius_meters > 0 on create. Return 204 on delete.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NSchatz NSchatz merged commit 9e76d36 into main Apr 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant