Skip to main content
rule

firebase — Cursor rule: what it does, how to install

Enforces Firebase security patterns in Cursor. Focuses on setting up App Check and relying on Security Rules rather than client logic.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/firebase.mdc
Open on GitHub

What firebase does

This rule applies across the repository via the **/* glob. It instructs the assistant to treat all client-side code as compromised. Because of this, access control belongs strictly in Firebase Security Rules and App Check.

The guide mandates App Check across Firestore, Realtime Database, Storage, and Functions. Initialization happens early on the client using initializeAppCheck with providers like ReCaptchaV3Provider for web apps or native providers for mobile setups. Without registering the application inside the Firebase Console, App Check verifications will fail.

What it helps with

  • configure Firebase App Check for incoming client requests
  • initialize ReCaptchaV3Provider in client bootstrap files
  • enforce access boundaries on Firestore, Storage, and Functions

Example prompts for the agent

  • Initialize Firebase App Check inside firebase.ts
  • Configure ReCaptchaV3Provider for client verification
  • Set up Firebase initialization for web with App Check

How to install firebase

Manually: put the files in place

.cursor/rules/firebase.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about firebase

How do I install the firebase rule in Cursor?

Save the rule content into .cursor/rules/firebase.mdc in your repository root. Cursor will automatically apply these instructions across the workspace.

What does the firebase rule do?

It directs Cursor to follow strict Firebase security practices, emphasizing client verification via App Check and server-enforced security rules.

Which Firebase services require App Check?

The guide specifies enabling App Check for Firestore, Realtime Database, Storage, and Functions.

Source text

firebase.mdc · CC0-1.0
---
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_

© sanjeed5 · CC0-1.0 · sanjeed5/awesome-cursor-rules-mdc

Similar IDE rules

All IDE rules for Security →

From the same set240

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor