DEV Community

Masaya Hori
Masaya Hori

Posted on

Cogni-Write: Fueling Niche Passions with Autonomous, Multi-Model AI Curation

DEV Weekend Challenge: Passion Edition Submission

This is a submission for Weekend Challenge: Passion Edition

What I Built

Cogni-Write is an automated digital journalism dashboard designed to break the bottleneck of content generation for deep-dive passion projects.

Whether your passion is exploring ultra-niche local hidden spots, mapping out vintage music movements, or tracking specialized tech, keeping up with consistent high-quality writing is tough. Cogni-Write acts as an automated curation engine. By setting up a target topic, the application behaves like an independent digital journalist—analyzing what it has already written to prevent duplicate angles, applying advanced editorial guidelines via LLMs, and committing fully type-safe articles directly to a live dashboard.

Demo

The application is fully deployed and running live on Vercel:
👉 Deployed Project Link: https://cogni-write.vercel.app/

Code

The full source code, database architecture, and pipeline configuration are publicly accessible on GitHub:
👉 GitHub Repository: https://github.com/MessiahHoly/cogni-write

How I Built It

I wanted to build a bulletproof production stack that prioritizes predictable runtime states and resilient engineering. The application leverages Next.js 16 (App Router) with Turbopack, Prisma linked to a Neon PostgreSQL database, and Zod for schema runtime validation.

Here are the key architectural decisions made over the weekend:

Pure Functional Error Handling: Instead of letting fragile try/catch exceptions leak and bubble up, the core content generation pipelines use a functional Result State Monad ({ data } | { error }). Every operation returns an immutable, predictable value.

Parallel Array Execution with Custom Type Guards: The system maps over an array of configured target engines in parallel using Promise.all. To strip out errors without throwing exceptions or defaulting to type-bypassing any types, I used a custom TypeScript type guard (result is SuccessfulArticleResult) mapped out via Extract.

Optimized Multi-Request Memoization: Dynamic routes fetch data multiple times in Next.js (once for dynamic SEO metadata and once for rendering the layout view). To ensure the Prisma client isn't draining database connections with redundant duplicate reads, I wrapped the database fetch layer in a top-level React cache() container to globally share query executions across the request lifecycle.

Automated On-Demand Revalidation Pipelines: The system is completely autonomous. A secure Vercel Cron Job triggers the content pipeline over POST endpoints once a day. To handle Next.js' production static page generation behavior, the API handler explicitly triggers revalidatePath("/") and loops through dynamic category slugs on the spot, swapping in fresh data across Vercel’s global Edge network instantly.

Top comments (0)