How do you add admin interface to your project?

Hi everyone,

I’m currently working on a public-facing web app. Built a client side with re-frame and a server side with a standard set of libraries (i.e., ring, compojure, and component). Use session-based authentication with buddy-auth and role-based authorization with ring handlers checking (-> request :identity :roles). (For the sake of completeness, the db is Datomic Cloud and the deployment method will be Elastic Beanstalk.)

Now I’m trying to add admin interface to this project and feeling a little lost for direction. Yet to see how it’s done in clojure and wondering how other people go about it. What are best practices? What kind of security hole should I watch out for when I want to use the same domain and project directory for convenience? Is there a useful library for CMS? (I’ve just found https://github.com/fmw/vix. Anything else?)

I’m thinking about having

  1. a public gateway at www.mydomain.com/admin/
  2. authorization given to users whose roles contain a :role/admin
  3. admin interface built with re-frame just like public facing UIs
  4. code for admin interface in the same project directory,

and the best I can come up with is to place the code for admin interface in a src/admin directory (my other source paths are src/clj, src/cljc, and src/cljs) and use a cljsbuild profile like below

{:id "admin"
 :source-paths ["src/admin"]
 :compiler {:main "admin.client"
            :output-to "resources/admin/js/app.js"
            :output-dir "resources/admin/js/out"
            :asset-path "js/out"}}.

Is this it? Any other solutions? How do you do?

I’d appreciate any advice and suggestions.

If your server expose a Rest like API and your admin is mostly CRUD like, have a look at react-admin. It generates a full admin in a browser based on configuration and a Rest server. It’s from former colleagues and well maintained. Since it’s react based I’m sure you could integrate it with Reagent.

Hope this helps.

Thanks! I’ll definitely look into it.

I guess I should’ve mentioned what I want to do with the interface. Here is my tentative list:

  1. manage content that will be stored in S3 buckets
  2. manage users (assign access roles to registered users)
  3. send email notifications via AWS SES
  4. monitor user access and behaviors.

I lack experience and am not entirely sure but I guess I can set up REST APIs with CRUD like operations for most of these tasks.

I found it a little puzzling that there aren’t many clojure/script libraries in this area, but if that means that building admin interface is just like building public facing UIs, it’s actually not as intimidating as I initially thought.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.