What directory structure should be used for a web based project? There are no hard, Application Structure fast rules for this. The opinions vary and even my typical website project has changed. This is the latest project directory organization that I am using.

There are three projects: Genealogist, Genealogist.Tests and Genealogist.Web. Genealogist.Web is an Add => New Project => Visual C# => Web => ASP.NET Web Application. Don’t use Add => New Web Site => ASP.NET Web Site. This will not play well with the Global.asax/Global.asax.cs file. The other two are just C# class library projects.

The Genealogist.Web application has a special directory, FrameStack. FrameStack itself has three directories: NHibernate, Spark and Windsor. All three have a class named ConfigurationByConvention. As the name implies each of these classes provide methods for configuring the 3rd party libraries without using .XML files.

The Genealogist project has two directories: DomainModel and Queries. More directories may be added in the future as the project is developed. For now YAGNI indicates that this is the minimum of what is needed.

The DomainModel is based on using DDD principles and the entities, value objects, factories and repositories will be created there. The Queries directory is something I added after reading Udi Dahan’s Employing the Domain Model Pattern in MSDN Magazine. It is a separation of read-only query support from the full CRUD requirements found in the DomainModel.

Web References The 3rd party DLLs I used are from the Castle, NHibernate and Spark View Engine open source projects. I’ll add the Rhino.Commons and Fluent NHibernate when I start developing the Domain Model.

Anyway this is my current web site application structure. It uses Castle Windsor and MonoRail along with the Spark View Engine.