iOS Template

CRM App Backend Template
iOS — Schema, API & AI Guide

A production-ready iOS CRM backend schema and Starter Kit on Back4app: Contact, Company, Deal, Activity, pipeline stages, ER diagram, data dictionary, JSON schema, API playground, and a one-click AI Agent prompt to deploy in minutes.

Key Takeaways

On this page you get a production-ready CRM schema, a one-click AI prompt, and step-by-step iOS code — so you can ship a CRM app without building the backend.

  1. Deploy in minutesPaste the AI Agent prompt and get a running app with contacts, companies, deals, and pipeline.
  2. Secure by defaultACLs and role-based access so users see only their assigned deals and data.
  3. iOS-native SDKTyped objects, async/await, offline pinning, and Live Queries for pipeline updates.
  4. REST + GraphQLBoth APIs auto-generated; filter deals by stage, list activities by relatedTo.
  5. Five classes_User (built-in), Company, Contact, Deal (pipeline), Activity (tasks/events).

What Is the iOS CRM App Backend Template?

Back4app's iOS CRM template delivers a Swift-friendly backend with Codable-style models for Contact, Company, Deal, and Activity. Use the Parse iOS SDK with async/await, pin objects for offline access, and subscribe to Live Queries for pipeline updates. Ship a native CRM app without running or maintaining your own backend.

Best for:

Sales teamsCRM buildersRapid prototypingField repsMVP launchesTeams choosing a BaaS for CRM

Overview

iOS CRM apps benefit from Swift types, async/await, and offline-first design. Back4app's Parse iOS SDK offers Codable-friendly access to Contact, Deal, and Activity, local datastore pinning, and Live Queries for real-time pipeline and activity updates.

The five classes — _User, Company, Contact, Deal, Activity — are exposed via PFQuery and PFObject. Use PFQuery(className: "Deal").whereKey("stage", equalTo: "qualified") and pin results for offline; the SDK handles sync when the app reconnects.

Core CRM Features

iOS CRM backend with Swift and the Parse SDK: contact management, deal pipeline, Codable models, and offline sync for pipeline and contacts with ACLs.

Contact management

Store and manage contacts with name, email, phone, company, and notes. Ideal for iOS apps.

Company management

Track companies with name, website, industry, and address. Links to contacts and deals.

Deal pipeline

Sales pipeline with stages, amount, expected close date, and assignment. Built for iOS backends.

Activity tracking

Log calls, emails, meetings, and notes linked to contacts and deals. Works with iOS SDK.

User & permissions

Built-in user model and pointers for ownership and assignment. ACLs out of the box for iOS.

Why Build Your iOS CRM Backend with Back4app?

Back4app gives iOS apps a Swift-friendly SDK and offline support so you can ship a polished CRM app quickly.

  • Swift and Codable: Use the Parse iOS SDK with async/await and Codable; type-safe models for Contact, Company, Deal, Activity.
  • Offline and sync: Pin objects locally; query from the local datastore when offline and sync when connected.
  • Live Queries: Subscribe to Deal and Activity changes for real-time pipeline updates in SwiftUI or UIKit.

Ideal for iOS developers building CRM or sales apps with Swift and value types.

Core Benefits

A production-ready CRM backend so you can ship faster and focus on your app.

Ship Faster, No Backend Code

REST & GraphQL APIs and a ready-to-use schema — connect your app and go.

Secure by Default

ACLs and class-level permissions; restrict by assignedTo and createdBy.

Real-Time Pipeline

Live Queries over WebSockets for instant deal and activity updates.

Built-In Auth

User sign-up, login, and session handling out of the box.

Works Offline

Local pinning keeps contacts and deals available offline and syncs when you reconnect.

Deploy in Minutes

Use the AI Agent to create and deploy your CRM app from this template.

Ready to try it?

Let the Back4app AI Agent create your CRM app backend, connect the iOS frontend, and deploy — all from a single prompt.

Free to start — 50 AI Agent prompts/month, no credit card required

Technical Stack

Everything powering this CRM app template at a glance.

Frontend
iOS
Backend
Back4app
Database
MongoDB
Auth
Auth & Access Control
APIs
REST & GraphQL
Deployment
AI Agent / Dashboard

ER Diagram

Entity-Relationship diagram for the iOS CRM app data model.

