Codevista Innovations

Development

SaaS development in Morocco: how to turn an idea into a product that sells

By Codevista InnovationsPublished 10 min read

Building a SaaS in Morocco starts with proving that a specific problem is worth paying for, then shipping a narrow MVP before broadening it. The decisions that shape everything come early: the multi-tenant model, authentication and roles, how you collect payments (a local gateway such as the CMI for payments in dirhams, an international processor depending on how your company is set up) and hosting that complies with Law 09-08. Security, observability and the pricing model are designed from the first sprint, not after launch.

In brief

  • Validate the problem and the willingness to pay with real users before writing a single line of code.
  • A good SaaS MVP covers one journey end to end: sign-up, core use, payment, support.
  • A shared schema is enough for most launches; a schema or database per customer is for the customers who insist on it.
  • Payments, hosting and personal data are decided together, in the light of Law 09-08.
  • Onboarding, churn tracking and observability are part of the product from the very first version.

Where do you start when building a SaaS?

The starting point is not a feature list but a problem experienced by a specific user. "The HR manager at an SME consolidates leave by hand in a spreadsheet every month" is something you can work with; "digitalise HR" is not. Before any significant investment, the discovery phase checks three things:

  1. The problem is real and frequent: interviews with target users teach you more than a theoretical market study.
  2. Someone is ready to pay: who signs the purchase order, and what does your tool replace (a spreadsheet, existing software, a person)?
  3. The solution is feasible with the integrations it cannot do without (ERP, email, payroll…) and within a budget consistent with the price the market will accept.

Clickable mock-ups shown to those same users correct the journey before any development starts. They feed into a requirements specification that is actually useful, focused on needs and acceptance criteria rather than a list of screens.

What should a SaaS MVP include?

The MVP (minimum viable product) is not a botched version: it is the smallest version that lets a customer solve their problem and pay. It covers the complete journey, however modestly:

  • sign-up and creation of the customer workspace;
  • the core feature, the one the customer subscribes for;
  • a way to pay, even a semi-manual one at first;
  • a support channel and a way to collect feedback.

Everything else (advanced dashboards, a mobile app, secondary connectors) waits for the first feedback. A rule of thumb: a feature that none of the users you interviewed asked for stays out of the MVP. Short sprints, each closed by a review where the working product is demonstrated, help hold that scope; Scrum training gives the product team the framework to prioritise the backlog without drifting.

Multi-tenant architecture: shared schema or one database per customer?

A SaaS serves several customers (the "tenants") with a single application. The whole question is how far data sharing goes, and each option shifts cost from one place to another.

Shared schema with a tenant identifier

Every table carries a column identifying the customer, and every query filters on it. This is the simplest model to operate: one database, one migration per change, contained infrastructure costs and easy cross-customer statistics. Its main risk is data leaking between customers if a filter is forgotten. You reduce that risk by resolving the tenant in a single, central layer, by enabling row-level security where the database offers it (PostgreSQL, for example) and by writing automated tests that deliberately try to read another customer's data.

One schema per customer

Each customer's tables live in a separate namespace within the same database. Isolation is cleaner and restoring a single customer is simpler. The trade-off: every migration has to be applied to every schema, and the deployment tooling must be able to resume where it failed.

One database per customer

Maximum isolation, valued by large accounts and regulated sectors, with the option of hosting a customer separately. The price: monitoring, backups, connections and migrations multiply with the number of customers.

To get started, a shared schema is usually enough, provided the tenant identifier is present everywhere and the code makes it possible to move a demanding customer to a dedicated database later. Watch out for the "noisy neighbour" effect too: one very active customer must not slow the others down, hence the value of per-tenant quotas and processing queues. Your choice of technology stack weighs on all of this: see modernising your stack with Go and Next.js.

Authentication, roles and payments: what are the options in Morocco?

A B2B customer expects, at the very least, the ability to invite colleagues, distinct roles (administrator, user, read-only) and two-factor authentication; large companies often ask for single sign-on (SSO) with their corporate directory. This is a sensitive building block: relying on an identity provider or a proven library beats writing your own.

