This document provides an overview of how ZoneVitae uses Firebase services to power its backend functionality.
ZoneVitae leverages Firebase to provide a scalable, real-time capable backend for our community reporting and management platform. Firebase offers several advantages for our application:
- Firestore Database: NoSQL database for storing user data, communities, reports, and other app data
- Authentication: Secure user authentication with email/password, social logins, and more
- Storage: Cloud storage for user uploads like profile pictures, community logos, and report photos
The Firebase implementation for ZoneVitae includes:
firestore-structure.md: Detailed documentation of our Firestore database structurefirebase-setup-guide.md: Step-by-step guide for setting up Firebase for this projectimport-script.js: Script for importing sample data into Firestorereponse.json: Sample data in JSON format for development/testing
To set up the Firebase backend for ZoneVitae:
- Follow the instructions in
firebase-setup-guide.mdto create and configure your Firebase project - Review
firestore-structure.mdto understand the data model - Use
import-script.jsto populate your Firestore database with sample data
ZoneVitae uses a NoSQL data model in Firestore with the following main collections:
usuarios: User profiles and account informationcomunidades: Community information and metadatareports: User-submitted reports about issues in communitiesactividades: Community events and activitiestags: Categories for classifying reports and communities
For the complete data model with relationships and subcollections, refer to firestore-structure.md.
Our primary database for storing and querying application data. The structure is optimized for common queries and real-time updates.
Firebase Authentication handles user registration, login, and access control. We use:
- Email/password authentication
- Account management (password reset, email verification)
- Security rules integration with Firestore
Cloud Storage manages binary assets such as:
- User profile pictures
- Community logos and cover images
- Report photos
- Activity cover images
The application implements security through:
- Firebase Authentication for identity verification
- Firestore security rules for access control
- Client-side validation alongside server-side rules
The Angular client connects to Firebase through:
@angular/firelibrary for Angular integration- Service classes in
/client/src/app/services/that abstract Firebase operations - Environment configuration in
/client/src/environments/environment.ts
When working with the Firebase implementation:
- Use the local emulators for development to avoid costs and rate limits
- Test security rules thoroughly before deployment
- Maintain backward compatibility when modifying data structures
- Use Firebase console for monitoring and debugging
Deployment of Firebase configuration is handled through the Firebase CLI:
# Install Firebase CLI if not already installed
npm install -g firebase-tools
# Login to Firebase
firebase login
# Deploy Firebase configuration (Firestore rules, indexes, etc.)
firebase deploy