Multi-tenant CRM SaaS API

CRM System

ASP.NET Core 8 Clean Architecture CRM backend—HotChocolate GraphQL for contacts, leads, opportunities, and accounts, plus tenant/subscription management on SQL Server.

CRM System project preview

Background & Context

The crm repository is an enterprise-oriented CRM backend—an ASP.NET Core 8 Web API whose primary product surface is HotChocolate GraphQL at /graphql. REST is effectively unused for CRM features (only the template WeatherForecast controller exists). There is no SPA or mobile frontend in this repository.

Product intent is a multi-tenant SaaS CRM foundation: identity, core sales objects (contacts, leads, opportunities, accounts), and subscription/tenant management with plan limits and feature flags. Clean Architecture folders under src/ separate Core, Application, Infrastructure, and GraphQL. Persistence combines EF Core (CrmDbContext) for SaaS/subscription schema with Dapper calling ~46 SQL stored procedures for CRM/identity throughput.

Honest docs mark Activities, tickets, quotes/invoices/orders, organization, custom fields, and audit as entity scaffolds without operable GraphQL services. StripePaymentService exists but is not registered in DI. GraphQL mutations still hardcode currentUserId = 1 in places; refresh-token persistence is incomplete; plan-limit checks are not enforced inside CRM creates.

The Challenge

Teams needed a multi-tenant CRM API foundation—identity, pipeline objects, and subscription plans—without shipping an unfinished full CRM suite or inventing a frontend that the repo does not contain. Without a coherent multi-tenant crm saas api foundation, CRM System stakeholders faced fragmented tools, slow handoffs, and limited visibility—classic failure modes Tekvers designs against.

The Solution

CRM System: ASP.NET Core 8 Clean Architecture CRM backend—HotChocolate GraphQL for contacts, leads, opportunities, and accounts, plus tenant/subscription management on SQL Server. Production-shaped CRM + identity + subscription API cores without a fake frontend claim. Tekvers delivered a maintainable multi-tenant crm saas api system for CRM System using ASP.NET Core 8, HotChocolate GraphQL, EF Core, Dapper, with phased rollout, operator workflows, and documentation suited to long-term ownership.

Our Approach

  1. Clean Architecture + dual data access

    Domain contracts in Core; services in Application; EF + Dapper repositories in Infrastructure; HotChocolate types/queries/mutations as the API edge—filtering, sorting, and projections enabled on the GraphQL server.

  2. Ship the CRM + SaaS cores first

    End-to-end Identity, CRM pipeline (including lead qualify/convert and opportunity stage/close aggregates), and Subscription (tenants, plans, tenant users, feature gates) before expanding scaffold-only modules.

  3. Tenant context at the host edge

    `TenantContextMiddleware` resolves multi-part hostnames to `HttpContext.Items["TenantId"]`; Serilog logs to console and rolling files; Swagger is available in Development.

What We Delivered

  • ASP.NET Core 8 Clean Architecture Web API (`net8.0`)
  • HotChocolate GraphQL API at `/graphql` (CRM + auth + subscription operations)
  • Contact, Lead, Opportunity, and Account CRUD/query/mutation surfaces via ~46 SQL stored procedures
  • Lead qualify/disqualify/convert and opportunity stage/close + pipeline value aggregates
  • JWT Bearer auth with BCrypt password hashes; user/role GraphQL mutations
  • Multi-tenant tenants, subscription plans, subscribe/cancel/upgrade/downgrade via EF Core
  • Subdomain tenant middleware and plan feature-flag helpers
  • Serilog structured logging and Development Swagger UI

Outcomes & Impact

  • Production-shaped CRM + identity + subscription API cores without a fake frontend claim
  • GraphQL-first contract suitable for future web/mobile clients
  • Clear backlog: wire Activities/Helpdesk/Sales scaffolds and Stripe DI only when ready
  • Documented gaps (hardcoded user id, refresh tokens, limit enforcement) for honest handoff

Organizations get a real SaaS CRM backend to extend—pipeline objects and tenancy completed—while Tekvers refuses to market scaffold entities or Stripe helpers as finished product modules.

Technology Stack

  • ASP.NET Core 8
  • HotChocolate GraphQL
  • EF Core
  • Dapper
  • SQL Server
  • JWT
  • BCrypt
  • Serilog

Services Delivered

Guides & articles from this niche

Planning a similar platform? Share your scope and we will map architecture, delivery phases, and a realistic timeline.