For collecting payments, everything depends on your customers and on your company's legal structure:

  • Moroccan customers paying by card: local online payment solutions, such as those built on the CMI (Centre Monétique Interbancaire, Morocco's interbank card-payment centre) and offered by banks and payment service providers, are the usual route for collecting payments in dirhams. Check with your bank that recurring payments are included in the plan you have signed up for before you build your subscription model on them.
  • International customers: an international processor (Stripe or equivalent) handles subscriptions, dunning and invoices, but access to it depends on the country where your company is registered. Check this with your bank and your advisers, including foreign exchange regulations.
  • Large accounts: bank transfer against a purchase order is still common; plan for clean manual invoicing from the start.

Keep the subscription logic (plans, trial periods, plan changes, credit notes) behind an internal interface: switching payment provider, or combining several, should not force you to rewrite the product.

Where should you host a SaaS in Morocco? Law 09-08 and the CNDP

As soon as a SaaS processes personal data (employees, end customers, patients…), Law 09-08 (loi n° 09-08) on the protection of individuals with regard to the processing of personal data applies. Depending on the processing, a declaration or a prior authorisation from the CNDP, Morocco's data protection authority, may be required, and transfers of data abroad are regulated: they may also require authorisation.

So the choice between a host in Morocco and an international cloud is not made on price or latency alone. Three questions frame it:

  • which personal data does the product process, and which of it is sensitive (health data, for example)?
  • what do your target customers require in their contracts, particularly public bodies and regulated sectors?
  • which formalities does the CNDP impose for this processing and, where applicable, for the transfer?

Settle these points with your legal adviser before signing with a hosting provider: migrating production data after the fact is slow and risky.

Security and observability from the first version

A SaaS concentrates all its customers' data in one place: a single breach hits every one of them at once. The minimum from the first production release:

  • encryption of data in transit and of backups, with restores that have actually been tested;
  • secrets stored outside the code and named administrator accounts;
  • audit logs of sensitive actions (exports, permission changes, deletions);
  • observability: metrics, centralised logs and alerts, broken down by tenant, so you spot an incident before your customers do;
  • dependencies kept up to date and systematic code review.

B2B buyers ask exactly these questions in their security questionnaires. The ISO/IEC 27001 standard provides a recognised framework for answering them: see what an ISO 27001 certificate really proves.

Which pricing model for a B2B SaaS?

Price is tested like a feature. The most common models:

  • Per user (per seat): easy to understand and suited to collaborative tools, but it encourages customers to limit the number of accounts, and therefore adoption.
  • Usage-based: by volume (documents, transactions, API calls); aligned with value, but less predictable for the customer's budget.
  • Tiered: plans that combine features and limits; often the simplest compromise to sell at launch.
  • Hybrid: a tiered base subscription, plus overage billed on usage.

Whatever the model, tie the price to the unit of value the customer perceives, offer a "contact us for a quote" plan for large accounts and store plans in configuration data rather than in the code, so prices can be adjusted without a redeployment. A free trial is there to prove value; a permanent free tier only makes sense if it genuinely feeds paid sales.

The mistakes that sink a SaaS project

Failures rarely come down to technology:

  • Overbuilding the MVP: months of development before the first paying customer, on assumptions never tested against the market.
  • Neglecting onboarding: a customer who does not quickly find the product's value is unlikely to stay. A setup wizard, sample data and import from the previous tool are features in their own right.
  • Ignoring churn: tracking cancellations, talking to customers who leave and measuring actual usage tell you more than the number of sign-ups.
  • Putting off security and compliance: catching up afterwards costs more and blocks sales to large accounts.
  • Choosing a supplier on price alone: see the criteria for choosing a software development company in Casablanca.

Custom software development in Casablanca: what to prepare

Whether you build in-house or with a supplier, these items save time in the first few weeks:

  • the problem stated in one sentence, and the users you have already interviewed;
  • the MVP journey, with what is explicitly out of scope;
  • the list of personal data processed and your hosting constraints;
  • the payment channels you are considering and the legal entity that will invoice;
  • a budget envelope and a realistic deadline, even rough ones.

Codevista Innovations designs custom SaaS products in Casablanca (multi-tenant architectures, subscription management; Next.js, Go, Python, TypeScript) using Scrum: a discovery and UX/UI design phase, then two-week sprints delivered to a staging environment for sign-off. The company is ISO 27001:2022 certified. To scope your project, let's talk.

Frequently asked questions

How long does it take to develop a SaaS MVP?

It depends on the scope, the integrations and how available your test users are. Rather than aiming for a fixed date, limit the MVP to a minimal complete journey (sign-up, core feature, payment, support) delivered in short sprints. Each sprint review helps strip out what is not needed. An MVP that keeps dragging on almost always signals a scope that is too broad, not a team that is too slow.

How much does it cost to develop a SaaS in Morocco?

There is no standard price: the cost depends on the MVP scope, the number of integrations (ERP, payments, SSO), the isolation and security requirements, and then on operations (hosting, monitoring, maintenance). A well-framed problem and a requirements specification focused on needs let you obtain comparable quotes and cut scope rather than quality.

Does SaaS data have to be hosted in Morocco?

Not necessarily, but the question must be settled early. Law 09-08 governs the processing of personal data and its transfer abroad, under the supervision of the CNDP. Depending on the nature of the data and your customers' requirements, particularly in the public sector or regulated industries, hosting in Morocco may be unavoidable. Have this choice validated by your legal adviser and check the applicable formalities with the CNDP before signing with a hosting provider.

Can a SaaS collect subscription payments in dirhams?

Yes. For Moroccan customers paying by card, local online payment solutions, notably those built on the CMI and offered by banks and payment service providers, let you collect payments in dirhams. Recurring payments depend on the plan you have signed up for: check with your bank. For large accounts, bank transfer against a purchase order is still common. Keep subscription management independent of the payment provider, so you can switch provider or combine several.

Which multi-tenant architecture should you choose to launch a SaaS?

For most projects, a shared schema with a tenant identifier on every table is the best starting point: one database, simple migrations, contained costs. It demands rigorous filtering, backed by row-level security where the database offers it and by isolation tests. A dedicated schema or database is justified for customers who require strong isolation.

Read next