Skip to content

theubaidistan/firebase-basics-2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase Basics

Firebase Basics

HTML5 CSS3 JavaScript Firebase Firebase Auth Firebase Hosting Firestore

Description

A comprehensive guide to getting started with Firebase, covering the essential services including Authentication, Hosting, and Firestore Database. This project demonstrates how to integrate Firebase into your web applications using HTML, CSS, and JavaScript.

Features

  • 🔐 Firebase Authentication - Secure user authentication
  • 🌐 Firebase Hosting - Fast and secure web hosting
  • 📊 Firestore Database - Scalable NoSQL cloud database
  • 💻 Modern Web Stack - Built with HTML5, CSS3, and JavaScript

Technologies Used

  • HTML5 - Markup language for structuring content
  • CSS3 - Styling and layout
  • JavaScript - Client-side programming
  • Firebase SDK - Backend services and APIs
  • Firebase Auth - User authentication and management
  • Firebase Hosting - Static web hosting
  • Firestore - Cloud-based NoSQL database

Getting Started

Prerequisites

  • Node.js and npm installed
  • Firebase account
  • Firebase CLI installed globally

Installation

  1. Clone the repository
git clone <your-repo-url>
cd firebase-basics
  1. Install Firebase CLI
npm install -g firebase-tools
  1. Login to Firebase
firebase login
  1. Initialize Firebase in your project
firebase init
  1. Select the services you need:
    • Firebase Hosting
    • Firestore
    • Authentication

Configuration

  1. Create a Firebase project in the Firebase Console
  2. Register your web app and copy the configuration
  3. Add your Firebase config to your JavaScript file:
const firebaseConfig = {
  apiKey: "YOUR_API_KEY",
  authDomain: "YOUR_AUTH_DOMAIN",
  projectId: "YOUR_PROJECT_ID",
  storageBucket: "YOUR_STORAGE_BUCKET",
  messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
  appId: "YOUR_APP_ID",
};

// Initialize Firebase
firebase.initializeApp(firebaseConfig);

Usage

Firebase Authentication

// Sign up new users
firebase.auth().createUserWithEmailAndPassword(email, password);

// Sign in existing users
firebase.auth().signInWithEmailAndPassword(email, password);

// Sign out
firebase.auth().signOut();

Firestore Database

// Get reference to Firestore
const db = firebase.firestore();

// Add data
db.collection("users").add({
  name: "John Doe",
  email: "[email protected]",
});

// Get data
db.collection("users")
  .get()
  .then((snapshot) => {
    snapshot.docs.forEach((doc) => {
      console.log(doc.data());
    });
  });

Deploy to Firebase Hosting

firebase deploy

Project Structure

firebase-basics/
├── public/
│   ├── index.html
│   ├── styles.css
│   └── app.js
├── firebase.json
├── .firebaserc
└── README.md

Resources

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For support, please open an issue in the repository or contact the maintainers.


Made with ❤️ using Firebase