Skip to content

FACorreiaa/loci-proto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Loci Proto – gRPC Protocol Definitions πŸ”„βœ¨

This repository contains the Protocol Buffer (protobuf) definitions for Loci's microservices architecture. These proto files define the gRPC services and message types that power Loci's AI-driven personalized city discovery platform.

πŸš€ About Loci

Loci is a smart, mobile-first web application delivering hyper-personalized city exploration recommendations based on user interests, time, location, and an evolving AI engine. It combines advanced AI personalization with real-time streaming capabilities to provide contextual, intelligent city discovery experiences.

Core Value Proposition

Tired of generic city guides? Loci learns your preferences (history, food, art, etc.) and combines them with your available time and location to suggest the perfect spots, activities, and restaurants.

πŸ“ Repository Structure

go-ai-poi-proto/
β”œβ”€β”€ proto/                    # Protocol Buffer definitions
β”‚   β”œβ”€β”€ auth.proto           # Authentication & authorization
β”‚   β”œβ”€β”€ chat.proto           # AI-powered chat with streaming
β”‚   β”œβ”€β”€ poi.proto            # Points of interest discovery
β”‚   β”œβ”€β”€ user.proto           # User profiles & preferences
β”‚   β”œβ”€β”€ list.proto           # Lists & itinerary management
β”‚   β”œβ”€β”€ city.proto           # City information & statistics
β”‚   β”œβ”€β”€ statistics.proto     # Analytics with real-time streaming
β”‚   β”œβ”€β”€ recents.proto        # Recent user interactions
β”‚   β”œβ”€β”€ review.proto         # Reviews & ratings system
β”‚   β”œβ”€β”€ common.proto         # Shared types & utilities
β”‚   └── ai_poi_service.proto # Main API gateway service
β”œβ”€β”€ modules/                 # Generated gRPC modules
β”œβ”€β”€ container/               # Dependency injection
β”œβ”€β”€ core/                    # Core gRPC infrastructure
└── utils/                   # Connection & transport utilities

🌟 Key Features

πŸ”„ Streaming Services

  • AI Chat Streaming: Real-time conversation with Gemini-powered AI assistant
  • Live Statistics: Real-time metrics and analytics updates
  • Progressive Results: Streaming discovery results for better UX

🧠 AI-Powered Services

  • Semantic Search: Vector embeddings with PostgreSQL pgvector
  • Personalized Recommendations: Based on user preferences and behavior
  • Contextual Filtering: Time, location, interests, and availability-aware
  • Smart Itinerary Planning: AI-generated travel plans

πŸ—ΊοΈ Core Discovery Services

  • Multi-Domain Search: POIs, restaurants, hotels, attractions
  • Geospatial Queries: PostGIS-powered location services
  • Hybrid Search: Combines spatial and semantic search
  • Real-time Filtering: Opening hours, distance, rating, price

πŸ”§ Service Architecture

graph TB
    Gateway[AI POI Gateway] --> Auth[AuthService]
    Gateway --> Chat[ChatService - STREAMING]
    Gateway --> POI[POIService]
    Gateway --> User[UserService]
    Gateway --> List[ListService]
    Gateway --> City[CityService]
    Gateway --> Stats[StatisticsService - STREAMING]
    Gateway --> Recents[RecentsService]
    Gateway --> Review[ReviewService]
    
    Chat -.->|Server-Sent Events| Client[Web/Mobile Clients]
    Stats -.->|Real-time Updates| Client
    
    subgroup Backend Services
        Auth --> DB[(PostgreSQL + PostGIS)]
        POI --> DB
        Chat --> Gemini[Google Gemini API]
        POI --> Vector[pgvector Embeddings]
    end
Loading

πŸ› οΈ Technology Integration

Backend Stack Compatibility

  • Go Backend: go-ai-poi-server with Chi/Gin Gonic routers
  • Database: PostgreSQL with PostGIS for geospatial queries
  • AI Engine: Google Gemini API integration via google/generative-ai-go
  • Vector Search: PostgreSQL with pgvector extension
  • Authentication: JWT tokens with Goth package for social logins

Frontend Integration

  • Web: SvelteKit client (go-ai-poi-client)
  • Mobile: iOS app (go-ai-poi-ios) and Angular PWA (go-ai-poi-ng)
  • Real-time: Server-Sent Events (SSE) for streaming responses

πŸ“‘ Streaming Implementation

Chat Service Streaming

service ChatService {
  // Real-time AI conversations
  rpc StartChatStream(StartChatRequest) returns (stream ChatEvent);
  rpc ContinueChatStream(ContinueChatRequest) returns (stream ChatEvent);
  rpc FreeChatStream(FreeChatRequest) returns (stream ChatEvent);
}

