Câmbio is a mobile-first web application for simulating currency conversion, focusing on the Brazilian Real and international currencies. The system allows you to calculate the effective cost of foreign currency buying and selling operations by considering not only the real-time commercial quotation, but also practical charges in the Brazilian market: exchange house spread and IOF (Tax on Financial Operations) according to the payment method.
- 100% Client-Side Execution (JAMStack): Static architecture without dependency on a proprietary
backend, ensuring low latency and free hosting via GitHub Pages; - Cost Transparency: Detailed breakdown between commercial value, spread increase, taxation, and final effective rate;
- Historical View: Rendering of variation charts from the last 30 days in native
SVG, avoiding heavy charting libraries.
| Layer | Tool | Function |
|---|---|---|
| User Interface | React + TypeScript | Componentization, typing, and state reactivity |
| Build & Bundler | Vite + NodeJS | Fast build, hot-reload, and production-optimized packaging |
| Styling | CSS3 | Monochrome design system with gold accents and theme support |
| Exchange Data | Frankfurter API | Fetching currency catalogs, daily quotes, and historical series |
| CI/CD & Hosting | GitHub Actions + GitHub Pages | Automated build and continuous publishing with every push to the branch |
The application uses the Frankfurter API, an open service based on reference data published by the European Central Bank, without the need for an authentication key.
-
Supported Currency Catalog
- Request:
GET /currencies - Usage: Populates the currency selector with
ISO 4217codes and descriptive names, prioritizing currencies with higher liquidity at the top of the list.
- Request:
-
Current Quotes
- Request:
GET /latest?from=BRL - Normalization: Since the API returns the amount in foreign currency per
1 BRL($R_{\text{BRL} \to X}$ ), the module performs the mathematical inversion to obtain the unit price of the foreign currency in Reais ($C_{\text{commercial}}$ ):
- Request:
- 30-Day Historical Series
- Request:
GET /{start_date}..{end_date}?from={CURRENCY}&to=BRL - Usage: Feeds the
PriceHistoryChart(src/ui/charts.tsx) component, calculating the minimum, maximum, and trend curve values of the period.
- Request:
Financial calculation is performed synchronously and deterministically whenever the user changes any input parameter.
-
currency: ISO code of the foreign currency; -
amount: Numeric value provided by the user; -
direction: Direction of operation:-
foreign_to_brl: The user enters how much they want to buy in foreign currency and finds out the total to pay in BRL; -
brl_to_foreign: The user enters how much they have in BRL and finds out how much they will receive in foreign currency;
-
-
paymentMethod: Modality that defines the standard IOF rate (cash_money=$1.1%$ for cash;prepaid_card=$3.5%$ for card/prepaid); -
exchangeHouseSpread: Percentage margin applied by the financial institution on the commercial quotation (default:$2.0%$ ); -
iofPercent: Percentage of tax levied on the operation.
Given a desired amount
-
Base value in Reais:
$V_{\text{base}} = M_{\text{est}} \times C_{\text{commercial}}$ -
Spread cost in BRL:
$V_{\text{spread}} = M_{\text{est}} \times (C_{\text{spread}} - C_{\text{commercial}})$ -
Taxable subtotal:
$V_{\text{sub}} = M_{\text{est}} \times C_{\text{spread}}$ -
IOF value in BRL:
$V_{\text{iof}} = V_{\text{sub}} \times \left(\frac{\text{IOF}}{100}\right)$
Total Payable in BRL:
Total Effective Rate:
Given a fixed budget
Total Effective Rate:
Amount Purchased in Foreign Currency:
The interface uses custom CSS variables applied to the data-theme attribute on the root element, persisting user preference via localStorage:
- Dark Mode
[data-theme="dark"]: Matte black background (#0C0C0C), graphite cards (#161616), and metallic gold accents (#D4AF37); - Light Mode
:root: Soft gray background (#F5F5F5), white cards (#FFFFFF), and dark gold accents (#B88B2A).
The PriceHistoryChart component maps the vector of historical points viewBox="0 0 420 140":
The rendering combines <polyline /> for the trendline and <polygon /> filled with a <linearGradient /> for visual highlight.
- NodeJS: v20+
- Package manager: npm
Install dependencies:
npm installRun development server
npm run devGenerating build of production and validating TypeScript typing
npm run buildEach push on the branch main:
- The Ubuntu runner checks out the code and configures NodeJS 22 width dependecy caching
npm ci; - Executes
npm run build, generating the optimized static assets indist/; - Packages the directory
dist/byactions/upload-pages-artifactand publishes in the environmentgithub-pagesbyactions/deploy-pages.
Note
Note about asset routing: When hosted in the default GitHub Pages subdirectory https://<user>.github.io/<repository>/, the property base in file vite.config.ts should reflect the exact repository name base: "/<repository>/". In domains configured via DNS record CNAME, uses base: "/".