SolarTech Operations Platform
An internal operations platform for a solar kit business. Documents arrive over WhatsApp, and every kit is tracked from purchase invoice to dispatch in a ledger that never leaves a partial state.
- Full-stack engineer
- Client project
- Next.js, TypeScript, Supabase, Better Auth, TanStack Query
Documents arrive on WhatsApp.
An external pipeline, Querygen, extracts purchase invoices, proformas and delivery challans into Supabase. SolarTech only ever reads those tables.
Every inward is checked.
A sync turns each new purchase invoice into an inward document awaiting review. Reviewers validate items, kit identity and global serial-number uniqueness.
Approval is one transaction.
Approving writes the ledger, updates balances and saves items and serials together, inside a single database transaction. Either all of it happens or none of it does.
Sales orders reserve stock.
A reviewed proforma becomes a confirmed sales order, and its kits move from available to reserved.
Dispatch consumes the reservation.
Specific inverter serials are assigned, reserved stock goes down, and every movement stays in an immutable ledger.

01 / Context
Inventory and operations for a solar kit business.
SolarTech is an internal, production-grade platform for running a solar kit business: purchases, stock, sales orders, dispatch, dealer payments and profitability.
The business's documents arrive over WhatsApp. An external extraction pipeline, Querygen, writes them into Supabase; SolarTech turns them into reviewed, auditable operations.
02 / Constraints
- Querygen's tables are read-only, so SolarTech needs its own mutable document model on top of them.
- Approvals and dispatches touch several tables and must never leave a partial state.
- Inverter serial numbers must be unique across every inward, globally.
- Access control has to be granular, additive and managed inside the app.
03 / Architecture
Three boundaries, each with one owner.
- Querygen (external)
- Supabase PostgreSQL
- SolarTech dashboard
04 / What it does
One lifecycle, six modules.
- Purchases and inward
- Discovers purchase invoices from Querygen and routes each one through review before stock is touched.
- Inventory ledger
- Available and reserved quantities per kit type, with every change recorded as an immutable movement.
- Proformas and sales orders
- Reviewed proformas become confirmed sales orders that reserve kits.
- Dispatch and delivery
- Dispatch consumes the reservation and assigns specific inverter serials.
- Payments
- Dealer payments linked to sales orders, verified or rejected by accounting staff.
- Analytics and expenses
- Inventory turnover, gross and net profit ratios, ROTA and cash-credit interest cost, with overheads tracked alongside.
05 / Implementation
Reads through PostgREST, writes in transactions.
Listings, dashboards and aggregations read through the Supabase JS client and PostgREST, for typed queries and pagination. Mutations that span tables, such as inward approval and dispatch, run as SQL on a direct pg pool inside BEGIN, COMMIT and ROLLBACK, because PostgREST can't run multi-statement transactions.
Better Auth owns identity, credentials and sessions; Supabase Auth isn't used. Every page resolves the session on the server, and new users must replace their temporary password before they can reach anything else.
Authorization is the app's own profile and privilege model. A user's privileges are the union of their profiles', with no deny rules. The Administrator profile holds every privilege without a code bypass, and database triggers stop it from being changed or deleted.
06 / What it does
The stack.
- Application
- Next.js App Router, React 19, TypeScript, Tailwind CSS v4
- Data
- Supabase PostgreSQL, supabase-js for reads, pg for transactional writes, sequential SQL migrations
- Auth
- Better Auth, with a custom profile-privilege model for authorization
- Interface
- TanStack Query and Table, React Hook Form with Zod, Recharts
07 / My role
- Requirements and scope
- Database schema and migrations
- Querygen document sync
- Transactional inward and dispatch
- Authentication and privileges
- Dashboards and analytics
I worked across the stack: turning the business's WhatsApp-driven process into a data model, writing the transactional workflows on top of it, and building the screens the team uses day to day.
Have a system that is too slow, or doesn't exist yet?