Using discourse purely for Q&A functionality without UI or Authentication

AI-generated summary

Using Discourse as a Backend for a Custom UI

x473 is looking to use Discourse as a backend for a custom UI, utilizing the API to retrieve topics associated with a certain discussion. The users will be assumed to be already signed-in prior to accessing a topic.

To set up Discourse for this purpose, pfaffman suggests setting it up normally and obtaining an API key for the frontend. Users would be created in Discourse, and authentication could be handled through Discourse Connect or a global API key.

Regarding email functionality, pfaffman notes that email addresses are required in the user model, but bogus email addresses can be used and email functionality can be disabled. A dummy email server is not necessary, and bogus credentials can be provided instead.

When it comes to testing the setup locally, x473 encountered issues with accessing the app via IP address. RGJ suggests using a hostname, such as localhost, while pfaffman recommends using a valid hostname accessible via the internet for easier setup.

We like discourse’s functionality, but we would like to use purely the backend and associated API’s to run an internal forum. For this purpose, we have a custom UI that aims to utilize Discourse API to retrieve topics associated with a certain discusssion. Furthermore, we would assume that user’s are already signed-in prior to being able to access a topic. For this purpose, how do I go about setting up Discourse ?

You’d set it up normally.

I guess you’d then get an API key to give your front end, maybe.

So you’d create those users in Discourse and maybe use Discourse Connect to log people in from your front end. Or maybe you’d have your code do authentication and use a global API key to retrieve the data from Discourse.

Is it possible to remove the emailing functionality? I don’t need that either for our use case

Email addresses are required in the user model. You can give them all bogus email addresses and disable email.

So it sounds like i will still need to setup a dummy email server? Except that its only provided to get discourse setup?

You can provide bogus credentials.

Awesome! Thanks so much for answering my questions so far! I was looking at the cloud installation instructions here: discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub. I attempted to follow these instructions to setup the production build locally to test out simple interactions. However, the instructions mention that I can’t use IP address to access the app. What should I use instead if i intend to run the app locally?

A hostname? Maybe localhost if you mean locally-locally?

It will be easiest to use a valid hostname that is accessible via the internet. If you don’t want to do that then you’re mostly on your own, as the standard install instructions won’t appy to you.