Skip to content

One-page microblog (Twitter-like) MVP with server-backed feed and client hardening#7

Open
mentatai[bot] wants to merge 4 commits intomainfrom
mentat-7
Open

One-page microblog (Twitter-like) MVP with server-backed feed and client hardening#7
mentatai[bot] wants to merge 4 commits intomainfrom
mentat-7

Conversation

@mentatai
Copy link
Copy Markdown
Contributor

@mentatai mentatai Bot commented Sep 25, 2025

Implements a minimal “Twitter clone” as a single page.

  • Server (Express):
    • Add in-memory Tweets store
    • GET /api/tweets returns newest-first feed
    • POST /api/tweets creates a tweet (1..280 chars)
    • POST /api/tweets/:id/like increments like count
    • Keep catch-all to serve client build or fallback page
  • Client (React + Vite):
    • Replace landing with a single-page feed (“Mentat Micro”)
    • Compose box with 280-char counter and Post button
    • Timeline with message text, like button, like count, timestamp
    • Defensive parsing of API responses to prevent runtime crashes
    • Guard optimistic updates and refetch on unexpected payloads

Tests:

  • Client tests cover compose/post and like flows with URL/method-aware fetch mocks
  • Server tests cover /api/tweets and root fallback
  • All tests pass locally

Notes:

  • Data persists across user refreshes and is shared between users while the server runs (in-memory). If durability across restarts is desired, I can add a lightweight JSON/SQLite store.

Closes #? (Chat request: “Create a super basic twitter clone. just one page.”)


🤖 This PR was created with Mentat. See my steps and cost here

  • Wake on any new activity.

mentatai Bot and others added 3 commits September 25, 2025 07:33
- Server:
  - Add in-memory Tweets store and REST endpoints:
    - GET /api/tweets (newest first)
    - POST /api/tweets { text } (1..280 chars)
    - POST /api/tweets/:id/like (increment likes)
  - Update fallback page link to /api/tweets

- Client:
  - Replace landing page with one-page feed:
    - Compose box with 280-char counter and Post button
    - Timeline showing posts, like button with counter, timestamps
    - Minimal styling consistent with existing styles
  - Wire up to new API endpoints

- Tests:
  - Replace client tests to cover compose/post and like flows
  - Robust fetch mocking via mockImplementation by URL/method

Mentat precommit script failed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/451be634-b8d9-4d4a-8540-2898284e55e1

Co-authored-by: granawkins <50287275+granawkins@users.noreply.github.com>
- Update server app tests to target /api/tweets and root fallback
- All client tests pass locally; server tweet tests pass

Mentat precommit script failed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/bb103b89-da87-46b0-b2da-c3b7d1c33a06

Co-authored-by: granawkins <50287275+granawkins@users.noreply.github.com>
- Validate items from GET /api/tweets before setting state
- Guard POST /api/tweets optimistic prepend; refetch on unexpected shape
- Extra safety when rendering the feed

Mentat precommit script failed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/e493ac37-68d9-441c-b7df-e4a975c156fa

Co-authored-by: granawkins <50287275+granawkins@users.noreply.github.com>
@mentatai mentatai Bot requested a review from granawkins September 25, 2025 07:41
- client/src/App.tsx: add `isTweet` type guard; use in parsing
- client tests: make fetch mock helpers generic and type mock responses by URL/method

Mentat precommit script passed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/636b5476-4636-48f5-ad3a-ed223b0ec6b7

Co-authored-by: granawkins <50287275+granawkins@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants