Skip to content

jaredzwick/sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sync

A Go API service that connects to Google Calendar, detects scheduling intent from natural language messages, and finds available meeting slots.

What It Does

  • Ingests messages from email, text, Slack, etc. via a REST endpoint
  • Parses natural language for scheduling intent ("let's sync Tuesday", "schedule a call this week")
  • Queries Google Calendar free/busy data to find open slots within work hours
  • OAuth2 flow for Google account linking with token persistence in Postgres

Architecture

                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  POST /v1/messageβ”‚              β”‚
  ───────────────►│   Huma API   β”‚
                  β”‚   (chi)      β”‚
                  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                     β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚    Schedule      β”‚  β”‚    Google        β”‚
     β”‚    Intent NLP    β”‚  β”‚    Calendar API  β”‚
     β”‚                  β”‚  β”‚    (Free/Busy)   β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚   Postgres       β”‚
                          β”‚   (users/tokens) β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Stack

  • Go with Cobra CLI, Chi router, Huma API framework
  • Postgres via pgx connection pool
  • Google Calendar API with OAuth2
  • Redis for caching
  • Docker Compose for local dev with hot reload (CompileDaemon)

Getting Started

Prerequisites

  • Go 1.20+
  • Docker & Docker Compose
  • Google OAuth credentials (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET)

Run Locally

# Set required env vars
export GOOGLE_CLIENT_ID=your-client-id
export GOOGLE_CLIENT_SECRET=your-client-secret

# Start Postgres, Redis, and the API
docker compose up

The API starts on http://localhost:8888.

Build From Source

# Build for your platform
make native

# Build for all platforms (linux/darwin, amd64/arm64)
make all

# Run
./bin/syncron serve

API

Method Endpoint Description
POST /v1/message Send a message, get scheduling analysis back
GET /v1/greeting/{name} Health check / greeting
GET /login-here Start Google OAuth flow
GET /callback OAuth callback (stores tokens)

Example

curl -X POST http://localhost:8888/v1/message \
  -H "Content-Type: application/json" \
  -d '{"message": "let'\''s schedule a sync on Thursday"}'
{"message": "The meeting is scheduled 2 days from now."}

Project Structure

β”œβ”€β”€ main.go              # CLI entrypoint (Cobra)
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ server.go        # HTTP server, routes, OAuth handlers
β”‚   └── db.go            # Postgres connection pool
β”œβ”€β”€ schedule/
β”‚   β”œβ”€β”€ schedule.go      # Intent detection & day parsing
β”‚   └── google.go        # Google Calendar OAuth & free/busy queries
β”œβ”€β”€ migrations/
β”‚   └── 001_init.up.sql  # Users table with OAuth token storage
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ docker-compose.yaml
└── Makefile             # Cross-platform build targets

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors