How to Create a Basic CRUD Application with Blazor?
This guide will walk you through building a complete CRUD (create, read, update, delete) application using Blazor.
In this tutorial, you'll configure a Back4app project, design your database schema, and integrate your Blazor frontend with Back4app via REST APIs.
This process will help you establish a robust backend while ensuring your web application can efficiently manage data.
Initially, you'll set up a Back4app project titled Basic-CRUD-App-Blazor, which will serve as the backbone of your data management system.
Next, you'll craft a scalable database design by establishing detailed collections and fields, either manually or with the assistance of the Back4app AI Agent.
After that, you'll harness the power of the Back4app Admin App—a user-friendly, drag and drop interface—to manage your collections effortlessly.
Finally, you will connect your Blazor frontend to Back4app using REST APIs and secure your backend with proper access control.
By the end of this tutorial, you will have a production-ready web application that supports essential CRUD operations along with user authentication and secure data updates.
- Build CRUD applications that handle data operations seamlessly using a reliable backend.
- Acquire insights into creating a scalable backend and integrating it with a Blazor frontend.
- Utilize the drag and drop capabilities of the Back4app Admin App to simplify data management.
- Learn deployment techniques, including Docker containerization, to rapidly launch your application.
Before starting, make sure you have:
- A Back4app account and a new project set up. Visit Getting Started with Back4app if you need assistance.
- A Blazor development environment. Use Visual Studio or Visual Studio Code with the latest .NET SDK (version 6 or above).
- Sign into your Back4app account.
- Select the “New App” button from your dashboard.
- Input the project title: Basic-CRUD-App-Blazor and follow the on-screen instructions to complete the creation process.

After setup, your new project will display on your dashboard, providing a sturdy foundation for configuring your backend.
For this basic CRUD application, you'll need to create several collections. Below are examples of the collections along with the required fields and data types to set up your database efficiently.
Field | Data Type | Purpose |
---|---|---|
_id | ObjectId | Auto-generated unique identifier. |
title | String | The name or title of the item. |
description | String | A short summary of the item. |
created_at | Date | The timestamp when the item was created. |
updated_at | Date | The timestamp when the item was last modified. |
Field | Data Type | Purpose |
---|---|---|
_id | ObjectId | Auto-generated unique identifier. |
username | String | Unique identifier for the user. |
String | User’s email address. | |
password_hash | String | Encrypted password for secure login. |
created_at | Date | Timestamp of account creation. |
updated_at | Date | Timestamp of the last account update. |
You can create these collections manually in the Back4app dashboard by establishing a new class for each collection and adding the necessary columns.

You can define columns by choosing a data type, naming the field, setting default values, and determining if the field is mandatory.

The Back4app AI Agent streamlines schema creation directly from your dashboard. By entering a prompt detailing your collections and fields, the AI Agent automatically generates the necessary database schema.
- Access the AI Agent: Log in to your Back4app dashboard and locate the AI Agent in the settings or main menu.
- Define Your Data Model: Paste a descriptive prompt that lists the collections and their fields.
- Review and Confirm: Check the suggested schema and apply it to your project.
Using this AI Agent not only saves time but also ensures a consistent and efficient schema setup.
The Back4app Admin App provides a no-code, drag and drop interface to manage your backend data. This intuitive tool enables you to perform CRUD operations with ease.
- Navigate to the “More” menu on your Back4app dashboard.
- Click on “Admin App” and then select “Enable Admin App.”
- Set up your admin credentials by creating an initial admin user, which will also establish default roles and system collections.

After enabling, log in to the Admin App to manage your collections and data.

Inside the Admin App you can:
- Create Records: Click the “Add Record” button within a collection (for example, Items) to add new entries.
- Read/Update Records: Click on a record to inspect its details or modify its fields.
- Delete Records: Remove entries that are no longer necessary.
This simple, drag and drop interface significantly enhances the data management experience.
Now that your backend is configured, it’s time to integrate your Blazor frontend with Back4app.
Since the Parse SDK is not applicable to Blazor, you will leverage REST APIs to perform CRUD operations. In your Blazor application, use the HttpClient to interact with Back4app’s REST endpoints.
Create a service in your Blazor project to fetch items. For example:
Integrate such API calls within your Blazor components to manage CRUD operations.
Protect your data by setting ACLs on your objects. For instance, to create a private item:
Within the Back4app dashboard, adjust the CLPs for each collection to ensure only authorized users can access or modify sensitive data.
Back4app utilizes Parse’s User class to handle authentication. In your Blazor app, manage user sign-up and sign-in via REST calls. For example:
Similar methods can be implemented for login and session management. Additional functionalities like social logins, email verification, and password recovery can be set up via the Back4app dashboard.
Back4app’s Web Deployment feature allows you to seamlessly host your Blazor application by deploying your code from a GitHub repository.
- Open your project directory in a terminal.
Run the publish command:
- Verify the Build: Confirm that the output folder contains the necessary files (e.g., index.html, JavaScript, CSS, etc.).
Your Git repository should encapsulate the complete source of your Blazor application. An example folder structure might be:
Initialize Git in your project folder (if not already done):
Add your files:
Commit your changes:
- Create a GitHub repository: Name it Basic-CRUD-App-Blazor-Frontend.
Push your repository:
- Access the Web Deployment option: In your Back4app dashboard, open your project (Basic-CRUD-App-Blazor) and navigate to the Web Deployment section.
- Connect Your GitHub Account: Follow the prompts to link your GitHub account, allowing Back4app to access your repository.
- Select the Repository and Branch: Choose the repository (e.g., Basic-CRUD-App-Blazor-Frontend) and the branch (e.g., main) that holds your Blazor code.
Provide additional details such as:
- Build Command: If the published folder isn’t pre-generated, specify a command like dotnet publish -c Release.
- Output Directory: Set the output path (for example, bin/Release/net6.0/wwwroot).
- Environment Variables: Add any required environment settings (such as API keys) in the configuration.
If you prefer Docker for deployment, include a Dockerfile in your repository. Here’s an example:
Then, in your Web Deployment settings, select the Docker option to deploy your containerized application.
- Initiate the Deployment: Click the Deploy button in the Back4app dashboard.
- Monitor the Build: Back4app will fetch your code from GitHub, run the build command if necessary, and deploy your app in a container.
- Get Your URL: Once the deployment process is complete, Back4app will supply a URL for your hosted Blazor application.
- Open the Provided URL: Visit the URL in a browser to view your deployed app.
- Test the Application: Verify that all pages load correctly and that CRUD operations function as expected.
- Troubleshoot if Necessary: Use browser developer tools and review deployment logs on Back4app to diagnose any issues.
Congratulations! You have successfully built a basic CRUD application using Blazor and Back4app.
You set up a project titled Basic-CRUD-App-Blazor, designed collections for Items and Users, and utilized the Back4app Admin App for seamless data management.
Additionally, you integrated your Blazor frontend with Back4app using REST APIs and applied robust security measures.
Future Steps:
- Expand Your Frontend: Enhance your Blazor app with more detailed views, search functionality, or live notifications.
- Add Advanced Features: Consider incorporating Cloud Functions, third-party integrations, or role-based permissions.
- Consult Additional Resources: Review the Back4app documentation and other advanced tutorials to further optimize and expand your application.
By following this guide, you now have the foundation to build a scalable and secure CRUD backend for your Blazor application using Back4app. Happy coding!
