Building the BPE Blog Admin API: Project Setup
The Black Panther Enterprises website is currently built with Astro and deployed as a static web application. Markdown works well for storing and rendering blog posts, but manually creating files and committing them to the website repository is not an ideal long-term publishing workflow.
To make publishing easier, I am building a small administration API that will allow authorized users to create, edit, publish, and delete blog posts.
The initial workflow will look something like this:
- A blog post is created and saved through the administration application.
- The post remains in a draft state until it is ready to publish.
- Publishing generates or updates a Markdown file in the Astro website repository.
- The repository commit triggers the existing website deployment process.
- Deleting a published post removes the corresponding Markdown file and redeploys the site.
This gives us a simple content-management workflow without replacing Astro’s native content model or introducing a full CMS.
Creating the Microsoft Entra ID App Registration
I chose Microsoft Entra ID because it is an established identity platform that is straightforward to use and fits naturally with the rest of the application’s Azure infrastructure. App registrations provide a central place to manage an application’s identity, including token claims, API permissions, client credentials, and app roles.
I have used other identity platforms, including Auth0, in practice projects. Those platforms can work well, but each brings its own approach to identity and another provider to configure and maintain. Using Entra ID keeps this application on one platform, reduces the number of external services involved, and lowers the ongoing maintenance overhead.
The Enterprise applications area of Microsoft Entra ID also provides access to operational and security capabilities such as sign-in logs and Conditional Access. Conditional Access is a premium feature that can evaluate signals such as a user’s network location, device state, group membership, or sign-in risk and require additional safeguards before access is granted. That creates room for stronger administration controls as the application evolves.
For this project, I created a separate app registration for the BPE Blog API using the default settings. I saved the generated application, or client, ID for later configuration. The client ID is not a secret, but I will still provide environment-specific identifiers through configuration rather than embedding them directly in the application.
I plan to add claims or app roles later to restrict access to blog administration features. For now, I am leaving those authorization details undefined while I establish the API’s basic structure.
Creating the ASP.NET Core API
Next, I created a new ASP.NET Core Web API project in Visual Studio.
I used the default project settings and enabled container support. Adding container support at the beginning keeps the local and deployed execution models aligned and reduces the amount of restructuring required later.
The generated project included Microsoft’s OpenAPI package, but the selected version was deprecated and had known vulnerabilities. Before continuing, I updated the package to the latest supported version.
Keeping generated dependencies current is an important first step, even for a small project. Starting with deprecated packages creates unnecessary security and maintenance work before development has really begun.
Establishing the Solution Structure
Rather than keeping the entire application inside the API project, I created separate projects for the major application layers:
bpe-blog.bpe-blog-api
bpe-blog.Application
bpe-blog.Data
bpe-blog.Domain
Each project has a distinct responsibility.
Domain
The domain project contains the core business models and rules. It should not depend on infrastructure, database implementations, or HTTP concerns.
For the blog administration system, this layer will eventually contain concepts such as:
- Blog posts
- Publication status
- Slugs
- Tags
- Publishing rules
Data
The data project contains persistence implementations and integrations with the selected data store.
Draft posts will initially be saved outside the Astro repository. Publishing will be a deliberate action that transforms the stored post into a Markdown file and commits it to the website repository.
Application
The application project coordinates use cases such as:
- Creating a draft
- Editing a post
- Publishing a post
- Unpublishing or deleting a post
- Retrieving posts for the administration interface
This layer will define the operations the API exposes without coupling those operations directly to HTTP endpoints or specific storage implementations.
API
The API project is the application’s entry point. It will handle:
- HTTP requests
- Authentication
- Authorization
- Dependency injection
- Configuration
- Request and response contracts
The API should remain relatively thin, with most business behavior delegated to the application layer.
Adding Project References
After creating the projects, I added the project references needed to connect the solution.
The intended dependency flow is:
API → Application → Data → Domain
The domain layer remains at the center and has no dependency on the other projects.
Although this structure introduces more projects than a minimal CRUD API technically requires, it gives the application clear boundaries before publishing logic, repository integration, and authentication are introduced.
Adding Repository Support
I installed version 2.1.0-beta of Orbital Repositories to provide the application’s repository abstractions and persistence support.
Orbital is a repository library I developed, so I am comfortable using it in my personal projects and understand its design, behavior, and tradeoffs. Although the current package version carries a beta designation, the library is production ready.
As with any third-party dependency, teams should still perform their own evaluation before adopting Orbital in a production application. That evaluation should consider the application’s requirements, the team’s preferred data-access patterns, compatibility with the selected persistence technology, and the long-term maintenance implications of introducing the abstraction.
The intended data store for the Blog Admin API is Azure Cosmos DB. I chose the serverless tier because it provides a low-cost starting point for an application with light and potentially inconsistent traffic, while still allowing the database to scale dynamically as usage increases. Cosmos DB is also my preferred data store for cloud-native applications, particularly when the data model and access patterns fit a document-oriented database.
For this project, the data layer will contain the Cosmos DB implementation while exposing repository interfaces to the application layer. This keeps the application logic from depending directly on the Cosmos SDK or on Cosmos-specific persistence behavior.
The abstraction also leaves room to introduce additional providers if the project’s requirements change.
For most of my career, I considered data-store selection to be a decision that was effectively set in stone once a project began. Database changes were uncommon enough that designing around a possible future migration could easily feel like unnecessary abstraction.
However, I have since worked on several projects that required a data-store migration, replacement, or significant redesign. These migrations are still uncommon, but they happen often enough that the boundary between application logic and persistence deserves careful attention.
A strong interface between the application and its chosen data store does not make a migration effortless. Differences in querying, consistency, transactions, indexing, partitioning, and data modeling still need to be addressed. It can, however, reduce the number of places where persistence-specific behavior leaks into the rest of the application.
By keeping the data-access boundary explicit, the application is better positioned to replace Cosmos DB, add another provider, or gradually migrate between stores if that need arises.
Initializing the Git Repository
With the initial project structure in place, I prepared the solution for source control.
First, I generated a standard .NET .gitignore file:
dotnet new gitignore
This excludes build output, local development settings, IDE metadata, and other files that should not be committed.
I then initialized the Git repository:
git init
git add .
git commit -m "Initial project setup"
Finally, I connected the repository to Azure DevOps and pushed the first commit.
At this point, the project has:
- A Microsoft Entra ID app registration
- An ASP.NET Core Web API with container support
- Separate domain, data, application, and API projects
- Updated OpenAPI dependencies
- Initial repository support
- A standard .NET
.gitignore - Source control hosted in Azure DevOps
What Comes Next
The next phase will focus on defining the blog post domain model and implementing draft storage.
From there, the application will need a publishing workflow capable of:
- Converting a stored post into Astro-compatible Markdown.
- Adding or updating the file in the website repository.
- Committing the change through the Azure DevOps repository API.
- Allowing the existing static-site deployment pipeline to rebuild the website.
This project is intentionally small, but it brings together several important concepts: application architecture, authentication, API development, source-control automation, containerization, and static-site publishing.
It also creates a useful opportunity to document the process of building the system that will be used to publish the documentation itself.