Backend System Design: Authentication and Payment System (Firebase + stripe)
date
Apr 20, 2023
slug
System_Design1
author
status
Public
tags
Backend
⭐⭐⭐⭐⭐
summary
type
Post
thumbnail
updatedAt
Apr 25, 2023 02:19 AM
Background
I would like to share my experience in designing and implementing a basic backend system that requires authentication and subscription functionality. The following are some of the essential requirements of the system:
- Enable customers to subscribe and make payments.
- Develop a static website.
- Implement authentication, including email verification and password reset better if interacting with google, facebook authentication.
- Don’t want to maintain their own backend server.
- Easy access interface for owner management (code light solution).
Design Concept
Considering that they don’t want to maintain their own server and the requirement of access owner management, the main thing will be searching webservices with an API plug in. Base on the requirement of authentication and allow customer making the payment. Here are the features I need to find.
- Database
- SMTP server (for sending the email validation)
- Payment System
Components Introduction
Firebase
Firebase is a development platform for web and mobile applications that provides a vast array of tools and services to enable developers to create and manage top-quality applications. It offers an authentication feature that allows easy integration with Google and Facebook authentication, as well as the capability to manage sending verification emails. Additionally, Firebase provides a user-friendly interface for owners to manage their accounts.
Stripe
Stripe is a payment processing platform that caters to businesses of all sizes. It offers businesses the ability to accept payments online, in-person, and through mobile devices. Stripe's platform supports various payment methods, such as credit and debit cards, Apple Pay, Google Pay, and others.
Additionally, Stripe offers a lightweight code solution that simplifies product updates for business owners. This feature allows business owners to easily manage and make changes to their products without the need for extensive coding knowledge. With its user-friendly interface and comprehensive payment processing options, Stripe is an excellent choice in this case.
System Flow
The system comprises three main components: Stripe, Firebase Authentication, and Firebase Firestore. These components are connected to the frontend through three primary interfaces:
- Authentication: Users can sign up and log in directly through Firebase Authentication, which sends verification emails to users. Firebase Authentication also manages password resets and allows users to log in using other media accounts.
- Payment: When users decide to make a payment, Stripe communicates with Firebase Firestore to obtain user and product information. After verification, Stripe returns a payment URL, and the payment information is recorded in Firestore. This enables the owner to grant or restrict access to products. If a user decides to unsubscribe, Stripe updates the customer's status in Firestore immediately.
- Database Access: Users can read and write to the database while adhering to the security rules. This allows users to save personal data and load user profiles, among other functions.

What’s next?
Thanks for reading until here. I hope you enjoy it. For the future, I might sharing the detail step by step to setup such system.