A friend of mine was recently contemplating using FLUX to build out an e-commerce application for a store. Whilst this is all well and good, and certainly very plausible, I started to think about how e-commerce sites are generally structured – they aren’t so much about open ended content where you add pages and articles together to form a site, they are far more rigid – more like structured catalogues with prescribed functionality.
As I’m also a fan of the MVC framework (I use it lots in my day job) I’ve been looking for an excuse to build something that uses MVC to render content fed from Flux.NET and I figure this is a good enough opportunity to explore this through a series of blog posts.
The site concept
We’ll manage products and categories in one website, which is standard ASP.NET and using the Flux content management system, then render these to our MVC store front application that has a prescribed structure by querying the content database for data in the appropriate places. Whereas we might normally use flux to dictate the form and structure, in this instance we’re going to use it purely as a management tool for data in our application.
I began by downloading the flux starter package and creating a new empty solution. I added an ASP.NET website to the solution and then extracted the starter kit to it, trimming it right down to almost nothing (see image below) and reconfiguring /settings/flux.config to use a new database I created – FluxMVCTest. I ran the flux database script against this db to create my tables etc and then cleared down all the content through the admin tool.
With this running and responding on the development web server, I was reasonably happy to proceed and get the MVC site up in the solution too. I added this using the usual new project wizard and then stripped it back to it’s bare essentials also, which at this point gives me two sites in my solution as below;
Follow along source on codeplex
As usual, I’ve started a new project in codeplex for this, so hop along to http://fluxmvcstore.codeplex.com to get the source code so far.