Organizing Large Flask + AngularJS appliction

I have previous experience with a moderately complex Flask + AngularJS application. But now I'm starting on a new more complex app and need help in how I need to setup both the Python and AngularJS application. Here are some info about the app.

  • The back-end is Python (Flask) app using Pandas to manipulate data
  • The Python will have an api for the front-end and also a public api
  • The front-end will be AngularJS SPA with mostly Google Charts
  • The app will have a both a free and paid version
  • The paid version will show more charts than the free version
  • There will also be some static pages for info, pricing, signup, login
  • Prefer to use a single Postgres DB for both free and paid

My thoughts are to divide each of the backend and front-end into separate modules. I was looking into using Blueprint in Flask to separate the free and paid apps. On the front-end I would prefer to have charts as modular directives that can be copied from free to paid or vice versa.

I'm not clear on how best to setup the folder structure of the Python app and the where the AngularJS files will reside. I also would prefer the free and paid app to be modular so that developers can work on each separately without effecting the other.


  • Is a Microservice Architecture a better approach?
  • Should the free and paid app be one code base or completely separate
  • Is Blueprint the best approach with Flask or should the Python apps be completely separate?
  • What is a good domain strategy to use for free/paid? (e.g. should paid be a subdomain like and free or similar)

Any guidance and help is appreciated.


I'd start by doing something like this:

  • Create a Github repo named mysite-www. This repo will hold your HTMl / CSS / Angular code only and be deloyed as a static site to something like Amazon S3 / Cloudfront. This means your front-end will be very fast and not dependent on any backend code.
  • Create a Github repo named mysite-api. This repo will hold your Flask code and be deployed to a dynamic server infrastructure like Heroku / EC2 / Elastic Beanstalk.

Now you have that stuff setup, let's talk about your Flask API project.

  • You should have one codebase for both the free and paid version of your product. It doesn't make sense to separate these into separate projects as you'll be using 99% of the same code.
  • You should have some flags set on your user account, which tells you (and subsequently, your Angular front-end), if the user is a paid or free user, and then limits functionality based on those user settings.
  • You should always use blueprints with Flask if you have any moderately complex API. Blueprints let you have nice nested folders of Python code, that all control separate parts of your API / website.

Now, in general:

  • Have a single domain for your free / paid product. When a user signs up, let them choose a plan.
  • Don't change product URLs based on if the user is free or paid, both users should be directed to when logged in.

Depending on how you want to authenticate your users between your front-end and API, you likely want to use the OAuth2 protocol. I work for a company that makes this sorta thing easy, re:, but there are lots of other great options too: Flask-Security, Flask-Login, etc.

Good luck!

Need Your Help

Failed to execute 'send' on 'xmlhttprequest' failed to load

javascript jquery ajax

Hello guys I'm getting the error mentioned in the headline when i try to a run my app created in DevExtreme.

Using C++ bindings with GObject Introspection

c++ linux gnome gobject gobject-introspection

I decided I want to use the Goffice library in my project. But I write it in C++, so I prefer to have a C++ class interface, just like I use gtkmm and not GTK+ directly.