All projects
SaaS2025Beta

PlanMyIdeas

An AI startup-idea workspace where a persistent agent generates ideas and refines them into documents with full version history.

Role

Founder and full-stack engineer — product design, architecture, and implementation

Built with

  • Next.js
  • React
  • TypeScript
  • Bun
  • Tailwind CSS
  • shadcn/ui
  • +8 more
PlanMyIdeas idea workspace with the agent chat and rich-text document editor
  • All AI actions metered
  • Immutable version history
  • Atomic credit transactions
  • OAuth + RBAC auth

The Problem

What needed to be solved

Startup ideas die as vague notes. The gap is between having an idea and having something structured enough to act on — and the tools that promise to bridge it are either generic chat interfaces or rigid form-filling wizards that capture the same fields every time.

Context

Why it was built this way

This is my own product, so the design questions were product questions, not client questions. The core insight was that the agent should carry the user's preferences and history across conversations, so each generated idea gets more specific than the last — and the output should be a document the user keeps refining, not a chat transcript they have to mine.

Approach

How I built it

  1. 01

    Make the agent conversational and persistent — it learns the user's interests and preferences across sessions and can correct itself with newer evidence.

  2. 02

    Give the agent real tools: a remember tool that stores facts, and a searchMemory tool that recalls them, with preference and onboarding keys protected from LRU eviction so the important context never gets dropped.

  3. 03

    Refresh agent context on every loop step rather than snapshotting it once, so the model sees the latest state of the conversation as it works.

  4. 04

    Treat idea generation as a structured agent with a stop condition and a database guard, so a single turn can never generate duplicates.

  5. 05

    Apply document refinement through the same agent — the user asks for a concise pitch, a roadmap, or a monetization section, and the change is applied to the document and committed as a new version.

  6. 06

    Keep every applied change as an immutable version that can be browsed and restored at any time.

  7. 07

    Meter every AI action against a credit balance, deducting only after the work is persisted, inside a single transaction with whole-transaction retry.

My role

What I was responsible for

  • Designed the product — the agent loop, the document model, versioning, and the credit economy.

  • Built the agent runtime on the Vercel AI SDK with tool-calling, loop-step control, and per-step context refresh.

  • Implemented persistent memory with a searchable fact store and eviction rules that protect preference and onboarding keys.

  • Built the TipTap rich-text editor with Markdown support, tables, task lists, and autosave.

  • Implemented the version history system — every applied change committed immutably and restorable.

  • Built the credit system with atomic persist-and-deduct transactions, retry logic, and a double-charge guard.

  • Set up authentication with Better Auth — email/password, Google OAuth, and RBAC.

  • Integrated Polar for credit-pack checkout with webhooks and reconciliation, and Resend + React Email for transactional mail.

  • Restructured the codebase into a feature-oriented architecture — each feature owns its schemas, types, store, server actions, and components.

  • Wrote tests for the safety nets: the duplicate-generation guard, single-transaction persist-and-deduct, insufficient-credit rollback, transient recovery, and memory key normalization.

Challenges

The hard parts

Charging without double-charging

Credits were deducted after persisting, not before, and both steps run in a single database transaction with whole-transaction retry — so a failure mid-way rolls back cleanly instead of charging for work that never landed.

Agent memory that stays useful

Facts are stored with normalized keys and deduplicated last-write-wins. Preference and onboarding keys are excluded from eviction, so the context that defines the user's identity for the agent is never the context that gets dropped first.

Server actions that fail predictably

Every action returns an ActionResult envelope — status, data, error, message — so the UI can show a real failure state instead of an unhandled rejection. Validation, persistence, and credit checks each get their own guard.

A rich-text editor that round-trips Markdown

TipTap with the Markdown extension had to preserve tables, task lists, and formatting while staying a normal document that could be refined by an agent and versioned immutably.

Decisions

Key technical calls I made

Deduct credits after persisting, in one transaction

The alternative — charge first, work second — loses money when the work fails. Persist-then-deduct inside a single transaction means the credit and the artifact always agree.

Feature-oriented architecture with strict boundaries

Each feature owns its schemas, types, store, server actions, and components, and imports from within the feature use relative paths only. This keeps the blast radius of a change inside one feature.

ActionResult envelope over thrown errors

A typed envelope per action makes failure a value the UI can handle, rather than an exception that has to be caught somewhere else.

Agent memory with a search tool, not a static prompt

Giving the agent a remember tool and a searchMemory tool makes memory part of the agent's own reasoning loop instead of something reconstructed at request time.

Zod schemas as the single validation source

Form validation, server-side parsing, and type definitions all read from one schema per feature, so a validation rule cannot drift between the client and the server.

Gallery

Project in practice

Outcome

Where it landed

PlanMyIdeas is a working product with idea generation, persistent agent memory, a rich-text document workspace, AI refinement, immutable version history, credit-based billing, and an admin panel for managing credit packs. It is my clearest example of owning the full stack — product decisions, agent architecture, billing, auth, and deployment — rather than building one layer of someone else's product.

The source for this project is private. I'm happy to walk you through the architecture, the decisions behind it, and what I would do differently — get in touch and we'll set something up.

Stack

Built with

Next.jsReactTypeScriptBunTailwind CSSshadcn/uiTipTapAI SDKPostgreSQLDrizzleBetter AuthPolarResendZustand

Keep reading