Experience Layer
User-facing surfaces for marketing conversion, product usage, and admin operations.
- /Marketing pages and localized routing
- /App dashboard and task workflows
- /Admin console for operations and model management
System Blueprint
This page explains how Bunship composes runtime, domain modules, and shared packages into a scalable SaaS foundation.
10+
Workspace packages
6
Core domains
3
Built-in surfaces
Request Lifecycle
From user action to business result: the pipeline below reflects how major requests are handled.
Entry Surface
A request starts in Marketing, App, or Admin routes under locale-aware Next.js App Router segments.
Validation & Auth
Session context, role checks, and schema validation are resolved before touching domain services.
Domain Execution
Pricing, orders, content, and AI generation modules execute business rules in isolated services.
Data & Provider Layer
Drizzle-powered persistence and external provider calls are coordinated with retries and limits.
Feedback Loop
The UI gets deterministic states for success, failure, and loading, including credits and billing updates.
Design Principles
Application Layers
Each layer has a strict responsibility to keep system behavior predictable as your product grows.
User-facing surfaces for marketing conversion, product usage, and admin operations.
Business modules that govern pricing, subscriptions, content, and AI generation behavior.
Adapters for authentication, payment providers, storage, and model providers.
Persistent state, migrations, and shared typed access through workspace packages.
Multi-Cloud Storage
Uploads are resolved through a provider factory at request time, allowing per-user provider and bucket routing within one deployment.
App Upload
POST /api/v1/s3/upload
Resolves provider + bucket from current user context before executing upload.
Admin Upload
POST /api/v1/admin/s3/upload
Handles admin assets and operations uploads with the same provider resolution logic.
Provider Factory
apps/ship-api/src/services/upload/provider.ts
Unifies default settings, per-user overrides, and environment fallback handling.
Task Queue Guarantees
Generation and provider work is driven by a scheduler-aware queue that controls throughput, retries safely, and prevents duplicate financial side effects.
Throughput
Worker slots and provider-level QPS windows are enforced together, so burst traffic cannot exceed upstream limits.
Control
AbortController is propagated from queue jobs to submit/poll HTTP requests, allowing deterministic timeout and active cancel behavior.
Recovery
Transient failures use bounded retries and delay strategy, while permanent failures short-circuit to terminal state.
Finance
Credit compensation is protected with idempotency keys to prevent duplicate refunds during retries and race conditions.
Stack Matrix
A practical map of the core stack used in production.
Quality Transparency
We publish a dedicated coverage details page and summary JSON for core API chains: orders, products, subscription, webhook, and key admin routes. Public output keeps file paths redacted.
Route
/stacks/backend-coverage
Build command
bun run coverage:backend:report
Coverage scope
orders | products | subscription | webhook | admin routes
Start with the existing foundation and adapt domains, providers, and workflows to your product.