diff --git a/app.py b/app.py
index ce8e0192190620b26171817e7c8c5dbeffaea9e9..d95a7e75f68be4ced176c9880b5bccc0a1d4b008 100644
--- a/app.py
+++ b/app.py
@@ -3,6 +3,7 @@ from flask_jwt_extended import JWTManager
 from flask_cors import CORS
 from jsonschema.exceptions import ValidationError
 from werkzeug.exceptions import BadRequest
+from flask_sqlalchemy import SQLAlchemy
 
 # These imports are required
 from areas import api_v1
@@ -13,6 +14,7 @@ from areas import apps
 from areas import auth
 from areas import login
 
+from database import db
 
 from helpers import (
     BadRequest,
@@ -23,14 +25,28 @@ from helpers import (
     kratos_error,
     global_error,
     hydra_error,
-    KratosUser
+    KratosUser,
+    App,
+    AppRole
 )
+
 from config import *
 import logging
 
 app = Flask(__name__)
+
 cors = CORS(app)
+
 app.config["SECRET_KEY"] = SECRET_KEY
+app.config["SQLALCHEMY_DATABASE_URI"] = SQLALCHEMY_DATABASE_URI
+
+## from database import db
+#db = SQLAlchemy()
+db.init_app(app)
+
+# Late beceuse of circular import
+##
+
 
 app.logger.setLevel(logging.INFO)                                            
 
diff --git a/areas/login/login.py b/areas/login/login.py
index 37210d14833df49c597e184b12f72776f6f23d7c..ef6750a247b8477de0abf3e410b8cc43e3e2f748 100644
--- a/areas/login/login.py
+++ b/areas/login/login.py
@@ -41,9 +41,15 @@ from helpers import (
     kratos_error,
     global_error,
     hydra_error,
-    KratosUser
+    KratosUser,
+    App,
+    AppRole
 )
 
+# This is a circular import and should be solved differently
+#from app import db
+from database import db
+
 # APIs
 # Create HYDRA & KRATOS API interfaces
 HYDRA = hydra_client.HydraAdmin(HYDRA_ADMIN_URL)
@@ -240,8 +246,7 @@ def consent():
         abort(401, description="User not found. Please try again.")
 
     # Get role on this app
-    #app_obj = db.session.query(App).filter(App.slug == app_id).first()
-    app_obj = False
+    app_obj = db.session.query(App).filter(App.slug == app_id).first()
 
     # Default access level
     roles = []
@@ -253,6 +258,7 @@ def consent():
         )
         for role_obj in role_objects:
             roles.append(role_obj.role)
+
     current_app.logger.info(f"Using '{roles}' when applying consent for {kratos_id}")
 
     # Get claims for this user, provided the current app
diff --git a/database.py b/database.py
new file mode 100644
index 0000000000000000000000000000000000000000..5c1c832121023d861419a048fcbb38bd0527bd85
--- /dev/null
+++ b/database.py
@@ -0,0 +1,7 @@
+
+
+from flask_sqlalchemy import SQLAlchemy
+db = SQLAlchemy()
+
+
+
diff --git a/helpers/__init__.py b/helpers/__init__.py
index 3b76a3a0d0c7753662ba1e4e7733dd3b7a1d7e2c..37e81cca64cb103bcb39625cfa6034c30b4b2874 100644
--- a/helpers/__init__.py
+++ b/helpers/__init__.py
@@ -2,3 +2,4 @@ from .kratos_api import *
 from .error_handler import *
 from .hydra_oauth import *
 from .kratos import *
+from .models import *
diff --git a/helpers/models.py b/helpers/models.py
new file mode 100644
index 0000000000000000000000000000000000000000..6286f258fd64b53b1a5ffaf2265edcc37c8301dc
--- /dev/null
+++ b/helpers/models.py
@@ -0,0 +1,54 @@
+"""
+Implement different models used by Stackspin panel
+"""
+
+
+from flask import current_app
+from flask_sqlalchemy import SQLAlchemy
+
+# pylint: disable=cyclic-import
+# This is based on the documentation of Flask Alchemy
+#from app import db
+
+# We need this import at some point to hook up roles and users
+# from sqlalchemy.orm import relationship
+from sqlalchemy import ForeignKey, Integer, String
+
+db = SQLAlchemy()
+
+# Pylint complains about too-few-public-methods. Methods will be added once
+# this is implemented.
+# pylint: disable=too-few-public-methods
+class App(db.Model):
+    """
+    The App object, interact with the App database object. Data is stored in
+    the local database.
+    """
+
+
+    id = db.Column(Integer, primary_key=True)
+    name = db.Column(String(length=64))
+    slug = db.Column(String(length=64), unique=True)
+
+    def __repr__(self):
+        return f"{self.id} <{self.name}>"
+
+# Pylint complains about too-few-public-methods. Methods will be added once
+# this is implemented.
+# pylint: disable=too-few-public-methods
+class AppRole(db.Model):
+    """
+    The AppRole object, stores the roles Users have on Apps
+    """
+
+    # pylint: disable=no-member
+    user_id = db.Column(String(length=64), primary_key=True)
+    # pylint: disable=no-member
+    app_id = db.Column(Integer, ForeignKey('app.id'),
+                             primary_key=True)
+
+    # pylint: disable=no-member
+    role = db.Column(String(length=64))
+
+    def __repr__(self):
+        return f"{self.role} for {self.user_id} on {self.app_id}"