# Build brief — a focused alternative to Lex

> **Verdict:** Yes, for personal use · **Buildability:** 80/100 · **Category:** AI Writing
> **Source:** https://www.canitbevibecoded.com/lex
> Independent editorial assessment from Can It Be Vibe Coded? Not affiliated with, endorsed by, or derived from Lex. Verify current pricing and capabilities before acting.

## Context

**Lex** — Write and revise long-form documents with comments, version history, and AI actions. It currently costs $12/mo.

The core loop is small enough for a capable coding agent to produce a useful local version. For Lex, write and revise long-form documents with comments, version history, and AI actions. The hard boundary is collaborative editor polish, sync, and embedded model access, plus workflow, data, and model tuning.

This brief describes a focused, single-operator replacement for the part of Lex that is genuinely reproducible. It is deliberately narrower than the product it replaces, and it says so in writing. Build the useful core; do not pretend to have rebuilt the rest.

## What you are building

Take a brief, gather user-supplied source material, generate and revise a structured long-form draft with comments and AI actions, and keep citations and version history attached to each section.

- Wrap a model API in a focused drafting, revision, and export workflow.
- A responsive interface with real empty, loading, success, and error states.

## Requirements

### Functional

- Node.js 22.
- Local or self-hosted deployment.
- User-supplied sources.

### Data and integrations

- OpenAI API key.

Each of these needs a real account, credential, or quota. Set them up before writing feature code.

### Non-functional

- Accessibility: semantic markup, labelled controls, visible focus, and reduced-motion support.
- Security: server-side secrets, validated input, and no credentials in the client bundle.
- Reliability: retries with backoff on external calls, and a clear failure state when a provider is down.
- Portability: the operator can export their data and leave without losing it.

## Implementation brief

Build a personal replacement for Lex in an empty repository.
Use Next.js 15, TypeScript, Tailwind CSS, SQLite, Drizzle ORM, and the OpenAI Responses API; do not offer alternative stacks.
The core loop is: take a brief, gather user-supplied source material, generate and revise a structured long-form draft with comments and AI actions, and keep citations and version history attached to each section.
Make the first run work locally with one documented command.
Store all user data locally by default and make export straightforward.
Put secrets in .env, ship .env.example, and never commit credentials.
Build a brief form with audience, objective, tone, source URLs, and prohibited claims.
Store imported source text locally and chunk it for retrieval with SQLite FTS5.
Generate an outline first and require approval before drafting sections.
Attach source references to generated paragraphs and flag unsupported claims.
Provide rewrite controls for shorten, clarify, change tone, and add evidence.
Export clean Markdown plus a JSON research bundle.
Include clear empty, loading, success, and recoverable error states.
Add input validation, safe filenames, and graceful handling of unavailable APIs.
Write focused tests for the core transformation and one end-to-end happy path.
Create a README with setup, architecture, permissions, data location, and backup steps.
Do not add accounts, billing, telemetry, analytics, or a hosted control plane.
Deliberately leave out live search-engine rank data.
Deliberately leave out automatic publishing to third-party CMSs.
Deliberately leave out multi-user approvals and brand governance.
Finish by running the tests and listing the exact commands used.

## Delivery standard

- Inspect the repository first, then write a short implementation plan before writing code.
- Deliver the smallest complete end-to-end workflow first; every primary control must work against persisted data.
- Use real validation and storage; never substitute fake dashboards, decorative controls, hard-coded success states, or mock integrations.
- Include responsive layouts plus genuine empty, loading, success, validation, and failure states.
- Keep secrets server-side in environment variables, provide .env.example, and never commit credentials or user data.
- Add structured logs around every external call and return actionable errors without leaking sensitive details.
- Write unit tests for the core logic and one automated test of the main user journey.
- Finish with a README covering setup, architecture, data location, backups, tests, deployment, and known limitations.

## Acceptance criteria

- [ ] A clean install starts the app using only the README and .env.example.
- [ ] The primary journey works from first visit through saved result, reload, edit, export, and deletion where applicable.
- [ ] Invalid input, missing configuration, provider failure, and an empty database each have a usable state.
- [ ] The interface works at 390px and 1440px, is keyboard navigable, and shows visible focus on every control.
- [ ] Tests, type checking, linting, and a production build all pass with no ignored failures.
- [ ] No part of the interface implies a live integration, security guarantee, or scale capability that was not actually built and verified.

## Non-goals

Do not build these, and do not claim to have replaced them:

- Collaborative editor polish, sync, and embedded model access.
- Proprietary ranking data.
- Brand-trained models.
- Team workflows.
- The last 20 percent is sync, migration fidelity, speed, and edge cases.
- Permissions, presence, and shared workflows are difficult to simplify.

## What you still own after launch

- Secure credentials, rotate secrets, and handle provider rate limits.
- Run migrations, backups, restores, and dependency updates.
- Test the critical journey after every model, API, or hosting change.
- Monitor failures and fix the edge cases a first prompt will miss.

## Risk

**Manageable.** A personal version is realistic if you test the critical journey and keep reliable backups.

Editorial confidence in this assessment: high. No independent one-shot implementation is linked yet.

## Prior art

Working open-source software you can read, fork, or borrow from before starting:

- [Open WebUI](https://github.com/open-webui/open-webui) — Active open-source interface for local and API-backed language models with retrieval features

---

Generated by [Can It Be Vibe Coded?](https://www.canitbevibecoded.com) · Full report: https://www.canitbevibecoded.com/lex
