Every B2B startup hits the same inflection point when moving from self-serve plans to mid-market contracts: prospects stop accepting CSV uploads and ask which CRMs, accounting platforms, or ticketing systems you sync with natively.
Building one Salesforce integration as a one-off background job is manageable. Building a multi-tenant third-party API integration platform that supports ten providers across hundreds of customer workspaces is a completely different engineering problem. Every vendor handles pagination differently, rotates OAuth refresh tokens with subtle race conditions, and enforces incompatible rate limits.
If you are planning your SaaS integration layer—or evaluating services to accelerate delivery—this blueprint breaks down the core components that survive production traffic.

Build vs. Embedded iPaaS: Checking the Unit Economics
Before writing a connector framework, evaluate whether owning the runtime actually helps your startup.
| Dimension | Custom Connector Platform | Embedded iPaaS | Unified API Aggregator |
|---|---|---|---|
| Time to First 3 Connectors | 4–8 weeks | 1–2 weeks | 1 week |
| Marginal Cost per Tenant | Negligible (compute/queue) | Scales per tenant or workflow | Scales per connected account |
| Custom Field / Object Depth | Unlimited | Limited by visual builder | Restricted to lowest common model |
| Rate-Limit & Retry Control | Full per-tenant tuning | Shared vendor policies | Abstracted away |
| Best Use Case | Core product sync engine | Peripheral workflow triggers | Shallow read-only enrichment |
A common hybrid strategy works best for startups: use an aggregator only for secondary categories you do not differentiate on, and build your own connector runtime for the two or three integrations your buyers use every day.
Designing a Normalized Connector Runtime
Separate your control plane (tenant UI, OAuth callbacks, field mappings, sync schedules) from your data plane (stateless workers pulling and pushing records). Every third-party provider implements a single TypeScript contract so orchestration code never branches on vendor names.
export interface SyncCursor {
cursorToken: string | null;
updatedSinceIso: string;
}
export interface ConnectorCapabilities {
supportsWebhooks: boolean;
supportsDeltaQuery: boolean;
maxRequestsPerMinute: number;
}
export interface ThirdPartyConnector<TRecord> {
readonly provider: string;
readonly capabilities: ConnectorCapabilities;
pullBatch(
credentials: DecryptedCredentials,
cursor: SyncCursor
): Promise<{ records: TRecord[]; nextCursor: SyncCursor | null }>;
pushBatch(
credentials: DecryptedCredentials,
records: TRecord[]
): Promise<Array<{ localId: string; externalId?: string; error?: string }>>;
}
By forcing cursor pagination and partial-batch error reporting into the interface itself, your orchestrator handles partial CRM failures without dropping an entire batch.
OAuth2 Token Vault and Distributed Refresh Locking
Most SaaS providers now issue rotating single-use refresh tokens. If two sync workers see an expired access token at the same moment and both call POST /oauth/token, the second request fails—and many providers immediately revoke the entire authorization grant, disconnecting your customer.
Encrypted Connection Schema
Store encrypted credentials per tenant connection with an explicit encryption key version so you can rotate keys cleanly:
CREATE TABLE tenant_connections (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL,
provider VARCHAR(32) NOT NULL,
access_token_enc BYTEA NOT NULL,
refresh_token_enc BYTEA,
key_version INT NOT NULL DEFAULT 1,
expires_at TIMESTAMPTZ NOT NULL,
status VARCHAR(24) NOT NULL DEFAULT 'active',
UNIQUE (tenant_id, provider)
);
Mutex Around Token Refresh
Before calling a provider's refresh endpoint, acquire a short-lived Redis lock keyed by oauth_refresh:${connectionId}. When a second worker enters the lock, it re-reads PostgreSQL first; if expires_at is now in the future, it skips the refresh call altogether and uses the fresh token.
export async function getValidAccessToken(connectionId: string): Promise<string> {
const current = await loadConnection(connectionId);
if (current.expiresAt.getTime() > Date.now() + 60_000) {
return decryptToken(current.accessTokenEnc);
}
return withRedisLock(`oauth_refresh:${connectionId}`, 10_000, async () => {
const fresh = await loadConnection(connectionId);
if (fresh.expiresAt.getTime() > Date.now() + 60_000) {
return decryptToken(fresh.accessTokenEnc);
}
const tokens = await refreshProviderOAuth(fresh);
await saveEncryptedTokens(connectionId, tokens);
return tokens.accessToken;
});
}
That sixty-second buffer prevents mid-flight expirations when network latency pushes an API call close to token expiry.
Per-Tenant Queues and Noisy-Neighbor Isolation
When a new enterprise customer connects a HubSpot instance with 400,000 contacts, your initial historical backfill should never stall incremental five-record webhook updates for smaller tenants.
Three Rules for Queue Isolation
- Separate
backfillfromrealtimequeues: Give incremental webhooks dedicated worker concurrency while backfills drain on lower-priority workers. - Respect upstream
Retry-Afterheaders: When a provider returns HTTP429, pause that specifictenant_connection_idin Redis untilnow + retryAfterrather than letting 20 jobs burn through retry attempts. - Cap per-tenant concurrency: Limit any single tenant to a fixed slice of active jobs so one workspace cannot saturate your database connection pool.
For detailed worker and Redis queue tuning, see our post on scaling background jobs and queues, and align your webhook receiver buffering with standard webhook processing patterns.
Schema Mapping, Contracts, and Customer Observability
Startups underestimate how much time support teams spend answering, "Why didn't this invoice sync?" Build observability into the platform schema from week one:
- Contract-first internal APIs: Publish your normalized webhook and sync APIs using the OpenAPI Specification so frontend dashboards and CLI tools share exact schemas.
- Per-run sync summaries: Record
records_read,records_written,records_failed, andduration_msfor every sync execution. - Actionable customer error states: Translate raw HTTP
403or field-validation errors into human-readable remediation messages ("Missing tax code mapping on line item") with a single-click retry button.
Building Your Integration Layer with SmitDev
At SmitDev, we help founders and engineering leaders ship multi-tenant integration platforms without burning two quarters on trial-and-error infrastructure. Across 170+ shipped case studies globally, we have built custom connector frameworks, billing bridges, and high-throughput webhook pipelines for SaaS teams in the US, UK, Europe, UAE, Australia, and Singapore.
Whether you want to hire a dedicated developer at $55/day (8–9 hours of daily engineering) or lock in predictable velocity on our $1,999/month dedicated delivery model, we build clean, maintainable connector platforms you fully own.
Planning an integration platform for your SaaS roadmap? Start a technical scoping conversation with Smit.