PRD & Spec Assistant is a local-first planning workspace for turning an early product idea into two connected artifacts:
- a product requirements document (PRD)
- a technical specification (Spec)
The app is designed for a small team or solo builder who wants a practical, startup-ready planning loop instead of a heavyweight product operations system. It helps a user capture context, generate a first draft, tighten weak sections, and export the result as Markdown.
This project is a full-stack Next.js application that acts like a product and engineering planning copilot.
At a high level, the assistant helps with:
- turning a rough idea into a structured PRD
- deriving a technical spec from the product context and PRD
- refining a single weak section without rewriting the whole document
- preserving planning history through saved chat and document versions
- exporting the current PRD or spec into Markdown for sharing or repo use
This is not a generic chatbot. The assistant is constrained around a specific workflow:
- capture product context
- generate planning artifacts
- refine sections
- export usable docs
The current version is intentionally optimized for:
- single-user, local/dev usage
- startup-speed planning rather than enterprise governance
- editable, practical outputs over rigid templates
- structured documents that can still be refined conversationally
The app does not currently aim to solve:
- authentication or multi-user collaboration
- PDF export
- approval workflows or formal document review gates
- project management orchestration such as ticket generation or delivery tracking
The primary workflow in the app looks like this:
- Create a new project from the home page.
- Fill in the product context and guided intake fields.
- Save the project context.
- Generate the PRD.
- Generate the technical spec.
- Edit sections manually or refine a single section with AI.
- Use chat to ask what is missing or what should be improved next.
- Export the PRD or spec as Markdown.
The assistant is designed so that structured input and chat work together:
- the intake form gives the model stable planning context
- the documents hold the current draft state
- the chat history gives extra qualitative direction
The PRD is generated with these sections:
- Overview
- Problem
- Goals and Non-Goals
- Target Users
- User Stories
- Requirements
- Success Metrics
- Risks and Open Questions
The technical spec is generated with these sections:
- System Overview
- Architecture
- Data Model
- API / Server Behavior
- Client Behavior
- Edge Cases and Failure Modes
- Observability
- Rollout Notes
The assistant operates through three main AI behaviors.
The app can generate:
- a PRD from project context, intake fields, and recent chat
- a technical spec from the same context plus the latest PRD
The prompt builders live in lib/prompts.ts, and the orchestration logic lives in lib/generation.ts.
The generation pipeline expects a structured JSON response so the output can be mapped back onto known sections.
Instead of forcing the user to regenerate an entire document, the assistant can refine one section at a time.
That flow:
- finds the current section
- sends the project context and section content to the model
- receives updated Markdown for only that section
- merges the section back into the document without disturbing the rest
This behavior is implemented in lib/documents.ts and lib/generation.ts.
The chat panel is not a separate assistant with its own memory system. It uses:
- current project metadata
- guided intake fields
- the latest PRD
- the latest spec
- saved chat history
The reply helps the user understand what is weak, missing, or worth refining next. That server route is implemented in app/api/projects/[id]/chat/route.ts.
The app supports both hosted OpenAI and local OpenAI-compatible model servers.
Use:
OPENAI_API_KEY="your_key"
OPENAI_BASE_URL=""
OPENAI_MODEL="gpt-4.1-mini"You can run a local Llama-family model through Ollama and point the app at its OpenAI-compatible endpoint.
Example:
ollama pull llama3.1Then set:
OPENAI_API_KEY="local"
OPENAI_BASE_URL="http://localhost:11434/v1"
OPENAI_MODEL="llama3.1"The app uses chat completions for provider compatibility, which works better with local OpenAI-compatible servers than the Responses API path.
The app is intentionally usable even if no working model provider is configured.
If the configured provider is missing or fails, the assistant falls back to deterministic local content generation. This means:
- the UI still works
- documents are still generated
- section refinement still works
- chat still returns helpful guidance
The fallback content is template-driven and less intelligent than model output, but it keeps the app functional for local development and demos.
The provider integration and fail-soft behavior live in lib/openai.ts.
The frontend uses Next.js App Router and React.
Main UI surfaces:
- app/page.tsx
- landing page
- project list
- new project form
- app/projects/[id]/page.tsx
- project workspace route
- components/project-workspace.tsx
- main split-pane planning experience
- components/create-project-form.tsx
- project creation flow
The workspace is organized into three panes:
- left: project context and intake
- center: PRD/spec editing
- right: assistant chat and version history
The backend uses Next.js route handlers.
Implemented API routes:
- app/api/projects/route.ts
- create project
- app/api/projects/[id]/route.ts
- fetch workspace
- save project fields
- save manual document edits
- app/api/projects/[id]/generate/prd/route.ts
- generate PRD
- app/api/projects/[id]/generate/spec/route.ts
- generate spec
- app/api/projects/[id]/refine-section/route.ts
- refine one section
- app/api/projects/[id]/chat/route.ts
- assistant chat
- app/api/projects/[id]/export/route.ts
- Markdown export
The app uses Prisma with SQLite.
Schema file:
Prisma config:
Prisma client setup:
Database helper/orchestration code:
The data model is intentionally simple and project-centric.
Stores top-level workspace metadata such as:
- title
- product idea
- audience
- goals
- constraints
- status
Stores structured intake used to generate better documents:
- problem
- users
- success metrics
- requirements
- non-goals
- rollout notes
Stores the current saved PRD or technical spec:
- type
- title
- summary
- full Markdown content
Stores normalized sections for section-level editing and refinement:
- stable section key
- heading
- content
- order
Stores project-scoped conversation history.
Stores snapshots of saved/generated documents over time for lightweight version history.
app/
api/projects/...
globals.css
layout.tsx
page.tsx
projects/[id]/page.tsx
components/
create-project-form.tsx
project-workspace.tsx
lib/
documents.ts
generation.ts
openai.ts
prisma.ts
project-data.ts
prompts.ts
types.ts
utils.ts
prisma/
migrations/
schema.prisma
tests/
documents.test.ts
prompts.test.ts
- Node.js 20+ recommended
- npm
npm installCreate .env.local:
cp .env.example .env.localDefault values:
DATABASE_URL="file:./prisma/dev.db"
OPENAI_API_KEY=""
OPENAI_BASE_URL=""
OPENAI_MODEL="gpt-4.1-mini"Run the Prisma migration:
npx prisma migrate dev --name initIf you need to regenerate the Prisma client manually:
npx prisma generatenpm run devThen open http://localhost:3000.
This repo is configured for Prisma 7:
- the schema does not include
urlin the datasource block prisma.config.tsprovides the datasource URL- the runtime Prisma client uses the SQLite adapter
The project includes a postinstall script that runs prisma generate after dependency installation.
If the dev server gets into a bad state, clear the build output:
rm -rf .next
npm run devIf install/build artifacts are corrupted, do a clean reset:
rm -rf .next node_modules package-lock.json
npm install
npx prisma generate
npx prisma migrate dev --name init
npm run devThe repo currently includes focused unit tests for:
- document section serialization/parsing
- section merge behavior during refinement
- prompt construction
- section normalization
Run tests with:
npm testTest files:
This v1 implementation has a few intentional boundaries:
- single-user only
- no authentication
- no team collaboration
- no PDF export
- no rich text editor beyond textarea-based Markdown editing
- chat suggests next edits but does not automatically apply them
- no formal approval or review workflow
Good next steps for the product could include:
- team accounts and shared workspaces
- richer Markdown preview or split edit/preview mode
- chat actions that can apply suggested edits directly
- document diffing between versions
- stronger quality critique and contradiction detection
- export to PDF or external tools
- task breakdown generation from the spec
PRD & Spec Assistant is a practical planning tool for going from idea to execution-ready documentation. It combines structured intake, document generation, section-level refinement, saved history, and Markdown export in one local-first workspace.
The current implementation is intentionally compact, but the core architecture is already set up to support a stronger multi-step planning agent over time.