2

I'm about to start a white-label server-side application but I don't want to jump in and start coding. This is something I've not had to do before, at least not from scratch and I'm the one in control this time!

I've worked on many application, good and bad but in most I've always noticed the lack of thought that went behind the application from an architectural point of view which comes back and bites us in the end. This isn't a reflection on anyone, most of the time we are bound by the business making the calls. Anyway...

I've decided to go with Railo, Coldbox and AngularJs using mysql. But this is not the point of discussion it's more of an FYI.

What i'm seeking help on is how to go about designing a site so that i'm able to hold core and custom code (I will refer to this as client code). Yes, I have researched this unfortunately there isn't much talk about how to approach this.

What do I mean by this? I want the basic shell of a site where one set of code files can be use by more than one client, for example, modules that will do registration, company details, login, language setting etc. However, with every client there is always requests for customisations so i want the ability to override the core code with use of the client code.

I have good knowledge of Coldbox basics (i.e one codebase one site) but not enough to achieve my goal.

This is the basic structure of a Coldbox App and this is how i would see the client directory structure.

+ApplicationRoot
|---+ config
|---+ framework
|---+ handlers
|---+ plugins
|---+ layouts
|---+ views
|---+ includes
|---+ interceptors
|---+ model
|---+ modules
|---+ Application.cfc
|---+ index.cfm

If the above is the basic structure of one client's application how will it extend to the core code? Bearing in mind i thinking the core code will hold the modules' dao, service, gateway, bean. Where will these live and will the core code have a similar structure in some other folder?

+ApplicationRoot
|---+ Core code
|-----+ framework
|-----+ plugins
|-----+ interceptors
|-----+ views
|-----+ model
|-----+ modules

---+ Client one
|-----+ as per above client directory structure

---+ Client two
|-----+ as per above client directory structure

Thank you for your time in reading this and I hope you can guide me in the right direction.

david-l
  • 623
  • 1
  • 9
  • 20
  • This seems crazy broad, but I hope some of the architects here weigh in on good architecture. – Prescott Jul 24 '14 at 00:42
  • You're basically asking for free consultancy here, which is not really in-scope for StackOverflow. Bear in mind that this is a Q&A site, so you need to ask a question which has an answer, rather than soliciting discussion. You'd be better off asking this on a discussion forum. As it's Railo-centric, the Railo oogle group would be a reasonable place. That said, it's so nebulous, I wonder what you're expecting by way of feedback? I'd also consider not reinventing the wheel, instead looking around if there's something out there that already does all this. Perhaps PresideCMS? – Adam Cameron Jul 24 '14 at 05:56
  • No, I’m not asking for freebies or a long drawn out discussion about best practice, as I said 'I hope you can guide me in the right direction.' I believe the question is clear, I've given my thought on what I want to achieve and how I envisage it to be, and based my question around that thought. I don't want to reinvent anything hence why I’m here. In way of feedback what would be more constructive is to indicate if/or not what I’m envisaging is totally incorrect, maybe point me to something that may help achieve this task or just point me to some open source code (PresideCMS thanks). – david-l Jul 24 '14 at 12:58

1 Answers1

2

What you need is a folder for common ColdBox objects, those that will be shared between clients. You can configure these locations in ColdBox.cfc.

coldbox = {
    // .. settings above

    //Extension Points
    UDFLibraryFile              = "includes/helpers/ApplicationHelper.cfm",
    coldboxExtensionsLocation   = "",
    modulesExternalLocation     = ["/common/modules/"],
    pluginsExternalLocation     = "",
    viewsExternalLocation       = "",
    layoutsExternalLocation     = "",
    handlersExternalLocation    = "",
    requestContextDecorator     = "",

    // .. more settings below
};

Your web root might look like this:

- clientA
    - skeleton
- clientB
    - skeleton
- clientN
    - skeleton
- common
    - extensions
    - handlers
    - layouts
    - modules
    - plugins
    - requestContextDecorator
    - views

You can override layouts and views with standard ColdBox conventions as well, but won't that be in your AngularJS code?

As for overriding handler actions, it's possible. My company has a custom process for this, but we've not open sourced it yet.

Hope this helps.

Adrian J. Moreno
  • 14,350
  • 1
  • 37
  • 44
  • re.AngularJs, from my understanding binding, filtering, directive will obviously be in the views which i can override from what you are suggesting. Module, controller and services will be in my includes/javascript folders which i intend to call form the common folder or override within the clientX/include folder. I've not thought about it in great detail, but as you've now mentioned it, I think i'll need to research this sooner rather than later. *I am very grateful for your positive and invaluable feedback* – david-l Jul 25 '14 at 00:29