How aman-lab1/aman-agrovet works
AMAN Agrovet V3 is an early-stage poultry-management web application: the README says business modules, database migrations, Firebase authentication, and financial calculations remain planned. The current runtime provides a React interface, passcode-based API authentication, and initial house, flock-batch, employee, user, and audit-log capabilities. Users enter through authenticated routes; the frontend calls an Express API, whose handlers access PostgreSQL. Other operational pages are present as scaffolding or previews. Edges reflect excerpts, indexed imports, or README statements; unsampled route and domain behavior is not assumed.
Main entry points: db/index.ts PostgreSQL access · App.tsx Authenticated app · routes/index.ts API routes · apiClient.ts API client
Components 21
Web client
- Authenticated app
frontend/src/App.tsx - Session context
frontend/src/contexts/AuthContext.tsx - Login page
frontend/src/pages/auth/LoginPage.tsx - Dashboard preview
frontend/src/pages/dashboard/DashboardPage.tsx - Operations pages
frontend/src/pages - Admin pages
frontend/src/pages - API client
frontend/src/services/apiClient.ts - Production and finance
frontend/src/pages/egg-production/EggProductionPage.tsx
API and access
- Express API
backend/src/app.ts - API routes
backend/src/routes/index.ts - Auth middleware
backend/src/middleware/auth.ts - Error handling
backend/src/middleware/errorHandler.ts
Farm operations
- Houses
backend/src/controllers/houses.controller.ts - Flock batches
backend/src/controllers/batches.controller.ts - Employees
backend/src/controllers/employees.controller.ts - User management
backend/src/controllers/users.controller.ts
Persistence and audit
- Domain schemas
backend/src/db/schema - PostgreSQL access
backend/src/db/index.ts - Audit logging
backend/src/services/audit.service.ts
Other components
- Business user
- PostgreSQL
Connections 28
- Business user → Authenticated app: uses
frontend/src/App.tsx - Authenticated app → Session context: provides session
frontend/src/App.tsx - Authenticated app → Login page: shows when signed out
frontend/src/App.tsx - Authenticated app → Dashboard preview: routes to
frontend/src/App.tsx - Authenticated app → Operations pages: routes to
frontend/src/App.tsx - Authenticated app → Admin pages: routes to
frontend/src/App.tsx - Session context → API client: authenticates through
frontend/src/contexts/AuthContext.tsx - Dashboard preview → Operations pages: uses flock calculations
frontend/src/pages/dashboard/DashboardPage.tsx - Operations pages → API client: requests data
frontend/src/pages/egg-production/EggProductionPage.tsx - Admin pages → API client: requests data
frontend/src/pages/audit-logs/AuditLogsPage.tsx - API client → Express API: sends HTTP requests
- Express API → API routes: mounts routes
backend/src/app.ts - API routes → Auth middleware: applies auth
- API routes → Flock batches: dispatches batch requests
- API routes → Employees: dispatches employee requests
- API routes → Houses: dispatches house requests
- API routes → User management: dispatches user requests
- Flock batches → PostgreSQL access: queries and updates
backend/src/controllers/batches.controller.ts - Employees → PostgreSQL access: queries and updates
backend/src/controllers/employees.controller.ts - Houses → PostgreSQL access: queries and updates
backend/src/controllers/houses.controller.ts - User management → PostgreSQL access: queries and updates
backend/src/controllers/users.controller.ts - PostgreSQL access → Domain schemas: loads schema
backend/src/db/index.ts - PostgreSQL access → PostgreSQL: connects
backend/src/db/index.ts - Flock batches → Audit logging: writes audit entries
backend/src/controllers/batches.controller.ts - Employees → Audit logging: writes audit entries
backend/src/controllers/employees.controller.ts - Houses → Audit logging: writes audit entries
backend/src/controllers/houses.controller.ts - Audit logging → PostgreSQL access: inserts audit records
backend/src/services/audit.service.ts - Error handling → Express API: formats errors
backend/src/app.ts