Angular Driven Web Forum for Drupal 7?




I’m mostly a front-end web dev, but does anyone know how to build a web forum using Angular that I could implement into a Drupal 7 website? Any tuts (free/paid) are greatly appreciated?


A web forum is a rather complex software.
Drupal comes with its own forum module, why not use that one?

What are your specific needs for a forum and how do you imagine it?

Even though Drupal supports you with its core architecture of users and roles and session handling, so you can integrate new modules, you need to understand your own requirements.

If you just want to build a forum in Angular just for the sake of it, here is what you need to know for a bare minimum forum before you even set one foot into front-end territory:

  • How are you storing posts and threads? Can you transform the existing page type to be used as a post? Does Drupal give you a per-page permission handling so you could potentially set groups and users and only allow certain groups to post to forum groups? What kind of data do you need to attach? Is that already handled by Drupal? E.g.: Who created the post, who started the thread, when was the post created. etc…
  • How are you retrieving posts and threads? Is there an API you can ask to retrieve the threads and posts in their raw format? e.g. JSON? This way you could let Angular completely handle the data-fetching and hydrating of your page with data. Or do you need to find another way and server-side-render the posts and then pass the HTML to Angular somehow? Maybe you can let Angular only handle the dynamic nature of the posts and combine it with PJAX (push-state ajax - so you load the pages HTML and then load that dynamically) or you need to parse the HTML. Depending on how sophisticated your backend framework of choice is, you can workaround the limitations or maybe build your own API. You will need an API for users, threads, posts, groups, etc. Depending on your level of complexity, you might also want to send private messages etc.
  • How do you submit new posts? Now that you have a content infrastructure and you can read posts to dynamically render them, you need to figure out how to create new threads and posts via Angular. This means, your client needs to communicate with the server (submit from a textarea) to where Drupal receives and stores pages at the correct location. Again: A Rest API that does that for you in the background, without page reloads required, would be the ideal, but you can’t have everything. So find out what possibilities there are and pursuit them. Otherwise - build your own architecture if nothing is in place. Depending on the base CMS or system you use, this can be more tedious than starting from scratch in the first place.

Front-end relevant questions:

  • How does the routing work? If you create a single page app, you will use hashes as routing (
    Maybe you need also to make it available via server-side-rendered SEO-friendly urls. This is something that Drupal can help you with, or make it harder for you. AFAIK every page has its own URL, so you can retrieve the data and then render dynamically. This is your own strategy to choose, but there are many ways to do that, based on the requirements and existing mechanisms in place.
  • Which components do you need? What do you want to display? Threads? Users? Posts? Build CRUD (create/read/update/delete) components for the individual resources (users, private messages, threads, posts, etc). Combined with a permission system, you will also need to be able to restrict access. Maybe Drupal supports OAUTH - a user/role based authentication system to allow to access different API routes. Maybe you have to build it.

Answered all these questions? Good. We just scratched the surface :slight_smile:
Now you are somewhat prepared to build a Forum tightly integrated into the data structures of Drupal.