/blazor-blog

Blog made using Blazor

Primary LanguageC#

blazor-blog

Blazor Blog is a full-stack application simulating a blog website. Users, categories, and blog posts are managed and stored in an Azure SQL database. The application leverages Docker containers for deployment, with separate containers for the database and the front-end/back-end combined.

Features

  • Category Management: Users with admin privileges can create, edit, and delete categories.
  • Blog Post Management: Users with admin privileges can create, edit, and delete blog posts.
  • Authorization:
    • Visitor: Visitors can view published blog posts and navigate through the existing categories, filtering if needed.
    • Administrator: Administrators have full access to manage users, categories, and blog posts. With admin privileges you can create, edit and delete categories and blog posts. The paths to the authorized pages are only going to show up in the navigation top bar once you are logged in. If you try to access the url by pasting the link (e.g. /admin/manage-categories) without the authorization to do so, you'll receive a message saying that you are not allowed to view that page.

Technologies

  • Front-end: Blazor
  • Back-end: ASP.NET Core
  • Database: Azure SQL Database
  • Deployment: Docker
  • ORM: Entity Framework Core
  • Styling: Bootstrap
  • Authorization: ASP.NET Core Identity

Running the project

  1. Clone the repository:
git clone https://github.com/jpastolfi/blazor-blog
  1. Navigate to the project directory:
cd blazor-blog
  1. Build the project and run the application:
docker-compose up -d --build

This will start the application and the database container.

Before using the application you have to run the migrations with the following commands:

dotnet ef migrations add InitialCreate
dotnet ef database update

After this you can access the application at http://localhost:8080/.

Usage

  1. Log in: Navigate to http://localhost:8080/ and log in with the username visitor@blog.com
  2. Browse blog posts: Registered users can view all blog posts, while visitors can only see published posts.
  3. Create and manage blog posts: Registered users can create new blog posts and edit their existing ones.
  4. Manage categories: Registered users can create, edit, and delete categories.

Note: Only registered users can create blog posts and manage their own posts. Admins have full access to manage all aspects of the blog, including users, categories, and blog posts.