A Simple Sitecore + Bootstrap + MVC + Solr Example Project

I recently had the need to develop an example project in Sitecore with the following requirements:

Build a mini CRM in Sitecore using MVC with the following features:
    a. A page where a user can add contact details – Name, email, phone and address
    b. A listing page with search capabilities (search by email, first name)
    c. Ability to edit and delete users
    d. A decent user interface

Soooooo, I put this project together in a hurry and demonstrated it to my client. And now that I have no need for it anymore, why not share it on the blog, right? Cut me a little slack on this one - I did the whole thing in about 4 hours, so i can't vouch for coolness or completeness.

I developed this on Sitecore 8.2 Update 2, but it should work on any Sitecore version 7.5 or later. The requirements called for search capability, so I chose to go with Solr. You could just as easily use Lucene or Azure Search or even something more sophisticated like Coveo for Sitecore if you were so inclined. I am storing the user records as bucketed items in Sitecore. The requirement for "a decent user interface" is accomplished with Bootstrap and MVC Razor views.


  1. You will need to install Sitecore
  2. You will need to install Solr
  3. You will need Visual Studio 2017 or later


  1. Download the full Mini CRM solution here: MiniCrm.zip (362.64 kb).
  2. Unzip the solution somewhere, and open it in Visual Studio.

  3. Restore all the Nuget packages.
  4. Add references to your Sitecore assemblies:
    - Sitecore.ContentSearch.dll
    - Sitecore.ContentSearch.Linq.dll
    - Sitecore.Kernel.dll
    - Sitecore.Mvc.dll
  5. Take a look at this config file: /app_config/include/MiniCrmIndex.config. As you can see, you need to create a new Solr core named "mini_crm_index_master". Here are some tips on how to do it.
  6. Create a publish profile in Visual Studio that points to your Sitecore instance.
  7. Publish the solution. This will publish the following assets to your website (Most of these files are the ones that come with a standard Visual Studio web application):

  8. Now it's time for some Sitecore work. Log in to your Sitecore as an Admin, and install this package 

    MiniCrm Sitecore Items-1.0.zip (41.30 kb). This will install the following items:

    • /sitecore/templates/User (this is the User template)
    • /sitecore/layout/Renderings/User List Rendering (this is a Controller Rendering for the user list method)
    • /sitecore/layout/Renderings/User Edit Rendering (this is a Controller Rendering for the user edit method)
    • /sitecore/layout/Renderings/User List Rendering (this is a Controller Rendering for the user delete method)
    • /sitecore/content/Users (this is the bucket folder to store User items)

  9. Next, we'll set up the presentation items. Add three new items to your content tree: "UserList", "UserEdit" and "UserDelete".
  10. Configure the presentation details for each item (here's an example for the UserList item):

  11. At this point you're ready to run your new application! Here are some screen shots:

So there you have it! I hope this example is helpful to someone out there in Sitecore land. If I had more time to work on this I certainly would have included things like unit tests, better error handling for edge cases, more functionality on the form, like sorting, etc. But this gives you the basic idea of how to do MVC in Sitecore.



Comments (4) -

  • After publishing I am getting the below error. Not able to login to Sitecore.

    Could not resolve type name: Sitecore.Support.ContentSearch.SitecoreItemCrawler, Sitecore.Support.130860.153722 (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).

    What can be the issue?
    • That error would indicate that you have a Sitecore hotfix config file, but you're missing the DLL. You could either remove the config file for the hotfix, or reinstall the hotfix. The latter option is probably best because the hotfix is there for a reason, I would assume.
      • It seems the template is missing in the project. Kindly check the xml and attach the updated package.
  • The attached sitecore package is throwing an error while installing
    The installation failed.
    One or more exceptions occurred while processing the subscribers to the 'packageinstall:items:ended' event.
    For more information see the Sitecore log.
    Try one of the following options:
    Retry the installation

    It seems the layout and renderings installed succesfully, but there is a problem with the item "user" which is under home.
    Please help.

Add comment