Create a file src/firebase.ts to initialize your connection:
;
;
const firebaseConfig = apiKey: "YOUR_API_KEY",
authDomain: "YOUR_PROJECT.firebaseapp.com",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_PROJECT.appspot.com",
messagingSenderId: "...",
appId: "..."
};
const app = ;
;In src/App.tsx, we will fetch the list of pets from Firestore and display them.
;
;
;
interface Pet
const = useState<Pet>;
const const querySnapshot = await ;
const petList = querySnapshot.. ;
};
;
}, );
return <div>
<h1>🐾 Edge Pet Store</h1>
<ul>
<li key=> </li>
))}
</ul>
</div>
);
}
;Run the development server:
Better UI
-
config tailwind
@src/App.tsxand add functionality to add new pets@src/App.tsxadd loading indicator when fetching pets
Configure Cloudflare Worker (SPA Mode)
Create your wrangler.toml in the project root.
We use the not_found_handling setting to ensure the React Router (if you add one later) or hard refreshes don’t break.
name = "firebase"
compatibility_date = "2026-03-16"
[assets]
directory = "dist"
not_found_handling = "single-page-application"Build your React app:
Deploy to Cloudflare:
Auth
add auth
sign in with google doesn’t work
add firebase mcp