PromptStack

AI chatbot or assistant

A model-backed assistant: conversations with streamed responses, retrieval over your own documents, token accounting, and guardrails for when the model is wrong or the input is hostile.

You can change every choice once the builder opens.
Core features for the MVP
  • Conversation history with streamed responses
  • Document ingestion, chunking, and embedding into a vector store
  • Retrieval of relevant passages before answering, with citations shown
  • Per-user rate limits and a daily budget cap
  • Token usage recorded for every request
  • Guardrails: user text treated as data, never as instructions
  • A visible way for the user to report a bad answer
Left for later
  • Tool use so the assistant can act, not only answer
  • Evaluation set with regression scoring on prompt changes
  • Multiple models selected by task and cost
  • Human handover for questions the assistant should not answer

Recommended stack

SectionRecommended
LanguageTypeScript
Frontend frameworkNext.js
UI and stylingTailwind CSSshadcn/ui
BackendNext.js server
API styleREST
Database enginePostgreSQL
Database providerNeon
ORM and data accessDrizzle
CachingUpstash Redis
AuthenticationClerk
Authorization and rolesRole-based access control
SecurityInput validationRate limitingSecurity headers and CSPSecrets managementAudit logs
File storageAWS S3
Background jobs and cronInngest
AI featuresAnthropic APIpgvector embeddings
Hosting and deploymentVercel
CI/CDGitHub Actions
Monitoring and analyticsSentryPostHog
TestingVitestPlaywright
ExtrasAccessibility (WCAG)BackupsDocumentation

Data model draft

Conversation

One ongoing exchange between a user and the assistant.

  • id
  • userId
  • title
  • model
  • createdAt
  • lastMessageAt
  • Belongs to one User
  • Has many Messages
Message

One turn, from the user or the assistant.

  • id
  • conversationId
  • role
  • content
  • citedDocumentIds
  • inputTokens
  • outputTokens
  • createdAt
  • Belongs to one Conversation
Document

A source the assistant may draw on.

  • id
  • title
  • sourceUrl
  • storageKey
  • mimeType
  • ingestedAt
  • checksum
  • Has many DocumentChunks
DocumentChunk

A passage with its embedding, retrieved to ground an answer.

  • id
  • documentId
  • position
  • text
  • embedding
  • tokenCount
  • Belongs to one Document
UsageRecord

Token spend per request, for cost control and limits.

  • id
  • userId
  • provider
  • model
  • inputTokens
  • outputTokens
  • createdAt
  • Belongs to one User