{"id":45157416,"url":"https://github.com/couchbase-examples/expo-cbl-travel","last_synced_at":"2026-02-20T05:02:41.073Z","repository":{"id":256856663,"uuid":"856637126","full_name":"couchbase-examples/expo-cbl-travel","owner":"couchbase-examples","description":"Expo based React Native app that uses cbl-reactnative and the Travel-Sample bucket dataset with the hotels and landmark collections","archived":false,"fork":false,"pushed_at":"2025-12-19T12:47:02.000Z","size":150349,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-12-22T04:46:50.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/couchbase-examples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-12T23:40:55.000Z","updated_at":"2025-10-28T17:42:35.000Z","dependencies_parsed_at":"2024-09-19T06:45:37.255Z","dependency_job_id":null,"html_url":"https://github.com/couchbase-examples/expo-cbl-travel","commit_stats":null,"previous_names":["couchbase-examples/expo-cbl-travel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/couchbase-examples/expo-cbl-travel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fexpo-cbl-travel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fexpo-cbl-travel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fexpo-cbl-travel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fexpo-cbl-travel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/couchbase-examples","download_url":"https://codeload.github.com/couchbase-examples/expo-cbl-travel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fexpo-cbl-travel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29641929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T03:21:14.183Z","status":"ssl_error","status_checked_at":"2026-02-20T03:18:24.455Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-20T05:02:37.483Z","updated_at":"2026-02-20T05:02:41.067Z","avatar_url":"https://github.com/couchbase-examples.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Couchbase Lite React Native - Expo Travel Sample App 👋\n\n# Overview\n\nThis is an example app of a simple React Native app that uses the [Couchbase Lite](https://www.couchbase.com/products/lite) database. The app lists a set of Landmarks and Hotels that are provided as part of the [Couchbase Travel-Sample](https://docs.couchbase.com/cloud/get-started/run-first-queries.html) dataset. \n\nThis app assumes you have a Capella Free Tier operational cluster with the travel-sample dataset installed. To find out more information about the free tier, please visit this blog post [Couchbase Cloud](https://www.couchbase.com/blog/free-tier-capella-dev-available/).\n\n## Prerequisites\n\n- **iOS**: iOS 15.0 or higher\n- **Android**: Android SDK 24 (Android 7.0) or higher\n- **Node.js**: Latest LTS version recommended\n- **Expo CLI**: For running the development server\n\n## Couchbase Lite Version\n\nThis application uses **Couchbase Lite 3.3** with the following modern APIs:\n\n### Key Features\n- **LogSinks API**: Modern logging configuration with `LogSinks.setConsole()` for flexible log management\n- **CollectionConfiguration**: Constructor-based replicator setup with collection-specific configurations\n- **Collection-based Replication**: Sync specific collections from your Capella App Services endpoint\n- **Full-Text Search**: Implemented with `MATCH()` queries for hotel search functionality\n- **Value Indexes**: Optimized query performance for landmark and hotel searches\n\n### API Highlights\n```typescript\n// Modern logging with LogSinks\nawait LogSinks.setConsole({\n  level: LogLevel.DEBUG,\n  domains: [LogDomain.ALL]\n});\n\n// Collection-based replication\nconst collectionConfigs = collections.map(col =\u003e new CollectionConfiguration(col));\nconst config = new ReplicatorConfiguration(collectionConfigs, targetUrl);\n```\n\n## App Services Setup\n\nLog into your Capella Free-Tier account. A listing of Operational Clusters should appear. Click on your demo-cluster in the listing. This should bring up the Home page for your cluster.\n\n### Create a new App Service\n\nOn the Home tab under the `Explore your cluster` section find the section `Try App Services` and click on the link `Deploy App Services`.\n\nOn the main App Services page click the `Create App Service` button. The Create App Services page should appear.\n\nOn the Create App Services page, give your app service a name. You can name it anything you like, for example `demo-app-service`. Under the Linked Cluster section select `demo-cluster` from the pull-down select list. Finally, you can click the `Create App Service` button.\n\nIt will take between 5 and 25 minutes for your new App Service to be created. \n\n### Creating a new Endpoint\n\nOnce your cluster is created and the status is listed as `Healthy`, click on the newly created App Service name in the list, i.e. `demo-app-service`.\n\nOne the App Endpoints screen, click the `Create App Endpoint` button to create a new Endpoint.\n\nOn the Create App Endpoint page, enter the name `locations` in the App Endpoint Name field. In the Bucket selection list, select the `travel-sample` bucket. In the Scope selection list, select the `inventory` scope.\n\nUnder the `Choose collections to link` section, click the `Link` switch for both the `landmark` and `hotel` collections. This will link those two collections to this App Endpoint allowing us to sync data from those collections to our mobile app.  \n\nFinally, click the `Create App Endpoint` button. The App Endpoints listing page should appear.\n\n### Setup App Endpoint Security\n\nOn the App Endpoints listing page, click on the newly created endpoint `locations`. This will bring up the App Endpoint section of Capella App Services. \n\nOn the Security page the Access and Validation screen should appear. A message on this page states that the App Endpoint is paused. Click the `Resume app endpoint` link to resume the endpoint. This may take a few seconds to complete.\n\nWe are going to use the default Access Control and Data Validation scripts, so click the `App Users` tab from the navigation menu on the left.\n\nOn the App Users page, click the `Create App User` button. This will bring up the Create App User page. Enter a username and password for the new user. For this example, you can use `demo@example.com` for the username and `P@ssw0rd12` for the password.\n\nClick the `Configure Access Grants` link to expand the grants section. Under the `Assign Channels` section locate the `hotel` listing under `LINKED COLLECTIONS` and add an Admin Channel name of `hotel` and hit the enter key. It should show the name in a chip format. Now locate the `landmark` listing under `LINKED COLLECTIONS` and add an Admin Channel name of `landmark` and hit the enter key. It should show the name in a chip format. This will give the new user access to the `hotel` and `landmark` collections.\n\nClick the `Create App User` button to create the new user.\n\n### Setup Delta Sync (optional)\n\nClick on the `Settings` tab on the top navigation menu. From the `App Endpoint Settings` screen click on the `Delta Sync` tab located in the CONFIGURATION menu on the left side of the page.  \n\nClick the `Enable Delta Sync` switch to enable Delta Sync. Click the `Save` button to save the changes.\n\n### Get the Endpoint URL \n\nClick on the `Connect` tab on the navigation menu in the header of the page. The Connect page should appear. The URL for the App Endpoint is listed in the `Public Connection` section. You will need this URL to connect the mobile app to the App Endpoint. Click the two sheets of paper (copy) button next to the public connection string in order to copy the URL to your clipboard on your computer. We can then paste in the URL into the configuration.\n\n## Pull down the code\n\nFrom a terminal you can use the git command to pull down the code from the repository:\n\n```bash\ngit clone https://github.com/couchbase-examples/couchbase-tutorials.git\ncd expo-cbl-travel\n```\n\n## Set up the Mobile App \n\nTo set up the mobile app, first install the npm dependencies from the terminal:\n\n```bash\nnpm install\n```\n\n### Update the Configuration\n\nOpen the `app.json` file and locate the `extra` section at the bottom. You will need to update three configuration values:\n\n```json\n\"extra\": {\n  \"capellaEndpointUrl\": \"wss://xxxxxx.apps.cloud.couchbase.com:4984/travel-location\",\n  \"capellaUsername\": \"demo@example.com\",\n  \"capellaPassword\": \"P@ssw0rd12\"\n}\n```\n\nReplace the following values:\n\n1. **capellaEndpointUrl**: Paste the connection string you copied from your Capella App Services endpoint (from the setup steps above)\n2. **capellaUsername**: Enter the username you created in the App Users section\n3. **capellaPassword**: Enter the password you created for that user\n\n**Example:**\n```json\n\"extra\": {\n  \"capellaEndpointUrl\": \"wss://abcd1234.apps.cloud.couchbase.com:4984/locations\",\n  \"capellaUsername\": \"demo@example.com\",\n  \"capellaPassword\": \"P@ssw0rd12\"\n}\n```\n\n### Running the app\n\n#### iOS Setup\n\n**Prerequisites:**\n- macOS with Xcode installed\n- CocoaPods installed (`sudo gem install cocoapods`)\n- iOS 15.0+ simulator or device\n\n**Steps:**\n1. Install iOS dependencies:\n```bash\ncd ios \u0026\u0026 pod install \u0026\u0026 cd ..\n```\n\n2. Run the iOS app:\n```bash\nnpx expo run:ios\n```\n\nOr use the Expo development server:\n```bash\nnpm run start\n# Then press 'i' to open iOS simulator\n```\n\n#### Android Setup\n\n**Prerequisites:**\n- Android Studio installed\n- Android SDK 24 (Android 7.0) or higher\n- Android emulator or physical device\n\n**Steps:**\n1. Run the Android app:\n```bash\nnpx expo run:android\n```\n\nOr use the Expo development server:\n```bash\nnpm run start\n# Then press 'a' to open Android emulator\n```\n\n**Note for Production Builds:**\nThis example app uses default Android signing for simplicity. For production or distribution, you must:\n1. Generate your own keystore: `keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000`\n2. Configure signing in `android/app/build.gradle`\n3. Never commit your keystore to version control\n4. See [React Native Signed APK Guide](https://reactnative.dev/docs/signed-apk-android) for details\n\n#### Development Server\n\nTo run an expo development server with more options:\n\n```bash\nnpm run start\n```\n\nIn the output, you'll find options to open the app in an iOS simulator or Android emulator.\n\nMore information on developing mobile apps with Expo can be found in the links below:\n- [development build](https://docs.expo.dev/develop/development-builds/introduction/)\n- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)\n- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)\n\n## Features\n\nThis sample app demonstrates the following Couchbase Lite features:\n\n### Database Operations\n- **Database Creation**: Encrypted local database with `DatabaseConfiguration`\n- **Collections**: Organized data into scoped collections (`inventory.hotel` and `inventory.landmark`)\n- **Indexing**: Full-text search indexes and value indexes for optimized queries\n\n### Queries\n- **SQL++ Queries**: Using Couchbase's powerful SQL++ query language\n- **Full-Text Search**: Find hotels using the `MATCH()` function\n- **Filtered Queries**: Search landmarks by name, location, and activity type\n\n### Replication\n- **Bi-directional Sync**: Real-time synchronization with Capella App Services\n- **Collection-based Replication**: Selective sync of specific collections\n- **Continuous Replication**: Automatic background synchronization\n- **Authentication**: Secure connection with BasicAuthenticator\n\n### Logging\n- **LogSinks API**: Modern, flexible logging configuration\n- **Console Logging**: Debug output for development and troubleshooting\n\n## Project Structure\n\n```\nexpo-cbl-travel/\n├── app/                      # Expo Router screens\n│   ├── (tabs)/              # Tab-based navigation\n│   │   ├── index.tsx        # Landmarks screen\n│   │   └── hotel.tsx        # Hotels screen\n│   └── _layout.tsx          # Root layout\n├── components/              # Reusable React components\n├── hooks/                   # Custom React hooks\n│   ├── getHotels.ts        # Hook for fetching hotels\n│   ├── getLandmarks.ts     # Hook for fetching landmarks\n│   └── startLogging.ts     # Logging configuration\n├── providers/              # React Context providers\n│   └── DatabaseProvider.tsx # Database initialization context\n├── services/               # Business logic services\n│   └── database.service.ts # Core database operations\n├── models/                 # TypeScript interfaces\n└── app.json               # Expo and app configuration\n```\n\n## Learn more\n\nTo learn more about Couchbase Lite and React Native, look at the following resources:\n- [cbl-reactnative documentation](https://cbl-reactnative.dev/)\n- [Couchbase Lite Documentation](https://docs.couchbase.com/couchbase-lite/current/introduction.html)\n\nTo learn more about Expo, look at the following resources:\n- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).\n- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.\n\n## Join the community\n\nJoin our community of developers:\n\n- [Discord community](https://bit.ly/3NbK5vg): Chat with Couchbase developers and ask questions.\n- [Stack Overflow community](https://stackoverflow.com/tags/couchbase/info/): Ask questions.\n- [Developer Portal](https://www.couchbase.com/developer): More information including tutorials and learning paths.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase-examples%2Fexpo-cbl-travel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouchbase-examples%2Fexpo-cbl-travel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase-examples%2Fexpo-cbl-travel/lists"}