← Forward Deployed Engineering Lesson 8 extra

Enterprise clients

A bigger client

The Northstar agent works, so your company now offers it to other institutes. The first to sign is Meridian Learning, a chain of 40 centres with its own IT team.

Northstar asked "does it answer well?". Big clients ask that, and then ask who can get in, where the data goes and how it connects to their systems. Clients like this are called enterprise clients.

Step through Meridian's first call
  1. sign-in"Our staff won't remember another password. They sign in with their Meridian accounts."
  2. roles"Counsellors see their own centre. Only managers can download leads."
  3. data"Our leads must never mix with another client's."
  4. review"Our security lead, Sanjay, needs answers in writing before we sign."
  5. systems"Leads go into our CRM, not a spreadsheet."

Start with signing in.

Sign in with their accounts

With SSO (single sign-on), staff sign in to your dashboard with the accounts they already use at work. Your app never stores their passwords. Meridian's login system tells it who they are.

The big win is when someone leaves. IT switches off one account, and access ends everywhere at once.

Priya leaves on Friday. IT switches off her Meridian account. Is she still in?

She's signed in. What may she do?

Who can do what

Give each person a role, and write down what each role may do. Meridian has two: counsellors and managers.

Anything not written down is a no. That way a new feature is locked until you decide who gets it, not open by accident.

Priya is a counsellor at Centre 4. Sort what she tries

Now the rule Meridian cares about most.

Keep each client's data apart

Both clients' leads now sit in one database. Each client is called a tenant, and every row is labelled with its tenant.

Every query must filter by the tenant of the person signed in. Take the tenant from their sign-in, never from the request, so nobody can see another client's data by changing a web address. Then test it: sign in as each client and search for the other's leads.

Priya searches for "arun". Switch the filter on and off

Practise the numbers.

✏️ Practice E.1

Remember:
Without SSO, every system a leaver used needs its own account switched off. With SSO, there's one account.
1. Meridian has 40 centres, each with 6 counsellors and 1 manager. How many people need to sign in?
2. Without SSO, staff have separate accounts on 3 systems. 5 people leave this month. How many accounts must IT switch off?
3. To test separation, each client searches for every lead of the other. Northstar has 36 leads and Meridian 50. How many searches?

Pass the security review

Before a big client signs, their security team asks how you protect their data. This is a security review. Northstar wants one too now that the agent serves others, so Kevin runs it.

Answer only what's true. "We don't do that yet; here's the plan" beats a guess they'll find out later. Logging every view and download, with who and when, is called an audit log.

Answer Kevin's questions

Last ask: their CRM.

Connect to their systems

Meridian's CRM has an API. Your code calls it to add each new lead. When a lead enrols, the CRM calls your web address to tell you. That call is a webhook.

Anyone can call a web address, so each webhook carries a signature made with a secret only the CRM and you know. CRMs also retry, so the same event can arrive twice. Each event has an ID: if you've seen it, do nothing.

Put the webhook steps in order

Practise the numbers.

✏️ Practice E.2

Remember:
A repeated event ID changes nothing. A bad signature is refused.
time = calls ÷ calls allowed per second
1. The CRM sends the same "enrolled" event 3 times. How many times does the lead get updated?
2. You get 200 webhooks a day, and 2% fail the signature check. How many are refused each day?
3. You copy Meridian's 1,800 old leads into their CRM. Their API allows 10 calls a second. How many seconds does it take?

Do it for real

In the notebook, one store holds both clients' leads. You'll make a leak happen, write a test that catches it, and fix it.

Then you'll write the role rules, check sign-in tokens, handle fake and repeated webhooks, and keep an audit log you can show Kevin.

Make it enterprise-ready in Google Colab

No API key needed. About 40 minutes.

Then check what stuck.

Check yourself

Four questions, all on new examples.

Question 1A hospital's IT team asks for SSO on your booking dashboard. What's the main thing they get?
Question 2Your app serves two banks. Where should it get the bank to filter by?
Question 3Someone sends your webhook address a fake "payment received" call. What stops it?
Question 4A security reviewer asks about something you haven't built yet. What do you say?

Back to Northstar

This leaves a question
It's live. What happens on day two?
Lesson 9 answers it.

In interviews, expect at least one of these: SSO, keeping tenants apart, or a security review. You now have an answer, and code, for each.