DEV Community

Midhet Sulemani
Midhet Sulemani

Posted on • Edited on

Cloud Firestore DB with Swift

As most mobile application developers I have encountered in my experience, have a basic understanding and experience in connecting and implementing a basic database structure and design for an application prototype or a side project they might be working on. But as for me, who switched from front end web development to developing apps in Swift, I didn't have a clue on connecting databases to build a working application with web services.

David saying he has no clue

After a lot of begging my backend dev friends to make databases for me and getting a lot of annoyed rebuttals, I decided to take matters into my own hands. I discovered how to use Cloud Firestore for designing my own database and web services. An overview on getting started here


Since Cloud Firestore is based on a NoSQL database, you can use the service as a data dump, but also add some structure if you'd like. A little bit of understanding of terminology between SQL and NoSQL databases and how you could turn a NoSQL database into a relational one.

An explanation on how this will work out:

Translation of terminology between Cloud Firestore and a SQL based Relational DB

Let's take an example of a database of Cars and their owners in a City/Administrative region.

Cars have information on their owner, model and license plate number. Owners have their id, name and email/contact.

The following image will show this design in a Relational Database:

Cars and Owners DB design in SQL

The next image is a translation of the same design in a Cloud Firestore DB:

Cars and Owners DB design in Cloud Firestore


To learn more and get a sense of the working of Firestore and its queries, you could try out this codelab


Apologies for my handwriting in the DB Images. Hope you understood what I was trying to say. That's all for this blog!

Bye bye GIF

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

ACI image

ACI.dev: Fully Open-source AI Agent Tool-Use Infra (Composio Alternative)

100% open-source tool-use platform (backend, dev portal, integration library, SDK/MCP) that connects your AI agents to 600+ tools with multi-tenant auth, granular permissions, and access through direct function calling or a unified MCP server.

Check out our GitHub!