Do i need a webserver with datomic cloud for a typical web application?

Given a solo topology setup, is it recommended to also run a web server? As i understand it the Ion > AWS lambda would be handling everything i would need a server for:

  • opening network socket,
  • listening for requests
  • calling the handler

Though, now that I’m typing this, I’m not sure it would be isolating requests in their own thread.

Assuming they do overlap, which I’m still obviously thinking through, what would be the recommendation for local development then? Understandable, that’s mostly up to me, but i’m curious what others have done. My current idea would be to run the web server locally.

I’m developing a Clojurescript app at the moment with just Datomic Cloud Ions, API Gateway and Cognito for auth. Early days yet but I don’t see where I will need a server. The app assets (HTML, CSS, JS etc) are served by CloudFront+S3. There were a few tricks to get API Gateway hooked up so let me know if you get stuck.

Hey friends, have a look at this pedestal sample for inspiration.

It was written before dev-local but should work fine with that too.

Also, when you outgrow lambdas, it should also work with http-direct.

Thanks James if you have anything written up on your setup (cloudfront+s3) i would love to take a look. I’m using Rum and so the initial load of the html/JS might need to be handled in the lambda. Though i suppose I can cache any static load page in s3.

Thanks Jplane, i’ll take a look. I can use all the examples I can get.

No, you do not need a webserver with datomic cloud. You may use AWS API Gateway and I believe that is the recommended way to do things. It’s what I did when following the documentation. Ions Tutorial | Datomic

Also, the pedestal sample referenced earlier uses Pedestal Ions, which has a nice 1-2-3-4 steps laid out on the GitHub page at GitHub - pedestal/pedestal.ions: A Pedestal Interceptor Chain provider for Datomic Ions. I found this useful and modeled it directly in my code.

Last, I did setup a dev server - this took me a while to figure out how to do - using dev-local’s divert-system and pedestal’s builtin webserver io.pedestal.http/start. However, I found that this wasn’t necessary for most of my local development. I could just call my functions directly from the repl. With dev-local, the datomic queries can be tested like this and many http requests can be tested since they are plain old data going to pure functions! It gave me a little mind blowing moment. I suggest trying how much you can develop and test without starting up a dev server. I’m coming from worlds like RoR, Flask, and other places where this would be impossible, so my mind went straight to “setup a dev web server”. Only after struggling with this for a while did I realize… “I don’t need a dev web server to test what I’m wanting to test. Perhaps that’s why this doesn’t exist right out of the box.”

Of course, there is still value in seeing what the final app looks like with everything together.