Chatbase is a simple (mobile) chat app powered by an embedded Couchbase Lite database, the synchronization enginee of Sync Gateway, and a distributed Couchbase Server database.
Couchbase Mobile brings the power of NoSQL to the edge and is comprised of three components:
Couchbase Lite, an embedded, NoSQL JSON Document Style database for your mobile apps
Sync Gateway, an internet-facing synchronization mechanism that securely syncs data between mobile clients and server, and
Couchbase Server, a highly scalable, distributed NoSQL database platform
Chatbase uses Couchbase's Sync Gateway and Server solutions. Both components can be installed locally, on on-premisis servers, and/or within the cloud. For this demo we'll be installing everything locally for testing.
Sync Gateway is the synchronization server in a Couchbase Mobile deployment.
Sync Gateway is designed to provide data synchronization for large-scale interactive web, mobile, and IoT applications. Commonly used features include:
-
User authentication, ensuring that only authorized users can connect to Sync Gateway (see user authentication guide).
-
Access Control, guaranteeing that only relevant documents are synced. Sync Gateway accomplishes this by examining document and applying business logic to decide whether to assign the documents to channels. Access control and ensuring that only relevant documents are synced are achieved through the use of channels and the Sync Function.
To install Sync Gateway please follow the instructions here.
To start using Sync Gateway execute the following command.
~/Downloads/couchbase-sync-gateway/bin/sync_gateway ~/path/to/basic-sync-function.json
Note: "basic-sync-function.json" is included within the repo here.
To learn more about how to modify the Sync Gateway configuration file please see the documentation here.
Couchbase Server is an open source, distributed, NoSQL document-oriented engagement database. It exposes a fast key-value store with managed cache for sub-millisecond data operations, purpose-built indexers for fast queries and a powerful query engine for executing SQL-like queries. For mobile and Internet of Things environments Couchbase also runs natively on-device and manages synchronization to the server.
Couchbase Server is specialized to provide low-latency data management for large-scale interactive web, mobile, and IoT applications. Common requirements that Couchbase Server was designed to satisfy include:
Unified Programming Interface
- Query
- Search
- Mobile and IoT
- Analytics
- Core database engine
- Scale-out architecture
- Memory-first architecture
- Big data and SQL integrations
- Full-stack security
- Container and Cloud deployments
- High Availability
To install Couchbase Server please follow the instructions here.
Note: I advise installing Couchbase Server manually to start. If you install using Docker you will need to ensure that both Sync Gateway and Couchbase Server are running on the same Docker Host, and then you'll need to configure accordingly. You can find more instructions using Docker here.
Once Couchbase Server has been installed simply navigate to where it has been installed and start "Couchbase Server".
To start Couchbase Server using Docker please see the documentation here.
Couchbase Server can be accessed using
When Couchbase Server has been started you'll be able to navigate directly to the admin portal at http://localhost:8091.
Chatbase has two .NET solutions:
-
Chatbase.API: A .NET Core Web API solution used for communicating with Sync Gateway via the Admin API.
-
Chatbase: A Xamarin(.Forms) based solution containing several porjects
You will need to build and run the Chatbase.API solution before attempting to use the Chatbase mobile solution. You will also need to keep the Chatbase.API solution running.
Users are able to log into the app simply by entering a name and a Sync Gateway channel.
After you've logged in you'll be taken to the channel's chat screen, and will be able to send messages.
You'll also be able to switch channels by tapping the navigation bar title, and entering in a new channel name.
If you have any questions, comments, or would like to contribute to this projects please reach out to me directly at [email protected] or on Twitter.