Skip to content

ChamikaCSA/logbook

Repository files navigation

LogBook - Financial Balancing and Business Insights

A cross-platform mobile application for timber service SMEs, built with Flutter and Supabase.

Features

  • Authentication: Secure login and registration with Supabase Auth
  • Dashboard: Net profit, revenue, expenses, and cost distribution (donut chart)
  • Ledger: Transaction list with search, grouped by date
  • Add Transaction: Income/expense form with timber-specific categories
  • Revenue Insights: Trend chart and forecasting (seasonal regression, random forest, SARIMA-class models via optional API)
  • Financial Reports: Monthly/quarterly PDF generation and sharing
  • Settings: Profile and logout

Setup

Prerequisites

  • Flutter SDK (^3.11.1)
  • Supabase project
  • (Optional) Python 3.10+ for forecasting API

1. Clone and install

cd logbook
flutter pub get

2. Supabase

The app is pre-configured with a Supabase project. To use your own:

  1. Create a project at supabase.com
  2. Copy .env.example to .env and add your Supabase URL and anon key
  3. Run migrations: Supabase Dashboard → SQL Editor → run all files in supabase/migrations/
  4. (Optional) Seed data: run supabase/seed.sql in the SQL Editor. This inserts sample transactions for the first user. Sign up in the app first if you want demo data.

Forgot password (OTP): The app uses an 8-digit OTP instead of a reset link. In Supabase Dashboard → Authentication → Email Templates, edit the Reset password template to use {{ .Token }} instead of the confirmation URL, e.g.:

<h2>Reset your password</h2>
<p>Enter this code in the app: {{ .Token }}</p>

3. Run the app

flutter run

4. (Optional) Forecasting API

cd forecasting_api
python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Add to .env (see .env.example):

  • iOS simulator, macOS, web: FORECAST_API_URL=http://127.0.0.1:8000
  • Android emulator (host machine): FORECAST_API_URL=http://10.0.2.2:8000

The Insights screen sends your full monthly income history (with yyyy-MM labels) to POST /forecast. The Python service fits naive, seasonal naive, linear regression (trend + 12‑month season), random forest, and SARIMAX (orders depend on history length), picks the best on a small hold-out window when there is enough data, and returns MAE / RMSE / MAPE for the chosen method vs baselines in the JSON (shown in the chart info sheet when present). If FORECAST_API_URL is unset or the API is unreachable, only recorded income is shown.

Using --host 0.0.0.0 lets physical devices on the same LAN reach the API if you set FORECAST_API_URL to your machine’s LAN IP.

Project Structure

lib/
├── main.dart
├── app/                    # bootstrap, root widget, auth gate, main shell, providers
├── core/                   # app config, theme, Supabase init, networking, utils
│   ├── config/
│   ├── network/
│   ├── supabase/
│   ├── theme/
│   └── utils/
├── features/
│   ├── auth/               # application + presentation (login, register, password)
│   ├── categories/         # category repository
│   ├── dashboard/
│   ├── insights/           # forecast client + insights UI
│   ├── organization/       # organization repository
│   ├── reports/            # report service + PDF UI
│   ├── settings/
│   └── transactions/       # repository, offline queue, ledger + add transaction screens
└── shared/                 # reusable UI + widgets
    ├── ui/
    └── widgets/

Tech Stack

  • Frontend: Flutter, Provider, fl_chart, google_fonts
  • Backend: Supabase (PostgreSQL, Auth)
  • Reports: pdf, printing, share_plus
  • Forecasting: Python FastAPI, pandas, scikit-learn, statsmodels (optional)

About

Cross-platform Flutter app for timber-service SMEs to track income/expenses, monitor profit, and run role-based financial operations with Supabase. It supports offline transaction sync, monthly/quarterly PDF reports, and ML revenue forecasting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors