Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ jobs:
run: pnpm test
- name: Deploy 😎
run: pnpm generate
- name: Verify SEO output 🔎
run: pnpm verify:seo
10 changes: 10 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,20 @@ jobs:
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Prepare Nuxt
run: pnpm exec nuxt prepare
- name: Skew protection build history 🗄️
# nuxt-skew-protection keeps previous build assets alive for clients
# with cached HTML; it needs its build history preserved across runs.
uses: actions/cache@v4
with:
path: node_modules/.cache/nuxt-seo/skew-protection
key: skew-protection-${{ github.run_id }}
restore-keys: skew-protection-
- name: Lint check ✅
run: pnpm lint
- name: Deploy 😎
run: pnpm generate
- name: Verify SEO output 🔎
run: pnpm verify:seo
- name: Publish 🍻
uses: actions/upload-pages-artifact@v5
with:
Expand Down
20 changes: 17 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ pnpm enforces `minimumReleaseAge`; a release newer than the window resolves to a
```sh
pnpm dev # dev server
pnpm generate # static site generation (what CI deploys)
pnpm verify:seo # assert generated SEO output in .output/public (run after generate)
pnpm lint # ESLint check
pnpm lint:fix # ESLint auto-fix
pnpm typecheck # scoped tsc over app/src and app/lib
pnpm test # all tests (both unit and nuxt projects)
pnpm update-indexes # fetch live market rates → app/assets/indicadores.json
```

CI order: `lint → typecheck → test → generate` (not `build`).
CI order: `lint → typecheck → test → generate → verify:seo` (not `build`).

## TypeScript setup

