Solo-friendly location discovery platform - Find the perfect spots for your alone time
Bocchi The Map is a modern, location-based review platform specifically designed for solo activities. Built with clean architecture principles and cloud-native technologies to scale effortlessly from MVP to millions of users.
In our hyper-connected world, quality alone time is increasingly valuable. This platform helps people discover cafes, libraries, parks, and other venues that are genuinely comfortable for solo experiences - solving a real problem with elegant technology.
- π― Solo-optimized discovery - Purpose-built for individual experiences
- π Global scalability - Multi-country support with i18n-first design
- β‘ Real-time performance - Sub-200ms API responses with edge caching
- π Privacy-first - Secure user authentication with OAuth integration
- π± Progressive Web App - Native-like experience across all devices
- π Accessible design - Dark mode, screen reader support, WCAG compliance
Modern, scalable monorepo designed for microservice evolution:
π¦ bocchi-the-map/
βββ π api/ # Go + Huma (Onion Architecture)
βββ π¨ web/ # Next.js 15 + TypeScript
βββ βοΈ infra/ # Terraform (Multi-cloud)
βββ π docs/ # Architecture decisions & guides
Layer | Technology | Why |
---|---|---|
Frontend | Next.js 15 + TypeScript | App Router, Turbopack, React Server Components |
Backend | Go + Huma + Protocol Buffers | Type-safe APIs, auto-generated OpenAPI docs, protobuf-driven contracts |
Database | TiDB Serverless | MySQL-compatible, auto-scaling, built for cloud |
Maps | MapLibre GL JS | Open-source, vector tiles, highly customizable |
Storage | Cloudflare R2 | PMTiles format for efficient map delivery |
Hosting | Cloud Run + Vercel | Auto-scaling, edge distribution |
Monitoring | New Relic + Sentry | APM, error tracking, performance insights |
DevOps | Terraform + GitHub Actions | Infrastructure as Code, automated deployments |
# Required
go install golang.org/dl/go1.24@latest # Go 1.24+
node --version # Node.js 20+
terraform --version # Terraform 1.5+
# Package managers
npm install -g pnpm # pnpm (preferred over npm)
# Recommended
go install github.com/cosmtrek/air@latest # Hot reload
go install github.com/onsi/ginkgo/v2/ginkgo@latest # BDD testing
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest # Type-safe SQL
# Clone and setup
git clone https://github.com/necofuryai/bocchi-the-map.git
cd bocchi-the-map
# Backend (Terminal 1)
cd api
make deps && make proto # Install deps + generate type-safe code from .proto files
make dev # Starts on :8080 with hot reload
# Frontend (Terminal 2)
cd web
pnpm install # Auto-installs Playwright for E2E tests
pnpm dev # Starts on :3000 with Turbopack
# Visit http://localhost:3000 π
The project uses environment-specific database initialization files:
- Development/Testing:
init-test.sql
- Used automatically withdocker-compose up
- Production:
init-production.sql
- Used with production docker-compose configuration
# Start database for development/testing
docker-compose up -d
# Start database for production
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
The database configuration supports both local development and production environments with appropriate schema initialization for each context.
# API testing (BDD with Ginkgo)
cd api
make test # Run all tests
ginkgo -r # Run BDD specs
# Web testing
cd web
pnpm test # Unit tests
pnpm test:e2e # E2E tests
π§
Onion Architecture Layers:
βββ π Domain # Pure business logic, zero dependencies
βββ π Application # Use cases, orchestrates domain
βββ π Infrastructure # Database, external APIs
βββ π Interfaces # HTTP handlers, middleware
Key Benefits:
- Testable - Domain logic isolated from infrastructure
- Scalable - Ready for microservice extraction
- Maintainable - Clear dependency boundaries
- Type-safe - β Protocol Buffers fully implemented - All manual structs replaced with generated code
- App Router - File-based routing with layouts
- Server Components - Zero-JS components by default
- Streaming SSR - Progressive page hydration
- Edge Runtime - Deploy anywhere, run everywhere
- Multi-cloud ready - Abstract provider interfaces
- Auto-scaling - Zero to millions with no config changes
- Cost-optimized - Pay only for actual usage
- Observability - Structured logging, metrics, tracing
Metric | Target | Current |
---|---|---|
API Response Time | < 200ms p95 | π― |
Page Load Time | < 1.5s | π― |
Lighthouse Score | > 95 | π― |
Bundle Size | < 200kb | π― |
cd api
make proto # Generate type-safe Go code from .proto files
make test # Run test suite (BDD with Ginkgo)
make build # Build production binary
make docs # Generate OpenAPI spec from protobuf definitions
Protocol Buffers Development Workflow:
- Define API contracts - Edit
.proto
files inproto/
directory - Generate code - Run
make proto
to generate Go structs and gRPC clients - Implement services - Use generated types in
infrastructure/grpc/
services - Update handlers - HTTP handlers automatically convert to/from protobuf types
- Test & validate - Type safety enforced at compile time
cd web
pnpm dev # Dev server with Turbopack
pnpm build # Production build
pnpm lint # ESLint + TypeScript checking
pnpm test # Unit/component tests with Vitest
pnpm test:ui # Vitest with UI mode
pnpm test:coverage # Tests with coverage report
pnpm test:e2e # E2E tests with Playwright
pnpm test:e2e:ui # Playwright with UI mode
cd infra
terraform init # Initialize providers
terraform plan # Preview changes
terraform apply # Deploy infrastructure
- GitHub Actions - Test, build, deploy pipeline
- Branch Protection - PR reviews, status checks required
- Preview Deployments - Every PR gets a live environment
- Blue/Green Deploys - Zero-downtime production updates
# Deploy to staging
make deploy-staging
# Deploy to production (requires approval)
make deploy-production
# Install and configure Google Cloud CLI
gcloud auth login
# Get your Google Cloud project ID (if you don't know it)
gcloud config get-value project
# Or list all projects: gcloud projects list
# Set your project ID (replace with your actual project ID)
gcloud config set project YOUR_PROJECT_ID
# Configure Docker for Google Container Registry
gcloud auth configure-docker
cd api
# Build and push Docker image
./scripts/build.sh dev YOUR_PROJECT_ID asia-northeast1
# Or manual steps:
docker build -t gcr.io/YOUR_PROJECT_ID/bocchi-api:latest .
docker push gcr.io/YOUR_PROJECT_ID/bocchi-api:latest
# Deploy with Terraform
cd ../infra
terraform init
terraform apply -var="gcp_project_id=YOUR_PROJECT_ID"
# Set required secrets in Google Secret Manager
# Note: You need to provide the actual secret values from your environment
# Example methods to provide secrets:
# 1. From environment variables: echo "$TIDB_PASSWORD" | gcloud secrets create tidb-password-dev --data-file=-
# 2. From file: gcloud secrets create tidb-password-dev --data-file=path/to/secret.txt
# 3. Interactive input (type secret and press Ctrl+D) - Recommended for security:
gcloud secrets create tidb-password-dev --data-file=-
gcloud secrets create new-relic-license-key-dev --data-file=-
gcloud secrets create sentry-dsn-dev --data-file=-
# Deploy Cloud Run service
gcloud run deploy bocchi-api-dev \
--image=gcr.io/YOUR_PROJECT_ID/bocchi-api:latest \
--platform=managed \
--region=asia-northeast1 \
--allow-unauthenticated
- π API Documentation - Onion architecture guide
- π¨ Frontend Guide - React patterns & components
- βοΈ Infrastructure Docs - Terraform modules & deployment
- ποΈ Architecture Decisions - Technical choices & rationale
- MVP - Core spot discovery and reviews β
- Authentication System - Auth0 + JWT with enterprise security β
- Production Infrastructure - Cloud Run + monitoring β
- Huma v2 Integration - Type-safe APIs with auto-docs β
- Protocol Buffers Migration - Full protobuf implementation with generated code β
- Social Features - Follow users, curated lists
- AI Recommendations - ML-powered spot suggestions
- Mobile App - React Native with shared business logic
- API v2 - GraphQL federation for microservices
β Protocol Buffers Migration Completed π
- Full Implementation: All manual struct definitions replaced with generated Protocol Buffers code
- Type Safety: 100% compile-time contract validation across all services (User, Spot, Review)
- Zero Breaking Changes: Seamless migration preserving existing API behavior
- Performance: Binary serialization for internal service communication
- Multi-Language Ready: Shared contracts enable future TypeScript client generation
Previous Database Migration & CI/CD Improvements (2025-06-29) π§
- Migration Fixes: Resolved idx_location index conflicts in reviews table migrations
- GitHub Actions: Enhanced BDD test security with database URL consistency and debug logging
- Production Ready: All migration files synchronized between development and production
- CI Stability: Improved test environment setup with better error handling and security measures
Previous Security Update (2025-06-28) π¨
- Issue: Huma v2 authentication middleware had silent context propagation failure
- Impact: Protected API endpoints were not properly authenticating users
- Resolution: Implemented proper
huma.WithValue()
context handling pattern - Status: β All authentication systems now fully functional and production-ready
Enhanced Security Features:
- β Proper JWT token validation and user context propagation
- β
Protected endpoints (
/api/v1/users/me
, preferences, reviews) secured - β Auth0 Universal Login with comprehensive OAuth provider support
- β Microservice-ready authentication architecture
- π New Relic - Application performance monitoring, custom metrics, distributed tracing
- π¨ Sentry - Error tracking, performance insights, real-time alerting
- π Structured Logging - JSON logs with correlation IDs, centralized via Cloud Logging
- π Health Checks - Kubernetes-ready probes with dependency validation
- Performance: API response times (p50, p95, p99), throughput, error rates
- Business: Spot discoveries, review submissions, user engagement patterns
- Infrastructure: Memory usage, CPU utilization, database connection pools
- User Experience: Page load times, frontend errors, conversion funnels
# Health check
curl https://api.bocchi-map.com/health
# Detailed system status
curl https://api.bocchi-map.com/health/detailed
# Metrics (Prometheus format)
curl https://api.bocchi-map.com/metrics
# Example metrics output:
# HELP http_requests_total Total number of HTTP requests
# TYPE http_requests_total counter
http_requests_total{method="GET",endpoint="/api/spots",status="200"} 1234
http_requests_total{method="POST",endpoint="/api/reviews",status="201"} 567
# HELP http_request_duration_seconds HTTP request duration in seconds
# TYPE http_request_duration_seconds histogram
http_request_duration_seconds_bucket{method="GET",endpoint="/api/spots",le="0.1"} 800
http_request_duration_seconds_bucket{method="GET",endpoint="/api/spots",le="0.5"} 1200
http_request_duration_seconds_sum{method="GET",endpoint="/api/spots"} 145.67
http_request_duration_seconds_count{method="GET",endpoint="/api/spots"} 1234
- Critical Alerts: > 5% error rate, > 2s p95 latency, dependency failures
- Escalation: Slack notifications β PagerDuty β On-call engineer
- Runbooks: Automated remediation for common issues
MIT License - see LICENSE for details.
Built with β€οΈ for the solo explorers
π Star this repo β’ π Report Bug β’ π‘ Request Feature