Atproto cohost clone/tribute

README.md

posting #

Atproto cohost clone/tribute

contributing #

  • current development status: it works. tons of room for improvement, but i'm kinda done with this.
  • pnpm project
  • use semantic commits (feat:, fix:, chore:, etc)
  • no rate limiting yet
  • search functionality is explicitly out of scope to match cohost itself
  • for development, set OAUTH_PUBLIC_CLIENT to true
    • if you want to test our confedential oauth clients, you need a publicly accessible url, so tunnel it with a service like ngrok or cloudflare tunnel
    • e.g. ngrok http --url=my-cool-url.ngrok-free.dev 3000

quick start #

  • edit env

    • copy example.env to .env
    • edit .env
    • run node scripts/generate-key.mjs
  • start app

    • docker compose up - for development
    • docker compose -f compose.yaml up - for production

running without docker #

  • start postgres

    • e.g. docker run -d --name posting-db -e POSTGRES_DB=posting -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -v /home/idk/posting/pg-database/:/var/lib/postgresql/data --replace postgres:16
  • start tap

    • git clone https://github.com/bluesky-social/indigo && cd indigo
    • TAP_SIGNAL_COLLECTION=pub.nya.posting.profile go run ./cmd/tap run
    • see tap documentation
  • start app

    • e.g. pnpm dev

commands #

pnpm dev
pnpm build
pnpm start

# db
pnpm db:migrate
pnpm db:reset     # DANGER: destorys everything!

# lexicons
pnpm lex:gen

# quality
pnpm check        # biome linting
pnpm check:write  # apply fixes
pnpm knip         # unused files/exports/deps
pnpm jscpd        # duplicate code

# e2e test (kinda ugly rn as it runs docker/podman depending on what you have)
pnpm test:e2e

notable file and folders #

  • /lexicons - atproto schemas (com/, pub/)

  • /scripts - dev setup helpers (OAuth key generation, tap build)

  • /src - SolidStart app

    • /routes - uses server/services/
      • /u/[handle] - profile and posts
      • /tags/[tag]
    • /components
      • /post - composer, post display, tag/box selectors
      • /profile - sidebar, box list
      • /shared - topbar, notifications, logo, mascot, etc.
    • /lib - shared helpers (preferences, hooks, sanitization, markdown, tags)
    • /lexicon - generated lexicon types (see pnpm lex:gen)
    • /assets
    • /server - server-only code, never imported by client
      • /auth
        • oauth.ts - @atproto/oauth-client-node setup
        • session.ts - session restoration
        • database-store.ts - oauth state/session storage
      • /db
        • client.ts
        • migrate.ts
        • reset.ts
        • schema.ts
      • /backend
        • consumer.ts - tap consumer, handles writes to db
        • server.ts - starts the consumer, imported by entry-server
      • /services - reads from db, writes through atproto (not the db directly!)
        • post.ts, profile.ts, box.ts, tag.ts, like.ts, repost.ts
        • blob.ts - image/blob uploads
        • notification.ts
        • types.ts - shared view types
    • app.tsx - root component
    • entry-client.tsx
    • entry-server.tsx
  • app.config.ts - SolidStart/vite config

  • tsconfig.json

  • package.json

  • /e2e - Playwright end-to-end tests

  • /docs

agent specific #

  • do not touch styling unless user explicitly requests, it should be handled by the user