Architecture ReportB81
01_demo_lovable
5
3
0
Mar 29, 02:19 PM
5 issues found
Summary
8 checks analyzed, 5 failures. Estimated fix: ~9.5h. Recommended: fix the issues.
Fix Batches โ Recommended Order
5 issues in architecture module. Start here.
Fix Batch 1: Architecture Module (5 issues)
## ARCH-01 โ Business logic in domains/
Issue: Supabase/DB calls found in pages/components (9 files)
Affected files: src/pages/AdminDashboard.tsx, src/pages/AdminUsers.tsx, src/pages/Billing.tsx, src/pages/Dashboard.tsx, src/pages/InvoiceCreate.tsx
Move all Supabase/database calls out of page files and components into a domains/ directory. Create domain-specific modules: domains/billing/actions.ts, domains/auth/queries.ts, etc. Pages should only import and call domain functions โ never make DB calls directly. Example: instead of supabase.from('invoices').select() in a page, create domains/billing/queries.ts with export async function getInvoices() { ... } and import it.
## ARCH-02 โ domains/ directory exists
Issue: 103 source files but no domains/ directory
Affected files: Create domains/<domain>/<slice>/ for business logic
Create a domains/ directory at the root of your src/ folder. Inside, create subdirectories for each business domain: domains/auth/, domains/billing/, domains/admin/. Each domain should contain its own actions, queries, types, and UI components. This is the first structural boundary โ without it, business logic has nowhere organized to go. Start by: mkdir -p src/domains/auth src/domains/billing src/domains/admin.
## ARCH-04 โ Pages are thin wrappers
Issue: 10 pages over 80 lines โ extract logic to domains/
Affected files: src/pages/AdminUsers.tsx (144 lines), src/pages/Billing.tsx (211 lines), src/pages/Dashboard.tsx (224 lines), src/pages/Index.tsx (86 lines), src/pages/InvoiceCreate.tsx (316 lines)
Refactor fat page files to be thin wrappers under 80 lines. Pages should only handle: layout, data fetching (calling domain functions), and rendering domain components. Extract all business logic, form handling, and state management into domain modules. Example: a 200-line Billing page becomes: import { BillingDashboard } from '@/domains/billing/ui/BillingDashboard'; export default function BillingPage() { return <BillingDashboard />; }.
## ARCH-06 โ File size limit
Issue: 1 file over 500 lines โ split into smaller modules
Affected files: src/components/ui/sidebar.tsx (638 lines)
Split any source file over 500 lines into smaller, focused modules. Large files indicate mixed responsibilities. For a 600-line component: extract sub-components, move utility functions to separate files, split form logic from display logic. For a large API route: extract handler functions, validation, and business logic into separate files. Target: no file over 300 lines, ideally under 200.
## STR-01 โ CI/CD pipeline exists
Issue: No CI/CD pipeline found โ code goes from developer to production unchecked
Add a CI/CD pipeline to your project. Create .github/workflows/ci.yml with at minimum: checkout, install dependencies, lint, and build steps. For safety enforcement, add: npx @vibecodiq/cli guard check. Example workflow: on: [push, pull_request] โ jobs: ci: runs-on: ubuntu-latest โ steps: checkout, setup-node, npm ci, npm run build, npx @vibecodiq/cli guard check.
Copy this prompt into your AI tool (Windsurf, Cursor, Lovable) to fix these issues.
Failed Checks (5)
Business logic (DB calls, API calls, state mutations) in page files or components creates the 'god component' pattern โ everything is coupled, nothing is testable, and AI tools amplify the chaos on every prompt.
Show fix prompt
Issue: Supabase/DB calls found in pages/components (9 files)
Affected files: src/pages/AdminDashboard.tsx, src/pages/AdminUsers.tsx, src/pages/Billing.tsx, src/pages/Dashboard.tsx, src/pages/InvoiceCreate.tsx
Move all Supabase/database calls out of page files and components into a domains/ directory. Create domain-specific modules: domains/billing/actions.ts, domains/auth/queries.ts, etc. Pages should only import and call domain functions โ never make DB calls directly. Example: instead of supabase.from('invoices').select() in a page, create domains/billing/queries.ts with export async function getInvoices() { ... } and import it.Without a domains/ directory, business logic has nowhere structured to go. AI tools dump everything into pages, components, or lib โ creating a monolith.
Show fix prompt
Issue: 103 source files but no domains/ directory Affected files: Create domains/<domain>/<slice>/ for business logic Create a domains/ directory at the root of your src/ folder. Inside, create subdirectories for each business domain: domains/auth/, domains/billing/, domains/admin/. Each domain should contain its own actions, queries, types, and UI components. This is the first structural boundary โ without it, business logic has nowhere organized to go. Start by: mkdir -p src/domains/auth src/domains/billing src/domains/admin.
Fat page files (>80 LOC) mix routing, layout, state, and business logic in one place. AI tools generate entire features in a single page.tsx โ the 'god page' anti-pattern.
Show fix prompt
Issue: 10 pages over 80 lines โ extract logic to domains/
Affected files: src/pages/AdminUsers.tsx (144 lines), src/pages/Billing.tsx (211 lines), src/pages/Dashboard.tsx (224 lines), src/pages/Index.tsx (86 lines), src/pages/InvoiceCreate.tsx (316 lines)
Refactor fat page files to be thin wrappers under 80 lines. Pages should only handle: layout, data fetching (calling domain functions), and rendering domain components. Extract all business logic, form handling, and state management into domain modules. Example: a 200-line Billing page becomes: import { BillingDashboard } from '@/domains/billing/ui/BillingDashboard'; export default function BillingPage() { return <BillingDashboard />; }.AI tools add code to whichever file already contains related logic. After 50-100 prompts, files grow to 500-1000+ lines. At that point the AI itself loses context โ it contradicts previous logic, introduces regressions, and can no longer reason about the file.
Show fix prompt
Issue: 1 file over 500 lines โ split into smaller modules Affected files: src/components/ui/sidebar.tsx (638 lines) Split any source file over 500 lines into smaller, focused modules. Large files indicate mixed responsibilities. For a 600-line component: extract sub-components, move utility functions to separate files, split form logic from display logic. For a large API route: extract handler functions, validation, and business logic into separate files. Target: no file over 300 lines, ideally under 200.
Without a CI/CD pipeline, code goes from developer (or AI tool) to production unchecked. Guard can't run, safety scans happen only when someone remembers.
Show fix prompt
Issue: No CI/CD pipeline found โ code goes from developer to production unchecked Add a CI/CD pipeline to your project. Create .github/workflows/ci.yml with at minimum: checkout, install dependencies, lint, and build steps. For safety enforcement, add: npx @vibecodiq/cli guard check. Example workflow: on: [push, pull_request] โ jobs: ci: runs-on: ubuntu-latest โ steps: checkout, setup-node, npm ci, npm run build, npx @vibecodiq/cli guard check.
This is a static source-code analysis report. It is not a complete security audit. Results may contain false positives or miss certain issues. Always verify findings manually.