Firebase Development

作者 mindrally97184105b5da無授權條款269 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 週前更新

Firebase development guidelines for Firestore, Authentication, Functions, and Storage with TypeScript and Angular.

AI 產生的概覽

使用 TypeScript 與 Angular 開發 Firebase 應用程式(Firestore、驗證、雲端函式、儲存空間)的指南。

功能
提供 Firebase 開發的程式碼撰寫指南與最佳實務,涵蓋 Firestore、驗證、雲端函式與儲存空間。內容包括專案結構、程式碼組織、命名慣例、效能最佳化與測試要求。產出的是建議性指引,而非程式碼或檔案。
適用情境
適用於實作或審查以 Firebase 為基礎的應用程式,尤其是使用 TypeScript 與 Angular 的情境。可用於規劃 Firestore 集合、服務、安全規則與雲端函式。
執行需求
不需要任何工具、套件或憑證;僅為說明性內容,未附帶指令碼。

Firebase Development

You are an expert in Firebase development with Firestore, Authentication, Cloud Functions, and Storage.

Project Structure

  • Organize code by feature directories (services, components, pipes)
  • Use environment variables for development, staging, and production
  • Structure Firestore collections logically (users, spots, bookings)
  • Maintain separate Firebase configurations per environment

Code Organization Best Practices

  • Use descriptive naming: "getUsers", "calculateTotalPrice"
  • Keep classes small and focused
  • Minimize global state usage
  • Centralize API calls and error handling through services
  • Manage storage through a single point of entry with centralized key definitions

Firebase-Specific Patterns

Firestore

  • Create dedicated services for each Firestore collection type
  • Implement centralized Firebase error handling
  • Use transactions for data consistency
  • Apply Firebase security rules for data protection

Cloud Functions

  • Leverage Firebase Functions for serverless backend logic
  • Implement proper error handling and logging
  • Use typed function parameters and responses

Storage

  • Handle file uploads/downloads via Firebase Storage
  • Implement proper access control
  • Use signed URLs for secure file access

Authentication

  • Manage user identity through Firebase Authentication
  • Implement proper session management
  • Handle auth state changes reactively

Naming Conventions

  • camelCase: functions and variables
  • kebab-case: file names (user-service.ts)
  • PascalCase: classes (UserService)
  • Boolean prefixes: should, has, is (shouldLoadData, isLoading)
  • Collections: plural nouns
  • Documents: descriptive IDs

Performance Optimization

  • Implement lazy loading and data prefetching
  • Cache frequently accessed data
  • Use global error and alert handlers
  • Implement Firebase offline persistence
  • Apply query cursors for pagination
  • Optimize Firestore reads through proper indexing
  • Use batch operations for bulk updates

Testing Requirements

  • Write comprehensive unit tests covering edge cases
  • Mock native plugins and Firestore services
  • Test Firebase security rules thoroughly
  • Validate offline functionality

來源與署名

來源:mindrally/skills位於firebase-development提交9718410

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架