# Implementing a Newsletter Segment

In the last blog post, Firebase had helped me create a newsletter segment at the bottom of my main page. All it has done is to include a form to allow people to write their email and click Subscribe. However the functionality and backend database has not been built.

## Integrating Firebase to my Code

### Building Database

I started off asking what can Firebase do for me:

> How will Firebase help me to build the database behind to house the list of emails set up?

It explained the steps that could be done: (1) set up Firestore, (2) create a collection and (3) store emails as Documents in the collection. It then asked if I wanted to "implement the functionality". I said yes, of course.

Looking at the changes that was implemented, it had modified the page function and added new actions. However it does not look as though the database was created. I think I might need to do that myself, and then link the codebase to the database.

### Creating a Database

I went to search for "Firestore database" on Google. It seems to be a NoSQL document database.

It allowed me to try for free, and indicated there will be 300 dollars worth of credit. Once I completely used it, I could change to a paid plan.

I wasn't sure what to do at this moment because there are so many parts in the website, so I asked Firebase:

> Will you be able to take me through the steps to create the Cloud Firestore in the firebase project and create the collection?

It gave me the steps with some links.

When i went into [`console.firebase.google.com`](http://console.firebase.google.com), it asked me to create a new project. I did not see the project which held my codebase yet, so I created one. Gemini was integrated to this project, so I asked it what I needed to do.

It asked me to set up some basic fundamental components such as Authentication for user sign up and sign in, Cloud Firestore for database and Firebase Hosting. I guess I shoud have done this right at the start!
