mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-28 05:32:54 +08:00
- Refreshed all 241 library rules with current best practices - Updated Exa search results for all libraries with 2025 content - Fixed --regenerate-all flag logic to properly process all libraries - Removed duplicate astro entry in rules.json (merged tags) - Added missing docker.mdc and vim.mdc files - All rules now include modern patterns and anti-patterns - Updated with framework-specific recommendations for 2025 Technical improvements: - Fixed retry_failed_only logic in generate_mdc_files.py - Improved progress tracking for regeneration scenarios - Ensured proper handling of --refresh-exa flag
29 lines
1.4 KiB
Plaintext
29 lines
1.4 KiB
Plaintext
---
|
|
description: This guide provides definitive, opinionated best practices for building secure, performant, and maintainable applications with Firebase, focusing on modern patterns and avoiding common pitfalls.
|
|
globs: **/*
|
|
---
|
|
# firebase Best Practices
|
|
|
|
Firebase is a powerful Backend-as-a-Service (BaaS) that accelerates development. To leverage it effectively, you must adhere to strict best practices for security, performance, and maintainability. This guide outlines the definitive approach for our team.
|
|
|
|
## 1. Security Best Practices
|
|
|
|
Security is paramount. Assume all client-side code is compromised and enforce access control exclusively through Firebase Security Rules and App Check.
|
|
|
|
### 1.1 Enable Firebase App Check
|
|
|
|
Always enable App Check for all supported Firebase services. This verifies that requests originate from your authentic app and an untampered device, preventing unauthorized clients from accessing your backend.
|
|
|
|
**✅ GOOD: Enable App Check**
|
|
Configure App Check in the Firebase Console for Firestore, Realtime Database, Storage, and Functions. On the client, initialize it early.
|
|
|
|
```typescript
|
|
// client/src/firebase.ts
|
|
import { initializeApp } from 'firebase/app';
|
|
import { initializeAppCheck, ReCaptchaV3Provider } from 'firebase/app-check';
|
|
// For mobile, use platform-specific providers (e.g., ReactNativeFirebaseAppCheckProvider)
|
|
|
|
const firebaseConfig = {
|
|
apiKey: "YOUR_API_KEY",
|
|
authDomain: "YOUR_AUTH_DOMAIN",
|
|
projectId: "YOUR_PROJECT_ |