Statistics Service Streaming

service StatisticsService {
  // Live metrics updates
  rpc StreamMainPageStatistics(StreamMainPageStatisticsRequest) returns (stream StatisticsEvent);
}

πŸ” Authentication & Security

  • JWT-based Authentication: Secure token-based auth
  • Social Login Support: Google, Facebook, Apple integration
  • Role-based Access: User, premium, admin permissions
  • Rate Limiting: Built-in request throttling
  • Input Validation: Comprehensive request validation

πŸ’° Business Model Integration

Freemium Features

  • Free Tier: Core recommendations, basic filters, limited saves
  • Premium Tier: Enhanced AI, advanced filters, unlimited saves, offline access

Monetization Endpoints

  • Partnership APIs: Booking referrals, commission tracking
  • Featured Listings: Premium business visibility
  • Analytics APIs: Anonymized trend data for tourism boards

πŸš€ Getting Started

Prerequisites

# Install Protocol Buffer Compiler
brew install protobuf  # macOS
# or
apt-get install protobuf-compiler  # Ubuntu

# Install Go plugins
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

Code Generation

# Generate Go code from proto files
make generate

# Or manually:
protoc --go_out=. --go_opt=paths=source_relative \
       --go-grpc_out=. --go-grpc_opt=paths=source_relative \
       proto/*.proto

Development Setup

# Clone the repository
git clone https://github.com/your-org/go-ai-poi-proto.git
cd go-ai-poi-proto

# Install dependencies
go mod tidy

# Run tests
go test ./...

# Build modules
make build

πŸ“Š API Coverage

Service Endpoints Streaming Description
AuthService 8 ❌ Authentication, OAuth, JWT management
ChatService 7 βœ… AI chat, itinerary planning, streaming
POIService 15 ❌ Discovery, search, recommendations
UserService 20 ❌ Profiles, preferences, interests, tags
ListService 15 ❌ Lists, itineraries, favorites
CityService 4 ❌ City data, statistics, search
StatisticsService 6 βœ… Analytics, metrics, real-time updates
RecentsService 5 ❌ User activity, interaction history
ReviewService 10 ❌ Reviews, ratings, business responses

Total: 90+ gRPC endpoints covering the entire Loci platform

🌍 Multi-Client Support

Web Client (go-ai-poi-client)

  • SvelteKit with TypeScript
  • Real-time chat interface
  • Progressive discovery results
  • Mobile-responsive design

iOS App (go-ai-poi-ios)

  • Swift with SwiftUI
  • Native gRPC integration
  • Offline-first architecture
  • Push notifications

πŸ”„ Migration from REST

This protobuf repository supports the migration from REST to gRPC:

Phase 1: Hybrid Architecture

  • REST endpoints remain active
  • gRPC services run in parallel
  • Gradual client migration

Phase 2: Streaming Features

  • Chat streaming via gRPC
  • Real-time statistics
  • Progressive loading

Phase 3: Full Migration

  • Complete REST deprecation
  • Pure gRPC architecture
  • Enhanced performance

πŸ§ͺ Development & Testing

Proto Validation

# Validate proto files
buf lint proto/
buf breaking proto/ --against .git#branch=main

Service Testing

# Test gRPC services
grpcurl -plaintext localhost:9090 list
grpcurl -plaintext -d '{"message": "Hello"}' localhost:9090 ai_poi.chat.v1.ChatService/FreeChatStream

Load Testing

# Performance testing
ghz --insecure \
    --proto proto/chat.proto \
    --call ai_poi.chat.v1.ChatService.StartChatStream \
    --data '{"user_id":"test","initial_message":"Hello"}' \
    localhost:9090

πŸ“‹ Roadmap

Phase 1 (Current)

  • Core service definitions
  • Authentication & user management
  • Basic POI discovery
  • Chat streaming implementation

Phase 2 (In Progress)

  • Advanced AI features (embeddings, semantic search)
  • Multi-language support
  • Enhanced analytics
  • Business partnership APIs

Phase 3 (Planned)

  • Voice interface integration
  • Augmented reality features
  • Multi-city expansion
  • Real-time collaborative planning

🀝 Contributing

We welcome contributions to improve Loci's gRPC definitions!

Guidelines

  1. Follow protobuf best practices
  2. Maintain backward compatibility
  3. Add comprehensive documentation
  4. Include validation rules
  5. Write tests for new services

Pull Request Process

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and validation
  5. Submit a pull request

πŸ“„ License

This project is part of the Loci ecosystem. License details coming soon.


πŸ”— Related Repositories


Built with ❀️ for intelligent city discovery

About

proto files for loci

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published