piranha.core
Piranha CMS is the friendly editor-focused CMS for .NET that can be used both as an integrated CMS or as a headless API.
Top Related Projects
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
Headless CMS and Content Managment Hub
Bitwarden infrastructure/backend (API, database, Docker, etc).
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
Quick Overview
Piranha CMS is an open-source, lightweight content management system built on ASP.NET Core. It provides a flexible and modular architecture for creating and managing web content, with a focus on simplicity and performance.
Pros
- Lightweight and fast, with minimal overhead
- Built on modern ASP.NET Core technology
- Highly customizable and extendable
- Supports multiple content types and page hierarchies
Cons
- Smaller community compared to more established CMS platforms
- Limited out-of-the-box features compared to some larger CMS solutions
- Documentation could be more comprehensive
- Fewer third-party plugins and themes available
Code Examples
- Creating a new page:
var page = await Api.Pages.CreateAsync(new StandardPage
{
Title = "My New Page",
Slug = "my-new-page",
ParentId = parentId
});
- Retrieving a page by slug:
var page = await Api.Pages.GetBySlugAsync<StandardPage>("my-page-slug");
- Updating page content:
page.Title = "Updated Title";
page.Blocks.Add(new HtmlBlock
{
Body = "<p>New content</p>"
});
await Api.Pages.SaveAsync(page);
- Querying pages:
var pages = await Api.Pages
.GetAllAsync<StandardPage>(pageSize: 10)
.OrderBy(p => p.Title)
.ToListAsync();
Getting Started
- Install the Piranha.AspNetCore NuGet package:
dotnet add package Piranha.AspNetCore
- Add Piranha services to your
Startup.cs
:
public void ConfigureServices(IServiceCollection services)
{
services.AddPiranha(options =>
{
options.UseFileStorage();
options.UseImageSharp();
options.UseManager();
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UsePiranha();
app.UsePiranhaManager();
}
- Create a new page type:
[PageType(Title = "Standard page")]
public class StandardPage : Page<StandardPage>
{
[Field(Title = "Main content")]
public HtmlField MainContent { get; set; }
}
- Run your application and navigate to
/manager
to access the Piranha CMS admin interface.
Competitor Comparisons
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
Pros of OrchardCore
- More extensive feature set and modules, offering greater flexibility for complex projects
- Larger and more active community, potentially leading to better support and more frequent updates
- Built-in multi-tenancy support, allowing for easier management of multiple sites
Cons of OrchardCore
- Steeper learning curve due to its complexity and extensive features
- Potentially heavier resource usage, which may impact performance on smaller servers
- More complex setup and configuration process compared to Piranha.Core
Code Comparison
OrchardCore (Startup.cs):
public void ConfigureServices(IServiceCollection services)
{
services.AddOrchardCms();
}
Piranha.Core (Startup.cs):
public void ConfigureServices(IServiceCollection services)
{
services.AddPiranha();
services.AddPiranhaManager();
}
Both CMSs use a similar approach for service configuration, but OrchardCore's setup is more concise. However, Piranha.Core's configuration allows for more granular control over which components are added.
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
Pros of Umbraco-CMS
- Larger community and ecosystem, with more extensions and resources available
- More comprehensive feature set, including built-in media management and user roles
- Better suited for large-scale enterprise projects
Cons of Umbraco-CMS
- Steeper learning curve and more complex setup process
- Heavier resource usage, potentially impacting performance on smaller servers
- Less flexibility for developers who prefer a lightweight, code-first approach
Code Comparison
Umbraco-CMS (C#):
public class HomeController : Umbraco.Web.Mvc.RenderMvcController
{
public ActionResult Index(ContentModel model)
{
return CurrentTemplate(model);
}
}
Piranha.Core (C#):
public class StartPageController : Controller<StartPage>
{
public async Task<IActionResult> Index(StartPage model)
{
return View(model);
}
}
Both CMSs use similar MVC patterns, but Piranha.Core's approach is more lightweight and straightforward, while Umbraco-CMS offers more built-in functionality at the cost of added complexity.
Headless CMS and Content Managment Hub
Pros of Squidex
- Headless CMS architecture, offering more flexibility for developers
- Built-in GraphQL support for efficient querying
- Advanced content modeling with custom fields and schemas
Cons of Squidex
- Steeper learning curve for non-technical users
- Less out-of-the-box templating and theming options
- Requires more setup and configuration for a complete website solution
Code Comparison
Squidex (C# API usage):
var client = new SquidexClient("https://cloud.squidex.io", "my-app");
var content = await client.Contents.GetAsync("my-schema", "my-id");
var title = content.Data["title"].ToString();
Piranha (C# content retrieval):
var api = App.Api;
var page = await api.Pages.GetByIdAsync<StandardPage>(id);
var title = page.Title;
Both projects are open-source .NET-based CMS solutions, but they cater to different use cases. Squidex is a headless CMS focused on content management and API-first approach, while Piranha is a more traditional CMS with built-in templating and rendering capabilities. Squidex offers more flexibility for developers building complex applications, while Piranha provides a simpler setup for standard websites.
Bitwarden infrastructure/backend (API, database, Docker, etc).
Pros of Bitwarden Server
- More active development with frequent updates and contributions
- Broader scope as a full-featured password management solution
- Stronger focus on security features and encryption
Cons of Bitwarden Server
- More complex codebase due to its comprehensive feature set
- Steeper learning curve for developers new to the project
- Requires more resources to run and maintain
Code Comparison
Piranha Core (C#):
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddPiranha();
}
}
Bitwarden Server (C#):
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddBitwarden();
services.AddSingleton<ILicensingService, LicensingService>();
}
}
Both projects use ASP.NET Core, but Bitwarden Server has a more extensive configuration process due to its broader feature set and security requirements. Piranha Core focuses on simplicity for content management, while Bitwarden Server emphasizes secure data handling and user authentication.
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
Pros of nopCommerce
- More comprehensive e-commerce features, including product management, order processing, and payment gateways
- Larger community and ecosystem, with numerous plugins and extensions available
- Built-in multi-store and multi-vendor capabilities
Cons of nopCommerce
- Steeper learning curve due to its complexity and extensive feature set
- Heavier resource requirements, potentially impacting performance on smaller hosting environments
- Less flexibility for non-e-commerce projects compared to Piranha CMS
Code Comparison
nopCommerce (Product Controller):
[HttpPost]
public virtual IActionResult ProductDetails_AttributeChange(int productId, bool validateAttributeConditions, IFormCollection form)
{
var product = _productService.GetProductById(productId);
if (product == null)
return new NullJsonResult();
// ... (additional logic)
}
Piranha CMS (Page Controller):
[HttpGet]
[Route("page")]
public async Task<IActionResult> Page(Guid id, bool draft = false)
{
var model = await _api.Pages.GetByIdAsync<StandardPage>(id, draft);
return View(model);
}
The code snippets highlight the different focus areas of the two projects. nopCommerce's example shows product-related functionality, while Piranha CMS demonstrates a more general-purpose page handling approach.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Welcome to Piranha.Core
Build server | Platform | Build status |
---|---|---|
GitHub Actions | Windows | |
GitHub Actions | Linux | |
CoverAlls | ||
NuGet | ||
Crowdin (Localization) |
About
Piranha CMS is a decoupled, cross-platform CMS built for .NET8
and Entity Framework Core
. It has a modular and extensible architecture and supports a multitude of hosting and deployment scenarios.
Getting started
Prerequisites
- .NET 8.0 SDK
- An IDE or Editor of your choice
Create a new project from our templates
To use our project templates you first need to download and install them from NuGet. This can be done with:
dotnet new -i Piranha.Templates
When creating a new project with dotnet new
you should first create a new empty folder. The default behaviour is that the new project is named after its containing folder.
Please note that naming your project
Piranha
(even if it is a test project) will result in a circular reference error when you try to restore the packages. This is due to a limitation indotnet restore
.
After this is done you can create a new web project for razor pages with:
dotnet new piranha.razor
To read more about of our available project templates, please read more on https://piranhacms.org/docs/basics/project-templates
Get the latest source code and get going
> git clone https://github.com/PiranhaCMS/piranha.core.git
> cd piranha.core
> dotnet restore
> dotnet build
> cd examples/MvcWeb
> dotnet run
Log into the Manager
The manager interface can be found at the URL ~/manager
with the default credentials:
admin / password
For production scenarios we advise you to remove this user, or change the password and update the password strength policy. More information on this can be found in the official documentation here.
Build and update javascript/css assets
> cd piranha.core/core/Piranha.Manager
> npm install
> gulp min:js
> gulp min:css
Backers
Support Piranha CMS with a monthly donation and help us focus on giving you even more features and better support. Piranha CMS @ Open Collective
Sponsors
These are our financial sponsors! You can also become a sponsor either through GitHub or Open Collective.
Code of Conduct
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.
.NET Foundation
This project is supported by the .NET Foundation.
Top Related Projects
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
Headless CMS and Content Managment Hub
Bitwarden infrastructure/backend (API, database, Docker, etc).
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot