extremely claude-assisted go game based on atproto! working on cleaning up and giving a more unique design, still has a bit of a slop vibe to it.
Svelte 58.3%
TypeScript 38.8%
CSS 2.0%
JavaScript 0.6%
HTML 0.2%
Astro 0.1%
Shell 0.1%
Other 0.1%
88 7 0

Clone this repository

https://tangled.org/goose.art/cloud-go https://tangled.org/did:plc:hsqwcidfez66lwm3gxhfv5in/cloud-go
git@knot.tangled.wizardry.systems:goose.art/cloud-go git@knot.tangled.wizardry.systems:did:plc:hsqwcidfez66lwm3gxhfv5in/cloud-go

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

Go Game with AT Protocol Integration#

A SvelteKit application that implements the game of Go using the Wgo library, with AT Protocol OAuth authentication and custom lexicons to record game state and moves on the decentralized network.

🚀 Now deployed on Cloudflare Pages! This application runs on Cloudflare's global edge network with D1 database and KV storage.

Features#

  • AT Protocol OAuth: Login with your Bluesky account
  • Custom Lexicons: Game state stored as AT Protocol records
    • boo.sky.go.game - Game records
    • boo.sky.go.move - Move records
    • boo.sky.go.pass - Pass records
  • Wgo.js Integration: Professional Go board rendering and game logic
  • Real-time Updates: Firehose subscription for network-wide game updates
  • Multiple Board Sizes: Support for 9x9, 13x13, and 19x19 boards
  • Edge Deployment: Runs on Cloudflare's global edge network
  • D1 Database: Cloudflare's serverless SQL database for game storage
  • KV Storage: Session and state management with Cloudflare KV

Implementation Status#

This is a demonstration project showing the architecture for integrating a Go game with AT Protocol. The core implementation includes:

Completed:

  • SvelteKit application structure
  • Custom AT Protocol lexicon definitions for games, moves, and passes
  • SQLite database schema with Kysely
  • Wgo.js board component integration
  • Game creation and joining UI
  • Move recording logic
  • Pass functionality
  • Game state management

⚠️ Partially Implemented:

  • OAuth authentication (structure in place, needs full AT Protocol OAuth client setup)
  • AT Protocol record creation (URIs generated, but not actually written to network)
  • Firehose subscription (placeholder implementation provided)

📝 Notes:

  • The application demonstrates the data structures and flow for AT Protocol integration
  • OAuth and record creation are simplified for demo purposes
  • To fully implement, you'll need to properly configure NodeOAuthClient and AtpAgent
  • The Node version (v17.9.0) is below the recommended 18+, which may cause some warnings

Deployment#

This application is optimized for deployment on Cloudflare Pages. See CLOUDFLARE_DEPLOYMENT.md for complete deployment instructions.

Quick steps:

  1. Create D1 database and KV namespaces
  2. Set environment secrets
  3. Deploy via GitHub integration or Wrangler CLI

Migration Notes#

This application has been migrated from Node.js to Cloudflare Workers. See MIGRATION_SUMMARY.md for details on the changes made.

Getting Started#

Prerequisites#

  • Node.js 20+ (required for Cloudflare tooling)
  • npm or pnpm
  • Cloudflare account (for deployment)

Installation#

  1. Clone the repository

  2. Install dependencies:

    npm install
    
  3. Copy the environment file:

    cp .env.example .env
    
  4. Edit .env and update the SESSION_SECRET to a random string:

    DATABASE_PATH=./data/app.db
    SESSION_SECRET=your-random-secret-here
    PUBLIC_BASE_URL=http://localhost:5173
    

Running the Development Server#

npm run dev

The application will be available at http://localhost:5173

Building for Production#

npm run build
npm run preview

How to Play#

  1. Login: Click login and enter your Bluesky handle (e.g., yourname.bsky.social)
  2. Create Game: Choose a board size and create a new game
  3. Wait or Join: Either wait for another player to join your game, or join an existing waiting game
  4. Play: Take turns placing stones on the board
  5. Pass: Click the Pass button if you want to pass your turn
  6. Game End: The game ends when both players pass consecutively

Project Structure#

/src
  /routes
    +page.svelte              # Home page with game list
    +page.server.ts           # Server-side data loading
    +layout.svelte            # Layout wrapper
    /auth
      /login/+server.ts       # OAuth login initiation
      /callback/+server.ts    # OAuth callback handler
      /logout/+server.ts      # Logout handler
    /game/[id]
      +page.svelte            # Game board view
      +page.server.ts         # Game data loading
    /api
      /games
        +server.ts            # Create game API
        /[id]
          /join/+server.ts    # Join game API
          /move/+server.ts    # Record move API
          /pass/+server.ts    # Record pass API
  /lib
    /server
      auth.ts                 # OAuth client setup
      db.ts                   # Database configuration
      firehose.ts             # Firehose subscription
    /components
      Board.svelte            # Wgo board component
  hooks.server.ts             # Server hooks
/lexicons                     # Custom lexicon definitions
  boo.sky.go.game.json
  boo.sky.go.move.json
  boo.sky.go.pass.json
/static
  oauth-client-metadata.json  # OAuth client metadata

Architecture#

Technology Stack#

  • Frontend: SvelteKit 5 with TypeScript
  • Go Engine: Wgo.js (v3.0.0-alpha.10)
  • Authentication: AT Protocol OAuth (@atcute/oauth-node-client)
  • Data Storage: AT Protocol records with custom lexicons
  • Database: Cloudflare D1 (serverless SQLite) with Kysely query builder
  • Session Storage: Cloudflare KV
  • Image Generation: @cf-wasm/resvg (WebAssembly-based)
  • Deployment: Cloudflare Pages with Workers runtime
  • Real-time: AT Protocol Firehose integration

Custom Lexicons#

The application defines three custom AT Protocol lexicons:

  1. boo.sky.go.game: Represents a game between two players
  2. boo.sky.go.move: Represents a stone placement move
  3. boo.sky.go.pass: Represents a pass action

All game data is stored as AT Protocol records, making it decentralized and portable.

Known Limitations#

  • The firehose implementation is a placeholder - full implementation would require WebSocket connection to AT Protocol relay
  • No automatic scoring - game ends on two consecutive passes but doesn't calculate winner
  • OAuth session management is simplified for development (should use proper encryption in production)
  • No time controls or undo functionality
  • Real-time updates require page refresh

Future Enhancements#

  • Automatic territory scoring
  • Game chat/comments using AT Protocol
  • Game history and replay functionality
  • Time controls (byo-yomi, Fischer)
  • Player ranking system
  • SGF (Smart Game Format) export
  • Game analysis tools
  • Spectator mode

Contributing#

This is a demonstration project showing AT Protocol integration with a game application. Feel free to fork and extend!

License#

MIT