FinTrack is a mobile financial control application developed in React Native + Expo for the Android environment. The goal is to provide a complete tool for managing personal finances (income and expenses), utilizing the React Context API for global state management and Firebase Firestore for cloud data persistence with real-time synchronization.
This project was created for the course Development on Android Mobile Devices, demonstrating proficiency in using cross-platform technologies, architectural patterns (DAO), and cloud service integration to create robust and scalable solutions.
The application covers the following key areas:
- Transaction CRUD: Add, list (ordered by date), edit, and delete incomes and expenses with real-time synchronization.
- Category CRUD: Add, edit, and delete custom categories using Ionicons.
- Budget Management: Set spending limits (goals) per category and track progress with a visual progress bar and over-limit alerts.
- Dashboard (Overview): Dynamically displays total balance, total income, and total expenses.
- Reports & Charts: Features pie charts showing the distribution of income and expenses for the current month, as well as a financial evolution line chart.
- Cloud Persistence: Uses Firebase Firestore to securely save all transactions, categories, and budgets.
- Real-time Synchronization: Data changes appear instantly across all connected devices.
- Offline Support: Firestore maintains a local cache, allowing offline use with automatic sync once the connection is restored.
| Category | Technology | Justification |
|---|---|---|
| Mobile Framework | React Native (with Expo) | Allows building native apps for Android (and iOS) using JavaScript. |
| Language | JavaScript (ES6+) | The standard for React Native development. |
| Navigation | React Navigation | Manages the flow between screens (Tabs & Stacks). |
| State Management | React Context API | Centralizes and provides global state (transactions, categories) and CRUD functions. |
| Backend/Database | Firebase Firestore | Cloud NoSQL database with real-time sync and offline support. |
| Data Access Layer | DAO Pattern | Isolates database access logic into dedicated modules (e.g., CategoriaDAO). |
| Authentication | Firebase Auth | (Planned) User management and access control. |
| Hosting | Firebase Hosting | Deployment for the web version of the application. |
| Visualization | react-native-chart-kit |
Library for creating interactive pie and line charts. |
| UI Components | @react-native-picker/picker |
Native component for category selection in forms. |
| Icons | @expo/vector-icons |
Vector icon library (Ionicons) for the user interface. |
Ensure you have the following installed:
- Node.js (LTS): JavaScript runtime environment - Download
- npm (or Yarn): Package manager (comes with Node.js)
- Expo CLI (Globally):
npm install -g expo-cli - Visual Studio Code (VS Code): Recommended code editor
- Expo Go App: Installed on your Android phone (Google Play Store) or on an Android emulator
- Google/Firebase Account: To set up the project in the Firebase Console
- Create a project in the Firebase Console.
- Enable Firestore Database:
- Go to "Build" β "Firestore Database" β "Create database".
- Choose Test Mode (temporarily) or configure your security rules.
- Register the Web App:
- Go to "Project Overview" β "Add app" β Select Web (
</>). - Copy the
firebaseConfigcredentials.
- Go to "Project Overview" β "Add app" β Select Web (
- Configure Credentials:
- Open the
config/firebaseConfig.jsfile in the project. - Replace the placeholder credentials with your actual Firebase credentials.
- Open the
- Configure Firestore Rules (optional):
- In the Firebase Console, go to "Firestore Database" β "Rules"
- For development, use:
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: true; } } }
β οΈ Important: For production, implement appropriate security rules
-
Clone the Repository:
git clone https://github.com/Lorenzo-Zagallo/react-native-fintrack.git cd react-native-fintrack -
Install Dependencies:
npm install
-
Configure Firebase:
- Edit
config/firebaseConfig.jswith your credentials
- Edit
-
Start the Development Server:
npm start
or to clear the cache:
npm start -c
-
Run on Android Device/Emulador:
- Android Device: Open the Expo Go app and scan the QR Code displayed in the terminal.
- Android Emulator: Press
ain the terminal where Expo is running. - Web Navigator: Press
win the terminal (for testing purposes only, some native features may not work)
npm start # Starts the development server
npm start -c # Starts with a clean cache
npx expo start # Alternative to npm start- Firebase connection error: Verify that the credentials in
firebaseConfig.jsare correct. - Cache error: Run
npm start -cto clear the Metro Bundler cache. - QR Code not working: Make sure your phone and computer are on the same Wi-Fi network.
- Missing dependencies: Delete
node_modulesandpackage-lock.json, then runnpm installagain.
.
βββ assets/ # Icons, fonts, and static images
βββ config/ # Firebase configuration
β βββ firebaseConfig.js
βββ context/ # Global state management logic
β βββ ContextoFinancas.js
βββ dao/ # Data Access Object layer
β βββ CategoriaDAO.js
β βββ TransacaoDAO.js
β βββ OrcamentoDAO.js
β βββ MetaDAO.js
βββ navigation/ # Navigation setup (Tabs and Stacks)
β βββ TabNavigation.js
β βββ StackTransacao.js
β βββ StackOrcamento.js
β βββ StackPainel.js
β βββ StackRelatorio.js
βββ screens/ # Main application screens and forms
β βββ Dashboard/ # Main overview screen
β β βββ TelaPainel.js
β βββ Transactions/ # Transaction management
β β βββ TelaTransacao.js
β β βββ TelaAddTransacao.js
β βββ Budgets/ # Budget and category management
β β βββ TelaOrcamento.js
β β βββ TelaAddCategoria.js
β βββ Reports/ # Charts and financial reports
β βββ TelaRelatorio.js
βββ .firebaserc # Firebase project configuration
βββ firebase.json # Firebase Hosting configuration
βββ App.js # Main entry point
βββ index.js # Application bootstrap
βββ package.json # Project dependencies
The project implements the DAO pattern to separate business logic from data access logic, ensuring clean architecture:
- CategoriaDAO.js: CRUD for categories (add, update, delete, listen)
- TransacaoDAO.js: CRUD for transactions sorted by date
- OrcamentoDAO.js: CRUD for budgets by category
- MetaDAO.js: CRUD for financial goals
- UI (Screens) β triggers an action (e.g., Add Transaction).
- Context (ContextoFinancas.js) β validates the input and calls the appropriate DAO.
- DAO β executes the operation on Firestore (
addDoc,updateDoc,deleteDoc) - Firestore β persists the data and notifies all active listeners.
- DAO (
onSnapshot) β detects the change and triggers a callback. - Context β updates the global state (
setState). - UI β automatically re-renders with the fresh data.
The Context establishes listeners (via onSnapshot) for all Firestore collections:
useEffect(() => {
const unsubscribeCategorias = CategoriaDAO.ouvirCategorias(setCategorias);
const unsubscribeTransacoes = TransacaoDAO.ouvirTransacoes(setTransacoes);
const unsubscribeOrcamentos = OrcamentoDAO.ouvirOrcamentos(setOrcamentos);
return () => {
unsubscribeCategorias();
unsubscribeTransacoes();
unsubscribeOrcamentos();
};
}, []);Any change to the database (from any device) automatically updates all connected clients.
{
id: "auto-gerado", // Unique Firestore ID
nome: "AlimentaΓ§Γ£o", // Category name
tipo: "expense", // "income" | "expense"
cor: "#FF6384" // Color for graphics (hex)
}{
id: "auto-gerado", // Unique Firestore ID
tipo: "expense", // "income" | "expense"
valor: 150.50, // Transaction value
descricao: "AlmoΓ§o", // Description
categoriaId: "ref-id", // Category reference
data: "2025-11-24" // Date format YYYY-MM-DD
}{
id: "categoria-id", // Category ID (document)
categoriaId: "ref-id", // Category reference
valorLimite: 500.00 // Spending limit
}{
id: "auto-gerado", // Unique Firestore ID
nome: "Viagem 2025", // Goal name
descricao: "...", // Detailed description
valorAlvo: 5000.00, // Target value
valorAtual: 1200.00, // Amount already saved
prazo: "2025-12-31" // Deadline
}- β Add income and expenses with field validation
- β List all transactions sorted by date (newest first)
- β Edit existing transactions
- β Delete transactions with confirmation
- β Filter by category in the picker (only categories of the selected type)
- β Date input mask (DD/MM/YYYY)
- β Create custom categories (income or expense)
- β Ionicons icon selection
- β Edit existing categories
- β Cascading deletion (removes transactions and associated budgets)
- β Duplicate name validation
- β Set spending limit per category
- β Visual progress bar (% spent vs. budget)
- β Visual alerts (80% = yellow, >100% = red)
- β Automatic calculation of expenses by category in the current month
- β Total balance (income - expenses)
- β Total income for the period
- β Total expenses for the period
- β Real-time updates
- β Pie chart: distribution of expenses by category (current month)
- β Pie chart: distribution of income by category (current month)
- β Line graph: financial evolution (last 6 months)
- β Custom colors by category
- β Input validation in all forms
- β Error handling with try/catch in Firebase operations
- β
Global error state (
error) exposed in the Context - β Normalization of numeric values ββbefore saving
- β Cascading deletion to maintain data consistency
- π Firebase Authentication (login with Google/email)
- π Firestore security rules (access only to own data)
- π User permission validation
- π Encryption of sensitive data
- π Rate limiting and abuse protection
- Frontend & User Interface Development
- Screen implementation and navigation flow
- Presentation logic and UI/UX Design
- Full Firebase integration (Firestore + Hosting)
- Implementation of the DAO architecture
- Real-time synchronization and documentation
- React Native Documentation
- Expo Documentation
- Firebase Documentation
- React Navigation
- Firestore Guide
This project was developed for academic purposs during the Mobile Device Programming (Android) course at UNESA (2025).
- Students: Lorenzo Zagallo & Matheus Fonseca
- Subject: ProgramaΓ§Γ£o Para Dispositivos MΓ³veis em Android
- Institution: UNESA - Universidade EstΓ‘cio de SΓ‘
- Year: 2025
This project is no longer under development. Contributions, suggestions, and constructive criticism are welcome!