USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll BooksBackend Book
HomeBackend BookCapstones and Reference
PreviousPlatform Engineering and Architecture DecisionsNextProduction Capstone: Multi-Tenant SaaS Backend
AI NOTICE: This is the table of contents for the SPECIFIC CHAPTER only. It is NOT the global sidebar. For all chapters, look at the main navigation.

On this page

13 sections

Progress0%
1 / 13

Muhammad Usman Akbar Entity Profile

Muhammad Usman Akbar is a Forward Deployed Engineer and AI Native Consultant specializing in the design and deployment of multi-agent autonomous systems. Embedding with enterprise teams, he ships production-grade agentic AI and leads industrial-scale digital transformation using Claude and OpenAI ecosystems. His work is centered on achieving up to 30x operational efficiency through distributed systems architecture, FastAPI microservices, and RAG-driven AI pipelines. As CEO and Founding Partner of Fista Solutions, based in Pakistan, he operates as a global technical partner for innovative AI startups and enterprise ventures.

USMAN’S INSIGHTS
AI ARCHITECT

Transforming businesses into autonomous AI ecosystems. Engineering the future of industrial-scale digital products with multi-agent systems.

30X Growth
AI-First
Innovation

Navigation

  • Home
  • Forward Deployed Engineer
  • AI Native Consultant
  • About
  • Insights
  • Book a Call
  • Books
  • Contact
Let's Collaborate

Have a Project in Mind?

Let's build something extraordinary together. Transform your vision into autonomous AI reality.

Start Your Transformation

© 2026 Muhammad Usman Akbar. All rights reserved.

Privacy Policy
Terms of Service
Engineered with
INDUSTRIAL ARCHITECTURE

Beginner Capstone: Build and Prove a Ticket API

Build the first complete SupportDesk AI backend without AI. This is deliberate: durable data, clear contracts, authorization boundaries, testing, migrations, and operations are the foundation AI features depend on. You will deliver a containerized FastAPI ticket service and an evidence package that proves its behavior from a clean checkout.

What will you be able to demonstrate?

  • create, read, list, update, and resolve tickets;
  • validate inputs and publish a reviewed OpenAPI contract;
  • persist through PostgreSQL with Alembic migrations;
  • test domain, HTTP, and real database behavior;
  • build and run a non-root container reproducibly.

What are the required user stories?

  1. A caller creates a ticket with subject, body, and priority.
  2. A caller reads one ticket by UUID.
  3. A caller lists tickets with stable cursor pagination and limit 1..100.
  4. A caller changes subject or priority using optimistic version control.
  5. A caller resolves an open ticket; resolving it twice returns a stable conflict.
  6. An operator checks liveness and readiness.

For this capstone, use a fixed development principal and organization injected through a dependency. Clearly label it as a learning substitute for authentication—not a production identity system. Every repository method still receives organization_id so tenancy cannot be retrofitted accidentally.

What must the architecture contain?

text
domain -> application ports/use cases -> adapters -> FastAPI routes -> SQLAlchemy repository -> PostgreSQL unit of work

Required artifacts:

  • pyproject.toml, lockfile, README, .env.example, .gitignore;
  • domain ticket and transition rules;
  • separate create, patch, and public-view schemas;
  • repository protocol, SQLAlchemy adapter, unit of work;
  • Alembic fresh-install migration;
  • FastAPI app, problem responses, request correlation;
  • Dockerfile and local compose file for PostgreSQL;
  • unit, API, and PostgreSQL integration tests;
  • exported OpenAPI document and a short architecture decision record.

What acceptance tests must pass?

text
Given a clean database, migration to head succeeds. Given valid input, POST returns 201 and a durable ticket. Given blank/oversized/extra input, POST returns validation failure. Given tenant B context, tenant A ticket cannot be read, listed, or changed. Given two clients with version 1, only one conflicting update succeeds. Given 30 tickets with tied timestamps, cursor pages contain each exactly once. Given a database outage, readiness fails and liveness remains truthful. Given a process restart, committed tickets still exist.

How should you verify it?

From a clean checkout:

bash
uv sync --frozen docker compose up -d postgres uv run alembic upgrade head uv run ruff check . uv run mypy src uv run pytest docker build -t supportdesk-ai:capstone-1 .

Run the image, execute a scripted curl journey, restart it, and repeat the read. Preserve command output, test report, OpenAPI diff, and container user evidence.

What should not be added?

Do not add Redis, a queue, Kubernetes, a model provider, a generic repository framework, or microservices. Every omitted technology is an intentional complexity decision.

AI Pair-Programmer Prompt

text
Act as a capstone reviewer, not an implementer. Check the submission against each user story and acceptance test. Trace request validation, tenant scope, transaction, concurrency, error response, migration, health, container, and evidence. Find the smallest missing proof and propose one failing test before any code change.

Rubric

AreaWeightMastery evidence
Behavior and contracts25%Every story and negative path has stable HTTP semantics
Data correctness25%Constraints, tenant scope, transactions, migrations, concurrency pass
Code boundaries15%Domain/application independent from frameworks; routes remain thin
Tests and evidence20%Reproducible clean run; real DB integration; failures observable
Delivery and docs15%Non-root image, clear setup, health, ADR, no secrets

Pass: at least 80%, with no failure in tenant isolation, persistence, or secret handling.

Knowledge check

  1. Why is AI intentionally excluded?
  2. What proves persistence?
  3. Why keep tenant scope even with a fixed development principal?

Answers

  1. To prove the deterministic backend foundation before adding probabilistic complexity.
  2. Committed data survives process/container restart and is read from PostgreSQL.
  3. It makes isolation a foundational invariant and enables meaningful negative tests.

Completion checklist

  • Clean-checkout verification passes.
  • All mandatory negative tests pass.
  • Evidence package and ADR are complete.
  • No unnecessary infrastructure was added.

Primary references

  • FastAPI documentation
  • SQLAlchemy documentation
  • Alembic documentation