How miphu2804/smart-ledger works
SmartLedger is an MVP for shop owners using a mobile app, with a separate admin web console and backend services. The owner flow is Firebase sign-in, Core session creation, optional shop onboarding, then shop workflows; mobile currently defaults to mock data, and shop/ledger APIs are not implemented. The admin console covers dashboards, customers, AI support, tasks, and settings, also mock-first. AI provides internal agent chat and persistent conversations, but Core does not call it. Some screens and integrations are represented from the tree and README rather than inspected implementation.
Main entry points: AppStore.tsx App state · main.py AI application setup · app Owner workflows · App.tsx Admin routes and pages
Components 25
Owner mobile
- Sign-in screens
frontend/mobile/app/(auth) - Session and onboarding
frontend/mobile/src/lib/sessionApi.ts - App state
frontend/mobile/src/store/AppStore.tsx - Owner workflows
frontend/mobile/app - Reports and stats
frontend/mobile/src/lib/useReport.ts - Mock shop data
frontend/mobile/src/data/mock.ts
Admin web
- Admin routes and pages
frontend/web/src/App.tsx - Task management
frontend/web/src/pages/admin/TasksPage.tsx - Task service
frontend/web/src/services/taskService.ts - Admin data services
frontend/web/src/services
Core API
- Session endpoint
backend/core/src/main/java/com/smartledger/core/controller/AuthController.java - Session service
backend/core/src/main/java/com/smartledger/core/service/AuthSessionService.java - Identity and shop records
backend/core/src/main/java/com/smartledger/core/entity
AI service
- Agent routes
backend/ai/src/agent/routers.py - Agent orchestration
backend/ai/src/agent/service.py - Conversation repository
backend/ai/src/agent/repository.py - Agent tools
backend/ai/src/agent/tools.py - Chat model provider
backend/ai/src/providers/factory.py - AI application setup
backend/ai/src/main.py
Persistence
- Postgres client
backend/ai/src/infra/postgre_db_client.py - PostgreSQL
- Redis client
backend/ai/src/infra/redis_db_client.py - Redis
Other components
- Shop owner
- Firebase identity
Connections 26
- Shop owner → Sign-in screens: signs in
README.md - Sign-in screens → App state: updates session
- App state → Session and onboarding: creates session
frontend/mobile/src/store/AppStore.tsx - Session and onboarding → Session endpoint: requests session
frontend/mobile/src/lib/sessionApi.ts - Session endpoint → Session service: opens session
backend/core/src/main/java/com/smartledger/core/controller/AuthController.java - Session service → Identity and shop records: reads and writes
backend/core/src/main/java/com/smartledger/core/service/AuthSessionService.java - Firebase identity → Session endpoint: verifies identity
- App state → Mock shop data: loads mock state
frontend/mobile/src/store/AppStore.tsx - App state → Owner workflows: serves workflows
frontend/mobile/app/(tabs)/index.tsx - Owner workflows → Reports and stats: requests report
frontend/mobile/app/(tabs)/index.tsx - Reports and stats → App state: reads shop data
frontend/mobile/src/lib/useReport.ts - Owner workflows → Mock shop data: uses sample flows
frontend/mobile/app/voice.tsx - Shop owner → Admin routes and pages: administers platform
- Admin routes and pages → Task management: routes to tasks
frontend/web/src/App.tsx - Task management → Task service: loads and updates
frontend/web/src/pages/admin/TasksPage.tsx - Admin routes and pages → Admin data services: routes admin areas
- AI application setup → Agent routes: registers routes
backend/ai/src/main.py - Agent routes → Agent orchestration: dispatches requests
backend/ai/src/agent/routers.py - Agent orchestration → Conversation repository: loads and saves chats
backend/ai/src/agent/service.py - Agent orchestration → Agent tools: builds agent tools
backend/ai/src/agent/service.py - AI application setup → Chat model provider: builds model
backend/ai/src/main.py - AI application setup → Postgres client: connects at startup
backend/ai/src/main.py - AI application setup → Redis client: connects at startup
backend/ai/src/main.py - Conversation repository → Postgres client: runs transactions
backend/ai/src/agent/repository.py - Postgres client → PostgreSQL: persists conversations
- Redis client → Redis: connects