Expand Down Expand Up @@ -61,14 +62,27 @@ Canvas-based components (Chart.js, etc.) gate rendering on `canvas.getContext('2

`pnpm typecheck` covers `app/src` and `app/lib` only; full-project `tsc --noEmit` still reports pre-existing errors in `test/nuxt/*`.

The `nuxt` project loads Nuxt with `ssr: false` (hardcoded in `@nuxt/test-utils`), which means:

- `document.title` is unreliable (unhead does not resolve string `titleTemplate`s client-side there) and JSON-LD from `useSchemaOrg()` never reaches the head. Both are asserted by `pnpm verify:seo`, which checks the generated `.output/public` — always run it after `pnpm generate` (CI does, right after the generate step).
- unhead applies DOM side effects on a timer: mount pages via `mountPageAndSettleHead` from `test/nuxt/seo-head.ts` before asserting head contents.

## Architecture

- `app/src/` — pure TS financial logic (CDB, LCI/LCA, Poupança, taxes, IOF). No Nuxt dependency; unit-testable in node env.
- `app/store/` — Pinia stores (investment state, loads `indicadores.json` at runtime).
- `app/components/` — Vue components.
- `app/pages/` — Nuxt pages (SPA, SSR is disabled).
- `app/pages/` — Nuxt pages (prerendered: `ssr: true`, HTML rendered at build time, hydrated into an SPA feel client-side).
- `app/components/OgImage/` — og:image templates (`*.satori.vue`) rendered to PNG by nuxt-og-image at `pnpm generate` time.
- `app/assets/indicadores.json` — live market rates (CDI, SELIC, Poupança). Auto-updated by CI workflow; do not hand-edit for persistent changes—use `pnpm update-indexes`.

## SEO (`@nuxtjs/seo`)

`sitemap.xml`, `robots.txt`, og:image PNGs (under `/_og/s/`), JSON-LD graphs and `llms.txt` are all **generated at build time** by the bundled modules — never hand-edit or commit `public/sitemap.xml` / `public/robots.txt` (a static `robots.txt` gets renamed to `_robots.txt` and treated as config source).

- Per-page og:image is wired via `routeRules` (`ogImage` key) in `nuxt.config.ts`, **not** `defineOgImage()` — the vitest nuxt environment loads Nuxt with `ssr: false`, where nuxt-og-image bails out and its composables don't exist (see Testing).
- Internal links use trailing slashes (`/sobre/`); the site convention is `trailingSlash: true` and the link checker fails the build report otherwise.

## Nuxt 4 conventions

`future.compatibilityVersion: 4` is set. This activates Nuxt 4 directory conventions (e.g., `app/` directory layout instead of root-level `pages/`/`components/`).
Expand All @@ -87,4 +101,4 @@ PR titles must follow **Conventional Commits** (enforced by CI workflow `pr-titl

## Deployment

The site is a static SPA deployed to GitHub Pages via `pnpm generate`. There is no server-side rendering.
The site is prerendered static HTML deployed to GitHub Pages via `pnpm generate`. SSR runs at build time only; after hydration the app behaves as an SPA. Skew protection keeps previous build assets alive for clients with cached HTML — its build history lives in `node_modules/.cache/nuxt-seo/skew-protection`, preserved by the cache step in `publish.yml`.
6 changes: 3 additions & 3 deletions app/components/NavigationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/>
</NuxtLink>
<NuxtLink
to="/como-calcular-juros-da-poupanca"
to="/como-calcular-juros-da-poupanca/"
exact-active-class="bg-emerald-50 text-emerald-700! dark:bg-emerald-950/60 dark:text-emerald-300!"
class="group inline-flex items-center justify-center w-10 h-10 rounded-full text-slate-600 dark:text-slate-300 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500 dark:focus-visible:ring-emerald-400"
aria-label="Savings Account Calculator Guide"
Expand All @@ -27,7 +27,7 @@
/>
</NuxtLink>
<NuxtLink
to="/como-calcular-imposto-de-renda"
to="/como-calcular-imposto-de-renda/"
exact-active-class="bg-emerald-50 text-emerald-700! dark:bg-emerald-950/60 dark:text-emerald-300!"
class="group inline-flex items-center justify-center w-10 h-10 rounded-full text-slate-600 dark:text-slate-300 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500 dark:focus-visible:ring-emerald-400"
aria-label="Income Tax Calculation Guide"
Expand All @@ -40,7 +40,7 @@
/>
</NuxtLink>
<NuxtLink
to="/sobre"
to="/sobre/"
exact-active-class="bg-emerald-50 text-emerald-700! dark:bg-emerald-950/60 dark:text-emerald-300!"
class="group inline-flex items-center justify-center w-10 h-10 rounded-full text-slate-600 dark:text-slate-300 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500 dark:focus-visible:ring-emerald-400"
aria-label="Information"
Expand Down
114 changes: 114 additions & 0 deletions app/components/OgImage/Main.satori.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<script setup lang="ts">
// Rendered at build time by nuxt-og-image (Satori renderer) — see README of
// nuxt-og-image for the template constraints: inline styles + simple flex
// utilities only, no browser APIs.
const props = defineProps<{
title?: string
description?: string
}>()
</script>

<template>
<div
class="w-full h-full flex flex-col justify-center items-center relative p-[60px]"
style="background-color: #020617; color: #f8fafc; display: flex; flex-direction: column;"
>
<!-- Accent gradients: amber (Poupança) bottom-right, sky (CDB) top-left -->
<div
class="absolute top-0 left-0 right-0 bottom-0"
:style="{
backgroundImage: 'radial-gradient(ellipse 100% 100% at 100% 100%, rgba(245, 158, 11, 0.2) 0%, transparent 60%)',
}"
/>
<div
class="absolute top-0 left-0 right-0 bottom-0"
:style="{
backgroundImage: 'radial-gradient(ellipse 100% 100% at 0% 0%, rgba(14, 165, 233, 0.15) 0%, transparent 50%)',
}"
/>

<div
class="w-full flex-col justify-center items-center text-center relative"
style="display: flex; flex-direction: column; gap: 24px;"
>
<!-- Brand lockup -->
<div style="display: flex; align-items: center; justify-content: center; gap: 12px;">
<svg
viewBox="0 0 64 64"
style="width: 64px; height: 64px;"
>
<rect
x="8"
y="6"
width="48"
height="52"
rx="6"
fill="none"
stroke="#fbbf24"
stroke-width="4"
/>
<rect
x="16"
y="14"
width="24"
height="6"
rx="3"
fill="#38bdf8"
/>
<rect
x="16"
y="26"
width="32"
height="4"
rx="2"
fill="#475569"
/>
<rect
x="16"
y="34"
width="32"
height="4"
rx="2"
fill="#475569"
/>
<rect
x="16"
y="42"
width="20"
height="4"
rx="2"
fill="#475569"
/>
</svg>
<div style="display: flex; font-size: 44px; font-weight: 700; letter-spacing: -1px;">
<span>Calculadora&nbsp;</span><span style="color: #fbbf24;">de Renda Fixa</span>
</div>
</div>

<!-- Page title -->
<h1
v-if="props.title"
style="display: block; margin: 0; font-size: 56px; font-weight: 700; line-height: 1.1; max-width: 1000px; text-wrap: balance;"
>
{{ props.title }}
</h1>

<!-- Page description -->
<p
v-if="props.description"
style="display: block; margin: 0; font-size: 28px; opacity: 0.7; max-width: 850px; line-height: 1.4;"
>
{{ props.description }}
</p>

<!-- Site URL pill -->
<div style="display: flex; margin-top: 8px;">
<div
style="display: flex; padding: 8px 24px; border-radius: 9999px; border: 2px solid #334155; font-size: 20px; color: #94a3b8;"
>
rendafixa.github.io
</div>
</div>
</div>
</div>
</template>
4 changes: 2 additions & 2 deletions app/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
class="w-12 h-12"
>
</NuxtLink>
<h1 class="ml-3 text-xl font-semibold text-slate-950 dark:text-slate-50 hidden sm:block whitespace-nowrap transition-colors">
Calculadora Renda Fixa
<h1 class="ml-3 text-xl font-semibold text-slate-950 dark:text-slate-50 whitespace-nowrap transition-colors hidden sm:block">
Calculadora de Renda Fixa
</h1>
</div>
<NavigationBar />
Expand Down
56 changes: 56 additions & 0 deletions app/pages/como-calcular-imposto-de-renda.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@
<em>Nota:</em> Embora isenta de IR, a poupança geralmente oferece rentabilidade menor que CDB ou LCI. A escolha depende do seu objetivo (liquidez, segurança ou rentabilidade).
</p>

<h3>Perguntas frequentes</h3>
<h4>Quais são as alíquotas do IR em aplicações de renda fixa?</h4>
<p>
O IR é cobrado de forma regressiva conforme o prazo de aplicação: 22,5% até 180 dias, 20% de 181 a 360 dias, 17,5% de 361 a 720 dias e 15%
acima de 720 dias.
</p>
<h4>Quando incide IOF sobre os rendimentos?</h4>
<p>
Em resgates feitos em até 30 dias do aporte incide IOF regressivo sobre os rendimentos (96% no primeiro dia, chegando a 0% no dia 30). O IOF
reduz o ganho antes da aplicação do IR.
</p>
<h4>Quais investimentos são isentos de IR para pessoa física?</h4>
<p>
LCI, LCA e Poupança são isentos de IR para pessoa física, conforme a legislação vigente. Verifique sempre as condições contratuais e
eventuais alterações legislativas.
</p>

<h3>Observações importantes</h3>
<ul>
<li>As regras tributárias podem mudar; use sempre fontes oficiais para confirmar alíquotas e procedimentos.</li>
Expand Down Expand Up @@ -202,5 +219,44 @@
useSeoMeta({
title: 'Como Calcular Imposto de Renda sobre Investimentos',
description: 'Guia prático para calcular IR e IOF em aplicações financeiras (CDB, LCI/LCA, Poupança) com referências oficiais',
twitterCard: 'summary_large_image',
})

useSchemaOrg([
{
'@type': 'FAQPage',
'mainEntity': [
{
'@type': 'Question',
'name': 'Quais são as alíquotas do IR em aplicações de renda fixa?',
'acceptedAnswer': {
'@type': 'Answer',
'text': 'O IR é cobrado de forma regressiva conforme o prazo de aplicação: 22,5% até 180 dias, 20% de 181 a 360 dias, 17,5% de 361 a 720 dias e 15% acima de 720 dias.',
},
},
{
'@type': 'Question',
'name': 'Quando incide IOF sobre os rendimentos?',
'acceptedAnswer': {
'@type': 'Answer',
'text': 'Em resgates feitos em até 30 dias do aporte incide IOF regressivo sobre os rendimentos (96% no primeiro dia, chegando a 0% no dia 30). O IOF reduz o ganho antes da aplicação do IR.',
},
},
{
'@type': 'Question',
'name': 'Quais investimentos são isentos de IR para pessoa física?',
'acceptedAnswer': {
'@type': 'Answer',
'text': 'LCI, LCA e Poupança são isentos de IR para pessoa física, conforme a legislação vigente. Verifique sempre as condições contratuais e eventuais alterações legislativas.',
},
},
],
},
defineBreadcrumb({
itemListElement: [
{ name: 'Início', item: '/' },
{ name: 'Como Calcular Imposto de Renda', item: '/como-calcular-imposto-de-renda/' },
],
}),
])
</script>
56 changes: 55 additions & 1 deletion app/pages/como-calcular-juros-da-poupanca.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,25 @@
<h3>Impostos na Poupança</h3>
<p>
A poupança é isenta de imposto de renda, ou seja, os rendimentos não sofrem desconto de IR. Para entender melhor como funcionam os impostos em outros investimentos de renda fixa, confira nosso guia sobre <NuxtLink
to="/como-calcular-imposto-de-renda"
to="/como-calcular-imposto-de-renda/"
class="text-emerald-700 dark:text-emerald-400 hover:text-emerald-800 dark:hover:text-emerald-300 underline"
>como calcular o imposto de renda</NuxtLink>.
</p>
<h3>Perguntas frequentes</h3>
<h4>Como a poupança é remunerada?</h4>
<p>
A remuneração é composta pela Taxa Referencial (TR) mais uma parcela adicional: 0,5% ao mês quando a meta da Selic for superior a 8,5% ao
ano, ou 70% da meta da Selic mensalizada quando for igual ou inferior a 8,5%.
</p>
<h4>Quando os rendimentos da poupança são creditados?</h4>
<p>
Mensalmente, na data de aniversário da conta, para depósitos de pessoa física. Contas abertas nos dias 29, 30 e 31 têm como data de
aniversário o dia 1º do mês seguinte.
</p>
<h4>A poupança paga imposto de renda?</h4>
<p>
Não. Os rendimentos da caderneta de poupança são isentos de IR para pessoa física, conforme a legislação vigente.
</p>
<h3>Fontes Oficiais</h3>
<ul>
<li>
Expand All @@ -88,8 +103,47 @@ import { useInvestmentStore } from '~/stores/investment'
useSeoMeta({
title: 'Como Calcular Juros da Poupança',
description: 'Entenda como funciona o cálculo dos juros da poupança, incluindo regras da Selic, TR, datas de aniversário conforme fontes oficiais do Banco Central',
twitterCard: 'summary_large_image',
})

useSchemaOrg([
{
'@type': 'FAQPage',
'mainEntity': [
{
'@type': 'Question',
'name': 'Como a poupança é remunerada?',
'acceptedAnswer': {
'@type': 'Answer',
'text': 'A remuneração é composta pela Taxa Referencial (TR) mais uma parcela adicional: 0,5% ao mês quando a meta da Selic for superior a 8,5% ao ano, ou 70% da meta da Selic mensalizada quando for igual ou inferior a 8,5%.',
},
},
{
'@type': 'Question',
'name': 'Quando os rendimentos da poupança são creditados?',
'acceptedAnswer': {
'@type': 'Answer',
'text': 'Mensalmente, na data de aniversário da conta, para depósitos de pessoa física. Contas abertas nos dias 29, 30 e 31 têm como data de aniversário o dia 1º do mês seguinte.',
},
},
{
'@type': 'Question',
'name': 'A poupança paga imposto de renda?',
'acceptedAnswer': {
'@type': 'Answer',
'text': 'Não. Os rendimentos da caderneta de poupança são isentos de IR para pessoa física, conforme a legislação vigente.',
},
},
],
},
defineBreadcrumb({
itemListElement: [
{ name: 'Início', item: '/' },
{ name: 'Como Calcular Juros da Poupança', item: '/como-calcular-juros-da-poupanca/' },
],
}),
])

const investment = useInvestmentStore()

onMounted(() => {
Expand Down
Loading