Work / Comercial Template

comercial-template

A full-stack application for client records and commercial proposals. Repository: https://github.com/lughlammas/comercial-template · commit 3ead252

Status
Public repository · not deployed
Stack
Next.js App Router, TypeScript, Tailwind, NextAuth, Prisma + SQLite, @react-pdf
Tests run
npm test → 24/24 · typecheck exit 0 · 2026-10-19

01Problem

The problem this project takes on is proposals written in documents and spreadsheets: totals calculated by hand, no history per client, and a clean PDF that has to be formatted again every time. It tests whether that flow (client → proposal → line items → total → PDF) can be a small, reliable, reusable application.

02Context

A demonstration application with a Brazilian Portuguese interface and synthetic seed data. It is not deployed and has no users; no production adoption is claimed.

03Solution

  • Email and password registration and login, with bcrypt-hashed passwords and JWT sessions.
  • A protected dashboard, plus creation, listing and detail views for clients and proposals.
  • Line items with quantities, prices and totals rounded to cents.
  • A PDF of each proposal generated on the server and downloaded only by its owner.
comercial-template·proposal detail
Comercial Template proposal detail at 1440px: line items, quantities, prices, total and a Download PDF button, synthetic data. Comercial Template proposal detail at 390px mobile width, seeded fictional proposal with line items and total.
Real capture · commit 3ead252 · local run, synthetic data (scripts/e2e-smoke.mjs + seeded demo) · 2026-10-19 09:23 BRT

04Architecture

A single Next.js App Router application in TypeScript. Pages are React Server Components that query the database through Prisma (SQLite); writes go through Server Actions; one route handler renders PDFs with @react-pdf/renderer. Middleware blocks protected routes without a session. A Dockerfile and a standalone build are configured.

05Evidence

  • 24/24 unit tests passed (4 files: money, server actions, middleware, PDF route), and the typecheck is clean, in the run for this site on 2026-10-19.
  • CI passed on the current commit. The "Web validation" workflow runs install, lint, unit tests, production build, typecheck and a browser smoke test against the production build.
  • Data isolation is tested: the PDF route returns 401 without a session and 404 for proposals the user does not own, and creating a proposal refuses another user's client.
  • The repository documents a browser run on 2026-10-07 with 13/13 checks, including a second user receiving 404 on the first user's records. That run was not repeated for this site.

Links

06Human role and AI tools

Built through human-directed AI-assisted development: AI tools contributed to product, implementation, QA and documentation, under human direction. The repository contains application source, not an agent platform.

07Tests executed

Check Result Where
npm test 24/24 passed run on 2026-10-19
npm run typecheck exit 0 run on 2026-10-19
CI "Web validation" success on 3ead252 GitHub Actions
Browser smoke (test:e2e) 13/13, documented repo docs, 2026-10-07, not re-run
lint / build / e2e, local not run for this site

08Limitations

  • No hosted demo or deployment.
  • Docker image not verified: the Dockerfile copies a public/ folder that does not exist.
  • Clients and proposals cannot be edited or deleted; proposal status cannot be changed in the interface.
  • No email verification, password reset or login rate limiting.
  • Money stored as floating point (rounded per line); BRL and pt-BR hard-coded.
  • Schema applied with db push, without migration history.
  • 11 high-severity advisories remain in tooling and optional dependencies (0 critical), per npm audit on 2026-10-19.
  • No performance, accessibility or security tests.
  • Header overflows horizontally below ~420 px (measured at 360/390 px); 'Ver demo' button contrast 1.04:1 and footer text 3.66:1 (WCAG AA requires 4.5:1).
  • No LICENSE file.

09Commercial relevance

This is the reference for S02 · Custom Software & MVP: authentication, data ownership, a money calculation with tests, and a document output, delivered with its limits stated. It is also a base that can be adapted to similar flows (quotes, receipts, simple contracts) after an assessment of what each one needs.

→ S02 · Custom Software & MVP Development · Discuss Your Project

Have a problem that should become software?

Describe what you have and what is not working.