Skip to content

Sadoge/stockflow

Repository files navigation

StockFlow

StockFlow is a Flutter app for small distributors and sales teams that need a simple way to manage products, customers, orders, and on-hand stock from one mobile workflow. The app uses Supabase for authentication, data storage, and multi-company isolation.

What the app does

  • Shows a dashboard with today's sales, order count, recent orders, and low-stock alerts
  • Tracks products, pricing, units, and low-stock thresholds
  • Manages customer records with search and edit flows
  • Creates and reviews orders with pending and delivered states
  • Tracks inventory through stock transactions and manual stock adjustments
  • Keeps company data isolated through Supabase row-level security

Tech stack

  • Flutter
  • Riverpod and riverpod_generator
  • GoRouter
  • Supabase
  • Freezed and json_serializable

Project structure

lib/
  app/          App shell, routing, theme, configuration
  core/         Shared widgets, utilities, errors, extensions
  features/     Feature modules: auth, dashboard, customers, products, inventory, orders, settings
  shared/       Cross-feature providers
scripts/        Local scripts such as company provisioning
supabase/       Database schema and migration files

Getting started

1. Install dependencies

flutter pub get

2. Configure Supabase

The app reads Supabase credentials from Dart defines in lib/app/config/app_config.dart.

Required values:

  • SUPABASE_URL
  • SUPABASE_ANON_KEY

3. Apply the database schema

Apply supabase/migrations/20240001000000_initial_schema.sql to your Supabase project before running the app. This migration creates:

  • company, user, customer, product, order, order item, and stock transaction tables
  • row-level security policies for company isolation
  • an inventory view for aggregated stock
  • a signup trigger that creates the matching public.users profile row

4. Run the app

flutter run \
  --dart-define=SUPABASE_URL=https://your-project.supabase.co \
  --dart-define=SUPABASE_ANON_KEY=your-anon-key

Provisioning a company owner

The repository includes scripts/provision_company.dart to create:

  • a company
  • an owner auth user
  • the matching public.users profile

Example:

cd scripts
dart pub get
dart run provision_company.dart \
  --url https://your-project.supabase.co \
  --key your-service-role-key \
  --company "Acme Distribution" \
  --email owner@acme.com \
  --name "Owner Name" \
  --password changeme123

Useful commands

flutter analyze
dart run build_runner build --delete-conflicting-outputs
flutter test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors