Hey r/nextjs / r/ClaudeAI!
This is my first post here sharing the engineering journey of **Kairos Labs** — an ecosystem I'm building public-facing while keeping a strict All-Rights-Reserved license for technical portfolio review.
Instead of just pasting code, I wanted to document the architectural decisions, debugging lessons, and process automation implemented from day zero using **Next.js 16 (App Router), TypeScript, Supabase, Tailwind CSS v4, and u/ClaudeAI as a pair architect.**
---
### 🏛️ 1. Architecture & Repository Governance
* **GitHub Project Automation:** Translated the PRD v1.1.0 into an automated setup script using `gh CLI` and Bash. One script generates all 21+ issues, labels, milestones, and binds them to GitHub Projects v2 Kanban boards without touching the web UI.
* **IP Protection vs. Public Review:** Standard MIT licenses didn't fit our business model. We established an explicit `All Rights Reserved` `LICENSE` file while keeping the repo public for recruiter code reviews.
* **CLI-Driven Git Flow:** Strict branch naming (`type/issue-description`), GraphQL queries to fetch project status IDs automatically, and Conventional Commits with zero untracked commits.
---
### ⚡ 2. Frontend & Next.js App Router Decisions
* **Server vs. Client Component Isolation:** In `/solucoes/[slug]`, the main route stays a Server Component for SSG/SEO performance, while the product waitlist CTA (`WaitlistCTAButton.tsx`) is cleanly isolated as a Client Component.
* **Design System & Visual Signature:** Tailwind v4 (`@import "tailwindcss"` in `globals.css`) + `shadcn/ui`. Built custom ambient canvas particles and an animated SVG hourglass (symbolizing *Kairos* — the opportune moment) with pure React/CSS.
* **Complete Metadata & SEO:** Built native Next.js 16 App Router metadata configurations (`app/robots.ts`, `app/sitemap.ts`, Open Graph cards) and automated favicon processing using `sharp`.
---
### 🔒 3. Backend, Database & Hard-Learned Lessons
* **Supabase Schema & RLS from Day 1:** Implemented Row Level Security policies separating public `INSERT` from authenticated `SELECT` (admin-only).
* **Handling Postgres 23505 Duplicate Constraints:** Instead of showing generic errors when users re-register an email, we explicitly catch Postgres error code `23505` to surface an empathetic UI state (*"You're already on the waitlist"*).
Mejivh shares the engineering journey of building Kairos Labs, focusing on architectural decisions, debugging lessons, and process automation using Next.js 16, Supabase, and other technologies. The post discusses repository governance, frontend decisions, backend lessons, and quality engineering practices. Mejivh invites feedback on handling public code visibility and balancing feature prototyping with quality gates.
I’m not reading more AI generated text, I have to do enough of that at my day job
AI slop wall of text
* **Permissions Trap:** Learned that enabling RLS with `WITH CHECK (true)` isn't enough for public forms — explicit `GRANT INSERT ON public.waitlist TO anon;` is required in PostgreSQL.
---
### 🛠️ 4. Quality Gate & The Pivot to Quality Engineering
* **Build-First Pre-Commit Protocol:** `npm run dev` with Turbopack can hide TypeScript errors. We enforced a mandatory local `npm run build` check before every pull request.
* **SonarCloud Integration:** Set up automated PR Quality Gates. When SonarCloud flagged Zod v4 syntax breaks (`.issues` vs `.errors`) and inline duplicate code, we established an internal `sonar.md` rulebook to address quality warnings prior to merge.
* **The Quality Engineering Shift (Milestone 5):** Paused feature expansion today to build our core safety net: Jest + React Testing Library, Playwright E2E testing, ESLint + Husky git hooks, and GitHub Actions CI pipelines.
---
### 💡 Key Takeaway & Discussion
Co-creation with LLMs works best when you treat the AI as a Principal Engineer challenging your architectural choices, not just a code generator. Every session is logged in a structured `diario_de_aprendizado.md` to maintain total auditability between issues and commits.
**I’d love to hear your thoughts:**
*Feel free to ask about any part of the stack, scripts, or workflows!*