firebase
firebase
1. Realtime Database
3. Authentication
4. Cloud Functions
5. Cloud Storage
Store and serve user-generated content like images, videos, and other files.
Offers secure file uploads and downloads using Firebase Authentication rules.
6. Hosting
Deploy static files like HTML, CSS, JavaScript, and media files easily.
Supports custom domains with free SSL certificates.
Includes a content delivery network (CDN) for fast global delivery.
8. Firebase Analytics
Dynamically change app behavior and appearance without deploying new code.
A/B test features with different user segments.
Integrate pre-trained models like text recognition, image labeling, and more.
Use AutoML to train custom models for unique use cases.
To implement signup and login authentication using Firebase, you'll need to use Firebase
Authentication, which simplifies user management, allowing you to securely register and
authenticate users in your app. Here’s a step-by-step guide on setting up Firebase
Authentication for signup and login in JavaScript:
1. Create a Firebase Project: Go to Firebase Console, create a new project, and give it
a name.
2. Add Web App: Inside your project, add a new Web app to get the Firebase
configuration details.
3. Install Firebase SDK: Include Firebase SDK in your project by adding this to your
HTML or installing via npm:
4. Initialize Firebase: Use the Firebase configuration details from your project to
initialize Firebase.
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
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Firebase Auth Example</title>
</head>
<body>
<h2>Sign Up</h2>
<input type="email" id="signupEmail"
placeholder="Email" />
<input type="password" id="signupPassword"
placeholder="Password" />
<button>Sign Up</button>
<h2>Login</h2>
<input type="email" id="loginEmail"
placeholder="Email" />
<input type="password" id="loginPassword"
placeholder="Password" />
<button id="btn2">Login</button>
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
var btn1 = document.querySelector("button")
btn1.addEventListener("click", signUp)
// Sign Up Function
function signUp() {
var email =
document.getElementById('signupEmail').value;
var password =
document.getElementById('signupPassword').value
createUserWithEmailAndPassword(auth, email,
password)
.then((userCredential) => {
const user = userCredential.user;
console.log("User signed up:", user);
alert("Signup successful!");
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.error("Signup error",
errorCode, errorMessage);
alert(`Signup failed: $
{errorMessage}`);
});
}
// signUp("[email protected]",
"ram@1234")
// logIn("[email protected]", "ram@1234")
var btn2 = document.getElementById("btn2")
btn2.addEventListener("click", logIn)
// Login Function
function logIn() {
var email =
document.getElementById('loginEmail').value;
var password =
document.getElementById('loginPassword').value
signInWithEmailAndPassword(auth, email,
password)
.then((userCredential) => {
const user = userCredential.user;
console.log("User logged in:", user);
alert("Login successful!");
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.error("Login error",
errorCode, errorMessage);
alert(`Login failed: $
{errorMessage}`);
});
}
</html>
Links to refer
https://firebase.google.com/docs/auth/web/password-auth
youtube reference
https://youtu.be/qYER6hAgJik?si=lkLR6TDXqsR-p5FM
Firebase provides a versatile backend platform that supports a wide range of applications. Here's a
list of the types of applications you can build using Firebase:
Examples:
Examples:
o Social networking platforms (e.g., Instagram-like apps).
3. E-Commerce Applications
o User authentication
o Product catalog
Example Features:
Examples:
Example Features:
6. Gaming Applications
Examples:
o Real-time strategy games.
Use Cases:
Examples:
o News apps.
Examples:
o Podcast apps.
Examples:
Examples:
o Telemedicine platforms.
Provide:
Examples:
o Quiz apps.
Examples:
Example:
Examples:
o Expense trackers.
o Investment portfolio managers.
Examples: