Skip to main content

Mobile app with Ionic

This guide shows you how to create a Stream chat mobile app with Ionic + Capacitor. The guide is based on the Ionic + Angular tutorial.

You can find the required tools in the Ionic guide.

Install ionic tooling

npm install -g @ionic/cli native-run cordova-res

Create the app

Next, create an Ionic Angular app using the "side menu" template and add Capacitor for native functionality:

ionic start chat-app sidemenu --type=angular --capacitor

Next, change into the app folder:

cd chat-app

You can start the app with the following command:

npm start

Create the chat UI

Install the necessary dependencies:

npm install stream-chat-angular stream-chat @ngx-translate/core

Add this to your tsconfig.json file to the compilerOptions part:

"allowSyntheticDefaultImports": true

Import CSS in your global.scss file:

@import "~stream-chat-angular/src/assets/styles/v2/scss/index.scss";

Add the module imports required by stream-chat-angular to the app.module.ts file:

import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { RouteReuseStrategy } from "@angular/router";

import { IonicModule, IonicRouteStrategy } from "@ionic/angular";

import { AppComponent } from "./app.component";
import { AppRoutingModule } from "./app-routing.module";
import { TranslateModule } from "@ngx-translate/core";
import {
} from "stream-chat-angular";

declarations: [AppComponent],
imports: [
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent],
export class AppModule {}

Connect to your Stream chat application by replacing the content of the app.component.ts file (add the necessary credentials to your environment.ts file):

If you don't already have a Stream account you can start your free trial.

import { Component, OnInit } from "@angular/core";
import { environment } from "src/environments/environment";
import {
} from "stream-chat-angular";

selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.scss"],
export class AppComponent implements OnInit {
private chatService: ChatClientService,
private channelService: ChannelService,
private streamI18nService: StreamI18nService
) {
const apiKey = environment.apiKey;
const userId = environment.userId;
const userToken = environment.userToken;
this.chatService.init(apiKey, userId, userToken);

async ngOnInit() {
type: "messaging",
members: { $in: [environment.userId] },

Display the channel list in your app.component.html:

<ion-split-pane contentId="main-content">
<ion-menu contentId="main-content" type="overlay">
<ion-menu-toggle auto-hide="false">
<ion-router-outlet id="main-content"></ion-router-outlet>

Extend the folder.module.ts with the necessary module imports:

import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { FormsModule } from "@angular/forms";

import { IonicModule } from "@ionic/angular";

import { FolderPageRoutingModule } from "./folder-routing.module";

import { FolderPage } from "./";
import { StreamChatModule } from "stream-chat-angular";

imports: [
declarations: [FolderPage],
export class FolderPageModule {}

Display the active channel in the

<ion-content [fullscreen]="true">
<stream-thread name="thread">
<stream-message-list mode="thread"></stream-message-list>
<stream-message-input mode="thread"></stream-message-input>

Our chat UI is now ready.

Deploying to iOS and Android

Create a clean build

ionic build

Next, create both the iOS and Android projects:

ionic cap add ios
ionic cap add android

For more information see the Ionic guide

Open the iOS app:

ionic cap open ios

This will open XCode on your machine, you can start the app by clicking the play button on the top toolbar.

Open the Android app:

ionic cap open android

This will open Android studio on your machine, you can start the app by clicking the play button on the top toolbar.

We've successfully deployed our Stream chat mobile app to iOS and Android.

Push notifications

We have a separate push notification guide to show you how to add push notifications to your mobile apps.

Did you find this page helpful?