View diagram source
Mermaid
erDiagram
    _User {
        String objectId PK
        String username
        String email
        String password
        Date createdAt
        Date updatedAt
    }

    Company {
        String objectId PK
        String name
        String website
        String industry
        String address
        String notes
        Pointer createdBy FK
        Date createdAt
        Date updatedAt
    }

    Contact {
        String objectId PK
        String name
        String email
        String phone
        Pointer company FK
        String notes
        Pointer createdBy FK
        Date createdAt
        Date updatedAt
    }

    Deal {
        String objectId PK
        String title
        Number amount
        String stage
        Pointer contact FK
        Pointer company FK
        Date expectedCloseDate
        String notes
        Pointer assignedTo FK
        Date createdAt
        Date updatedAt
    }

    Activity {
        String objectId PK
        String type
        String subject
        String description
        Date dueDate
        Date completedAt
        Pointer relatedTo FK
        Pointer createdBy FK
        Date createdAt
        Date updatedAt
    }

    Company ||--o{ Contact : "has"
    Company ||--o{ Deal : "has"
    Contact ||--o{ Deal : "has"
    _User ||--o{ Deal : "assignedTo"
    _User ||--o{ Activity : "createdBy"
    Contact ||--o{ Activity : "relatedTo"
    Deal ||--o{ Activity : "relatedTo"
    _User ||--o{ Company : "createdBy"
    _User ||--o{ Contact : "createdBy"

Integration Flow

Auth-to-CRUD sequence: how your iOS app talks to Back4app — login, then query contacts and deals, update pipeline.

View diagram source
Mermaid
sequenceDiagram
  participant User
  participant App as iOS App
  participant Back4app as Back4app Cloud

  User->>App: Login
  App->>Back4app: ParseUser.logIn(username:password:)
  Back4app-->>App: Session token
  App-->>User: Logged in

  User->>App: Load contacts and deals
  App->>Back4app: ParseQuery.find()
  Back4app-->>App: [PFObject]
  App-->>User: Show list

  User->>App: Create deal or contact
  App->>Back4app: deal.save() or contact.save()
  Back4app-->>App: Deal (objectId)
  App-->>User: Updated list

Data Dictionary

Complete field reference for every class in the schema.

FieldTypeDescriptionRequired
objectIdStringAuto-generated unique identifierauto
nameStringFull name of the contact
emailStringEmail address
phoneStringPhone number
companyPointer<Company>Company this contact belongs to
notesStringFree-form notes
createdByPointer<_User>User who created this contact
createdAtDateAuto-generated creation timestampauto
updatedAtDateAuto-generated last-update timestampauto

9 fields in Contact

Security & Permissions

How ownership, ACLs, and class-level permissions protect data in this CRM schema.

Row-Level ACLs

Use ACLs and pointers (assignedTo, createdBy) so users only see and edit their assigned deals and related data.

Class-Level Permissions

CLPs restrict which roles or users can create, read, update, or delete objects at the class level.

Pointer-Based Ownership

Deal.assignedTo and Activity.createdBy link to _User; Cloud Code can enforce visibility and edits by role.

Schema (JSON)

Raw JSON schema definition — copy and use in your Back4app app or import via the API.

JSON
{
  "classes": [
    {
      "className": "Contact",
      "fields": {
        "objectId": {
          "type": "String",
          "required": false
        },
        "name": {
          "type": "String",
          "required": true
        },
        "email": {
          "type": "String",
          "required": false
        },
        "phone": {
          "type": "String",
          "required": false
        },
        "company": {
          "type": "Pointer",
          "targetClass": "Company",
          "required": false
        },
        "notes": {
          "type": "String",
          "required": false
        },
        "createdBy": {
          "type": "Pointer",
          "targetClass": "_User",
          "required": false
        },
        "createdAt": {
          "type": "Date",
          "required": false
        },
        "updatedAt": {
          "type": "Date",
          "required": false
        }
      }
    },
    {
      "className": "Company",
      "fields": {
        "objectId": {
          "type": "String",
          "required": false
        },
        "name": {
          "type": "String",
          "required": true
        },
        "website": {
          "type": "String",
          "required": false
        },
        "industry": {
          "type": "String",
          "required": false
        },
        "address": {
          "type": "String",
          "required": false
        },
        "notes": {
          "type": "String",
          "required": false
        },
        "createdBy": {
          "type": "Pointer",
          "targetClass": "_User",
          "required": false
        },
        "createdAt": {
          "type": "Date",
          "required": false
        },
        "updatedAt": {
          "type": "Date",
          "required": false
        }
      }
    },
    {
      "className": "Deal",
      "fields": {
        "objectId": {
          "type": "String",
          "required": false
        },
        "title": {
          "type": "String",
          "required": true
        },
        "amount": {
          "type": "Number",
          "required": false
        },
        "stage": {
          "type": "String",
          "required": false
        },
        "contact": {
          "type": "Pointer",
          "targetClass": "Contact",
          "required": false
        },
        "company": {
          "type": "Pointer",
          "targetClass": "Company",
          "required": false
        },
        "expectedCloseDate": {
          "type": "Date",
          "required": false
        },
        "notes": {
          "type": "String",
          "required": false
        },
        "assignedTo": {
          "type": "Pointer",
          "targetClass": "_User",
          "required": false
        },
        "createdAt": {
          "type": "Date",
          "required": false
        },
        "updatedAt": {
          "type": "Date",
          "required": false
        }
      }
    },
    {
      "className": "Activity",
      "fields": {
        "objectId": {
          "type": "String",
          "required": false
        },
        "type": {
          "type": "String",
          "required": false
        },
        "subject": {
          "type": "String",
          "required": false
        },
        "description": {
          "type": "String",
          "required": false
        },
        "dueDate": {
          "type": "Date",
          "required": false
        },
        "completedAt": {
          "type": "Date",
          "required": false
        },
        "relatedTo": {
          "type": "Pointer",
          "required": false
        },
        "createdBy": {
          "type": "Pointer",
          "targetClass": "_User",
          "required": false
        },
        "createdAt": {
          "type": "Date",
          "required": false
        },
        "updatedAt": {
          "type": "Date",
          "required": false
        }
      }
    },
    {
      "className": "_User",
      "fields": {
        "objectId": {
          "type": "String",
          "required": false
        },
        "username": {
          "type": "String",
          "required": true
        },
        "email": {
          "type": "String",
          "required": true
        },
        "password": {
          "type": "String",
          "required": true
        },
        "createdAt": {
          "type": "Date",
          "required": false
        },
        "updatedAt": {
          "type": "Date",
          "required": false
        }
      }
    }
  ]
}

Build with AI Agent

Use the Back4app AI Agent to build a real CRM app from this template: it will create the frontend, the backend (this schema, auth, and APIs), and deploy it — no manual setup. The prompt below describes this CRM stack so the Agent can generate a production-ready app in one go.

Back4app AI Agent
Ready to build
Create a CRM app on Back4app with this exact schema and behavior.

Schema:
1. _User (use Back4app built-in): username (String, required), email (String, required), password (String, required); objectId, createdAt, updatedAt (system).
2. Company: name (String, required), website (String), industry (String), address (String), notes (String), createdBy (Pointer to _User); objectId, createdAt, updatedAt (system).
3. Contact: name (String, required), email (String), phone (String), company (Pointer to Company), notes (String), createdBy (Pointer to _User); objectId, createdAt, updatedAt (system).
4. Deal: title (String, required), amount (Number), stage (String; e.g. lead, qualified, proposal, negotiation, won, lost), contact (Pointer to Contact), company (Pointer to Company), expectedCloseDate (Date), notes (String), assignedTo (Pointer to _User); objectId, createdAt, updatedAt (system).
5. Activity: type (String; e.g. call, email, meeting, note), subject (String), description (String), dueDate (Date), completedAt (Date), relatedTo (Pointer to Contact or Deal), createdBy (Pointer to _User); objectId, createdAt, updatedAt (system).

Security:
- Set ACLs so only authenticated users can access data; use role-based or owner-based rules where appropriate (e.g. assignedTo, createdBy).
- Use Class-Level Permissions so only authenticated users can create/read/update/delete these classes.

Auth:
- Sign-up (username, email, password) and login; support logout/session.

Behavior:
- Full CRUD for Company, Contact, Deal, and Activity.
- List deals with filter by stage and order by expectedCloseDate or updatedAt (pipeline view).
- List activities by relatedTo (Contact or Deal).
- Optional: real-time Live Queries for Deal and Activity for dashboard/pipeline updates.
- Optional: offline pinning for mobile (Contacts, Deals, Activities).

Deliver:
- Create the Back4app app with the schema above, ACLs, and any Cloud Code needed.
- Generate the frontend and connect it to this backend; deploy so the app is runnable end-to-end.

Press the button below to open the Agent with this template's prompt pre-filled.

Deploy in minutes50 free prompts / monthNo credit card required

API Playground

Try the REST and GraphQL endpoints for the CRM schema. Responses from the example data above — no Back4app account needed.

Loading playground…

Uses the same CRM schema (Contact, Company, Deal, Activity) as this template.

Step-by-Step iOS Integration

Connect to your Back4app backend from a iOS app using the Back4app iOS SDK.

  1. Step 1: Install Back4app iOS SDK

    Add the Back4app SDK for your stack (e.g. npm, pubspec, or package manager).

    Swift
    // Package.swift or CocoaPods
    // SPM: .package(url: "https://github.com/parse-community/Parse-Swift", from: "4.0.0")
    // Podfile: pod 'Parse'
  2. Step 2: Initialize Back4app in your app

    Initialize the Back4app SDK at app startup with your App ID and server URL.

    Swift
    Parse.initialize(
        configuration: ParseClientConfiguration {
            $0.applicationId = "YOUR_APP_ID"
            $0.clientKey = "YOUR_CLIENT_KEY"
            $0.server = "https://parseapi.back4app.com/"
        }
    )
  3. Step 3: Query contacts and deals

    Use the SDK to fetch Contact and Deal objects; filter deals by stage for the pipeline.

    Swift
    func getDeals(stage: String = "qualified") async throws -> [PFObject] {
        let query = PFQuery(className: "Deal")
        query.whereKey("stage", equalTo: stage)
        query.order(byAscending: "expectedCloseDate")
        return try await query.findObjects()
    }
    func getContacts() async throws -> [PFObject] {
        let query = PFQuery(className: "Contact")
        return try await query.findObjects()
    }
  4. Step 4: Create a contact or deal

    Create a new Contact or Deal with the required fields and pointers (company, contact, assignedTo), then save.

    Swift
    func createDeal(title: String, stage: String = "lead", amount: Double? = nil) async throws {
        let deal = PFObject(className: "Deal")
        deal["title"] = title
        deal["stage"] = stage
        if let amount = amount { deal["amount"] = amount }
        try await deal.save()
    }
    func createContact(name: String, email: String? = nil, phone: String? = nil) async throws {
        let contact = PFObject(className: "Contact")
        contact["name"] = name
        if let email = email { contact["email"] = email }
        if let phone = phone { contact["phone"] = phone }
        try await contact.save()
    }
  5. Step 5: Update deal stage and activities

    Update Deal.stage when moving in the pipeline; create and list Activity by relatedTo.

    Swift
    // Update deal stage (e.g. move in pipeline)
    func updateDealStage(objectId: String, stage: String) async throws {
        let query = PFQuery(className: "Deal")
        let deal = try await query.getObjectWithId(objectId)
        deal["stage"] = stage
        try await deal.save()
    }
    
    // Delete a deal
    func deleteDeal(objectId: String) async throws {
        let query = PFQuery(className: "Deal")
        let deal = try await query.getObjectWithId(objectId)
        try await deal.delete()
    }

State Management Integration

Integrate the Back4app SDK with your app's state layer (e.g. context, store, or services) for pipeline and contact state.

Full Data Model

Copy a complete CRM model for type-safe serialization (e.g. class, interface, or type definition).

Swift
// Deal.swift — matches Back4app schema
struct Deal: Codable {
    var objectId: String?
    var title: String
    var amount: Double?
    var stage: String?
    var expectedCloseDate: Date?
    var contact: Pointer<ParseObject>?
    var company: Pointer<ParseObject>?
    var assignedTo: Pointer<_User>?
    var createdAt: Date?
    var updatedAt: Date?
}

func toDeal(_ obj: PFObject) -> Deal {
    Deal(
        objectId: obj.objectId,
        title: obj["title"] as? String ?? "",
        amount: obj["amount"] as? Double,
        stage: obj["stage"] as? String,
        expectedCloseDate: obj["expectedCloseDate"] as? Date,
        contact: obj["contact"] as? Pointer<ParseObject>,
        company: obj["company"] as? Pointer<ParseObject>,
        assignedTo: obj["assignedTo"] as? Pointer<_User>,
        createdAt: obj.createdAt,
        updatedAt: obj.updatedAt
    )
}

Offline-First & Local Datastore

Use pin() and unpin() so contacts and deals are available offline and sync when back online.

Supported SDKs include a local datastore. Pin Contact, Deal, and Activity objects to keep them on device; query pinned data when offline. When the app is back online, sync with the server.

Below: pin results after fetch, and unpin when you no longer need local copies.

Swift
// After fetch, pin for offline
try? await PFObject.pinAll(deals)

// Query from local datastore
let query = PFQuery(className: "Deal").fromLocalDatastore()
query.whereKey("stage", equalTo: "qualified")
query.order(byAscending: "expectedCloseDate")
let localDeals = try? await query.findObjects()

// Unpin
try? await PFObject.unpinAllObjects(inBackground: "Deal")

Frequently Asked Questions

Common questions about the CRM app backend template.

What is Back4app?
Why use Back4app for an iOS CRM app?
How do I query deals by stage in Swift?
Does the iOS SDK support offline CRM data?

Trusted by developers worldwide

Join the community building the future of apps

G2 Users Love Us Badge

Ready to Build Your CRM App?

Start your iOS project in minutes. No credit card required.

Build with AI Agent