-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat(deps): Upgrade angular to v20, others dependencies to latest, improve docs #902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rafikhan
wants to merge
21
commits into
master
Choose a base branch
from
khanrafi/gemini
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
18697f3
Adding an initial gemini file
rafikhan 3c46fac
Adding gemini generated documentation on the codebase
rafikhan e38f003
feat(deps): upgrade angular from v16 to v17
rafikhan 205cb0c
feat(deps): upgrade angular from v17 to v18
rafikhan 171cf38
feat(deps): upgrade angular from v18 to v19
rafikhan ca65876
feat(deps): upgrade angular from v19 to v20
rafikhan 5e23179
feat(deps): upgrade @angular/cdk and @angular/material to v17
rafikhan e883e86
feat(deps): upgrade @angular/cdk and @angular/material to v18
rafikhan 16a9bfb
feat(deps): upgrade @angular/cdk and @angular/material to v19
rafikhan bb9f421
feat(deps): upgrade @angular/cdk and @angular/material to v20
rafikhan 74c0dfe
feat(deps): upgrade tooling dependencies
rafikhan ce7143e
feat(deps): upgrade backend dependencies
rafikhan c1cc976
feat(deps): upgrade rxjs and tslib
rafikhan e636409
fix(build): fixing build errors in app.module.ts caused by the recent…
rafikhan e199068
fix(styles): correct material styles and typography
rafikhan 3c13462
docs: update and correct documentation
rafikhan 7a2ef69
fix(app): address code review feedback
rafikhan 6bcb27e
style(app): correct indentation of @Component decorators
rafikhan 7cf2d13
chore(docs): Fixing angular urls
rafikhan e8669cc
chore(docs): Removing url paths that don't exist
rafikhan e887746
fix(tests): correct TestBed configuration for all components
rafikhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Friendly Eats | ||
|
||
A Firestore quickstart application for the web | ||
|
||
- This folder contains the frontend logic | ||
- `functions/` contains the backend logic | ||
- `scripts/` has helper code for the firebase emulator | ||
|
||
## Architecture | ||
- Use `npm` for dependencies. Always ask before adding a new dependency. | ||
- Use typescript for coding | ||
- This is a simple Angular web application | ||
- Source code is in `src/` | ||
|
||
## Essential commands | ||
- Build with `npm build` | ||
- Run tests with `npm test` | ||
- Format code with `npm fmt` | ||
|
||
## Workflow | ||
- Use a separate git branch for each major task | ||
- Make small commits frequently | ||
- Use conventional commits messages | ||
- Format code files before making commits | ||
- Ensure tests pass before making commits | ||
- Changes to the frontend and backend should happen in separate commits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Architecture | ||
|
||
The Friendly Eats application is a full-stack application with a clear separation of concerns between the frontend, backend, and helper scripts. | ||
|
||
## Frontend | ||
|
||
The frontend is an [Angular](https://angular.dev/) application located in the root directory of the project. It is responsible for rendering the user interface and interacting with the Firebase services. For more details, see the [frontend documentation](./frontend.md). | ||
|
||
## Backend | ||
|
||
The backend consists of a set of [Firebase Functions](https://firebase.google.com/docs/functions) located in the `functions` directory. These functions are triggered by events in the Firestore database and are used to perform actions such as calculating the average rating of a restaurant. For more details, see the [backend documentation](./backend.md). | ||
|
||
## Scripts | ||
|
||
The `scripts` directory contains helper scripts for populating the Firestore database with mock data. This is useful for development and testing purposes. | ||
|
||
## Integration | ||
|
||
The frontend, backend, and scripts are integrated through the `firebase.json` file. This file configures the Firestore rules and indexes, the emulators, and the Firebase Functions. | ||
|
||
For more information about the data model, see the [data model documentation](./data-model.md). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Backend | ||
|
||
The backend of the Friendly Eats application consists of a set of [Firebase Functions](https://firebase.google.com/docs/functions). | ||
|
||
## Commands | ||
|
||
The following commands are available for the backend (run from the `functions` directory): | ||
|
||
* `npm install`: Install dependencies. | ||
* `npm run build`: Build the functions. | ||
* `npm run serve`: Run the functions emulator. | ||
|
||
## Functions | ||
|
||
The Firebase Functions are located in the `functions/src/index.ts` file. Here is a brief overview of their purpose: | ||
|
||
* **`updateNumRatings`**: This function is triggered when a new rating is added to a restaurant's `ratings` sub-collection. It recalculates the average rating for the restaurant and updates the `avgRating` and `numRatings` fields in the corresponding restaurant document. | ||
|
||
## Note on Billing | ||
|
||
Firebase offers two main pricing plans: the Spark Plan (free) and the Blaze Plan (pay-as-you-go). The Spark Plan has a generous free tier for many services, including Cloud Functions. If you exceed the limits of the Spark Plan, your app's usage of that particular service will be capped for the rest of the billing cycle to prevent any charges. The Blaze Plan gives you the same free tier as the Spark Plan, but you are billed for any usage that exceeds those limits. | ||
|
||
For more information, see the [Firebase pricing page](https://firebase.google.com/pricing). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Data Model | ||
|
||
The Friendly Eats application uses two main collections in Firestore: `restaurants` and `ratings`. | ||
|
||
## `restaurants` | ||
|
||
This collection contains a document for each restaurant. The structure of a restaurant document is defined in the [`restaurant.ts`](../src/types/restaurant.ts) file. | ||
|
||
* `id` (string): The unique identifier for the restaurant. | ||
* `avgRating` (number): The average rating of the restaurant. | ||
* `category` (string): The category of the restaurant (e.g., "Pizza", "Mexican"). | ||
* `city` (string): The city where the restaurant is located. | ||
* `name` (string): The name of the restaurant. | ||
* `numRatings` (number): The number of ratings the restaurant has received. | ||
* `photo` (string): The URL of the restaurant's photo. | ||
* `price` (number): The price range of the restaurant (1-4). | ||
|
||
## `ratings` | ||
|
||
This is a sub-collection of a restaurant document. It contains a document for each rating that a restaurant has received. The structure of a rating document is defined in the [`ratings.ts`](../src/types/ratings.ts) file. | ||
|
||
* `id` (string, optional): The unique identifier for the rating. | ||
* `rating` (number): The rating given by the user (1-5). | ||
* `text` (string): The text of the review. | ||
* `timestamp` (Date, optional): The timestamp of the review. | ||
* `userId` (string, optional): The ID of the user who submitted the review. | ||
* `userName` (string, optional): The name of the user who submitted the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Frontend | ||
|
||
The frontend of the Friendly Eats application is an [Angular](https://angular.dev/) application. | ||
|
||
## Commands | ||
|
||
The following commands are available for the frontend: | ||
|
||
* `npm install`: Install dependencies. | ||
* `npm start`: Run the application with emulators. | ||
* `npm run production`: Run the application against a production Firebase project. | ||
* `npm test`: Run unit tests. | ||
* `npm run fmt`: Format code. | ||
|
||
## Components | ||
|
||
The main Angular components are located in the `src/app` directory. Here is a brief overview of their roles: | ||
|
||
* **`app.component`**: The root component of the application. | ||
* **`homepage`**: The main page of the application, which displays a list of restaurants. | ||
* **`restaurant-card`**: A card component that displays information about a single restaurant. | ||
* **`restuarant-page`**: A page that displays the details of a single restaurant, including its reviews. | ||
rafikhan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* **`review-list`**: A component that displays a list of reviews for a restaurant. | ||
* **`filter-dialog`**: A dialog that allows users to filter the list of restaurants. | ||
* **`sign-in-modal`**: A modal that allows users to sign in. | ||
* **`submit-review-modal`**: A modal that allows users to submit a review. | ||
|
||
## Firebase Connection | ||
|
||
The frontend connects to Firebase services through the `firebaseConfig` object in the `src/environments/environment.default.ts` and `src/environments/environment.prod.ts` files. This object contains the Firebase project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Friendly Eats Documentation | ||
|
||
Welcome to the documentation for the Friendly Eats application. This document provides a high-level overview of the project's purpose, architecture, and technology stack. | ||
|
||
For more detailed information, please see the following documents: | ||
|
||
* [Architecture](./architecture.md) | ||
* [Frontend](./frontend.md) | ||
* [Backend](./backend.md) | ||
* [Data Model](./data-model.md) | ||
* [Setup](./setup.md) | ||
|
||
## Project Purpose | ||
|
||
The Friendly Eats application is a demonstration of Firebase capabilities, specifically the JavaScript SDK, Firebase Auth, Firestore rules, and Firestore triggers. It is a simple restaurant review app where customers can anonymously find restaurants and read reviews. Once authenticated, they can create new restaurants and review them. | ||
|
||
## Technology Stack | ||
|
||
The application is built with the following technologies: | ||
|
||
* **Language**: [TypeScript](https://www.typescriptlang.org/) - The primary programming language for the application. | ||
* **Frontend**: | ||
* [Angular](https://angular.dev/) - A popular web application framework. Please note that this project currently uses an older version of Angular, while the Firebase integrations are more recent. | ||
* [Angular Material](https://material.angular.dev/) - UI component library for Angular. | ||
* **Backend**: [Firebase Functions](https://firebase.google.com/docs/functions) - Serverless functions to extend Firebase services. | ||
* **Database**: [Firestore](https://firebase.google.com/docs/firestore) - A flexible, scalable NoSQL cloud database. | ||
* **Authentication**: [Firebase Authentication](https://firebase.google.com/docs/auth) - A service for managing user authentication. | ||
* **Storage**: [Cloud Storage for Firebase](https://firebase.google.com/docs/storage) - A service for storing and serving user-generated content. | ||
* **Tooling**: | ||
* [npm](https://www.npmjs.com/) - Package manager for JavaScript. | ||
* [Angular CLI](https://angular.dev/cli) - Command-line interface for Angular. | ||
* [Firebase CLI](https://firebase.google.com/docs/cli) - Command-line interface for Firebase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Setup | ||
|
||
This document provides step-by-step instructions for setting up the Friendly Eats application for local development. | ||
|
||
## Prerequisites | ||
|
||
* [Node.js](https://nodejs.org/en/download) (version 16.0 or higher) | ||
* [Java](https://jdk.java.net/) (JDK version 11 or higher) | ||
* [Angular CLI](https://angular.dev/cli) | ||
* [Firebase CLI](https://firebase.google.com/docs/cli) | ||
|
||
To install the CLIs globally, run the following commands: | ||
|
||
```bash | ||
npm install -g @angular/cli | ||
npm install -g firebase-tools | ||
``` | ||
|
||
## Installation | ||
|
||
1. **Clone the repository:** | ||
|
||
```bash | ||
git clone https://github.com/firebase/quickstart-js.git | ||
cd quickstart-js/firestore | ||
``` | ||
|
||
2. **Install dependencies:** | ||
|
||
```bash | ||
npm install | ||
(cd functions && npm install) | ||
(cd scripts && npm install) | ||
``` | ||
|
||
## Configuration | ||
|
||
1. **Configure Firebase:** | ||
|
||
The application can be run against the Firebase Local Emulator Suite or a production Firebase project. | ||
|
||
* **Emulator Suite:** No configuration is needed. The necessary settings are in `src/environments/environment.default.ts`. | ||
|
||
* **Production Project:** | ||
|
||
1. Create a Firebase project in the [Firebase Console](https://console.firebase.google.com). | ||
2. Copy the `firebaseConfig` object from your project settings. | ||
3. Paste the `firebaseConfig` object into `src/environments/environment.prod.ts`. | ||
|
||
## Running the Application | ||
|
||
1. **Run the application:** | ||
|
||
* **With emulators:** | ||
|
||
```bash | ||
npm start | ||
``` | ||
This command will start the Firebase Emulator Suite and the Angular development server. The emulators are automatically populated with data from the `app-data-seed` directory on startup. | ||
|
||
* **Against a production project:** | ||
|
||
```bash | ||
npm run production | ||
``` | ||
|
||
2. **View the application:** | ||
|
||
Open your browser and navigate to `http://localhost:4200`. | ||
|
||
3. **Populating the database (optional):** | ||
|
||
If you need to add more mock data to your database, you can use the following commands: | ||
|
||
* **For emulators:** | ||
```bash | ||
npm run populate-emulators | ||
``` | ||
|
||
* **For a production project:** | ||
```bash | ||
npm run populate-production | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Friendly Eats backend logic | ||
|
||
This folder contains the backend logic for the firestore friendly eats sample application. This folder should be considered separate from the frontend. It has separate essential commands for building and running the api server. | ||
|
||
## Overview | ||
- Source code is in `src/` | ||
- The backend logic is a firebase function that uses firebase functions and firestore triggers | ||
|
||
## Essential commands | ||
- Build with `npm build` | ||
- Run the api server through `npm run serve` | ||
- There are no tests for this project |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.