A high-performance, beautiful Progressive Web Application built for boutique solar installation management.
Engineered for instantaneous hydration, absolute network parallelization, and zero-latency operational control. Designed with an immersive, enterprise-grade aesthetic that prioritizes readability, context, and a bento-style fluid layout.
BOB Solar uses a highly decoupled Server Component + Client Island hybrid architecture built on top of Next.js App Router and serverless edge tools. It strictly adheres to Single Source of Truth (SSoT) principles and Double-Entry Accounting.
graph LR
A[Next.js App UI Shell] -->|PWA Edge Handshake| B[Vercel Server Runtime]
B -->|Drizzle WS Caching| C[(Neon Serverless DB)]
B -->|Streaming Pipeline| D[Vercel Blob Storage]
- Zero Layout Shifts (CLS): Initial shells render purely on the server, forwarding pre-fetched static state directly into interactive hydration boundaries.
- Concurrent DB Execution: Independent dashboard aggregates and heavy table-scan workflows fire concurrently via array-mapped
Promise.allresolution loops. - Dynamic Lazy Boundaries: PDF rendering cores (
@react-pdf/renderer) and dense analytical chart sheets remain dynamically separated (next/dynamic) until directly requested by the client.
[ Customers / Suppliers ] ──► [ Catalog / Warehouse ] ──► [ Quotation Engine ] ──► [ Executable Projects ] ──► [ Warranty Care ]
- Client & Leads Registration: Managed with structured PostgreSQL state histories tracking active deployment addresses.
- SSoT Catalog & Warehouse: Live price ledgers managed centrally. Real warehouse stock quantities are securely tracked through strict Double-Entry ledger constraints linked to Purchase Orders.
- Quotation Dossier Generation: Fully interactive line-item builders capturing immutable pricing snapshots supporting custom discount calculations and custom layout streaming to branded PDF downloads.
- Active Project Commissioning: Live cost tracking tracking itemized labor, logistics, and material disbursements against projected limits, publishing real-time budget overruns automatically.
- Aftersales Warranty Cadence: Long-term tracking triggers signaling automated component follow-ups, system inversions, and hardware warranty alerts.
Ensure you have pnpm v11+ and Node.js v20+ configured locally.
# Clone and install locked dependencies
pnpm installClone the runtime mapping template:
cp .env.example .env.localConfigure local environment keys within .env.local:
DATABASE_URL: Connection string to your primary Neon Serverless instance.TEST_DATABASE_URL: Dedicated branch string for end-to-end integration verifications.SESSION_SECRET: 32-character secure secret string signinghttpOnlyauth cookies.BLOB_READ_WRITE_TOKEN: Vercel Blob API key enabling logo asset streaming.
Provision your database schema definitions and inject standard configurations:
# Run controlled SQL migrations against your development database
pnpm db:migrate
# Seed basic inventory items and default settings
pnpm db:seedProduction note: Always use
pnpm db:migrate(not push) for production databases. For the isolated test database usepnpm db:migrate:test.
Start the client server environment:
pnpm devNavigate to http://localhost:3000 to interact with the application.
Use these pnpm scripts to keep code, tests, and DB checks green before deployment.
pnpm green:code: Runs code-only gate: strict typecheck, Biome linting/formatting, and non-DB unit tests.pnpm green:db: Runs DB gate on test database viapnpm test:db.pnpm green: Full local CI gate:green:code→green:db→ production build.
pnpm biome:check: Runs Biome lint rules and formatting diagnostics.pnpm biome:fix: Applies safe Biome lint fixes and formatting automatically.pnpm typecheck: Validates TypeScript strict constraints without emitting output.
pnpm db:migrate: Runs controlled SQL migrations against the database (use for development and production).pnpm db:migrate:test: Syncs schema to the isolated test database (TEST_DATABASE_URL) before running integration tests.pnpm db:baseline: Backfills the Drizzle migrations history if the database is ahead of local tracking.pnpm db:test:ping: Quick connectivity probe for yourTEST_DATABASE_URL.
⚠️ Production deployments must usepnpm db:migrate(usesDATABASE_URL_DIRECT). Never use push-style schema sync against a production database — it bypasses migration history and is irreversible.
Recommended Daily Flow:
pnpm green:codeduring feature work.pnpm db:migrateto apply any new schema migrations.pnpm greenas the final deploy gate before merging to production.
bobsolar/
├── src/
│ ├── app/ # Hybrid Server Components & Route API Handlers
│ ├── actions/ # Server Actions handling secure transactional logic
│ ├── components/ # Reusable "Solar Flow" interface components & islands
│ ├── hooks/ # Typed TanStack Query data synchronization wrappers
│ ├── lib/ # Core configuration helpers: auth, db, pricing, validators
│ └── stores/ # Zustand global interface settings stores
├── docs/ # CODE_WIKI.md
├── drizzle/ # Serialized SQL schema migrations
└── public/ # Standalone static media and PWA launcher icons
Private proprietary operations portal built exclusively for BOB Solar internal workflows. All rights reserved.