Skip to content

MD Chat

  • MD Chat relies on Logto as the authentication backend, which is a powerful open-source identity and access management solution.
  • You may choose to self-host Logto or use their cloud service.
  • Once you have Logto set up, create a Traditional Web app with the following settings:

    • Name: A name for your app, e.g. “MD Chat”
    • Redirect URI: http://(your-app-url)/callback
  • Keep the Client ID and Client Secret handy, as you will need them to configure MD Chat.

To start, you will need the following:

  • A Logto instance and app credentials as described above.
  • A Postgres database
  • A Redis instance
  • An S3-compatible object storage (e.g. AWS S3, Tigris, Cloudflare R2, etc.) for storing uploaded files.

The Docker image is available on GitHub, and can be pulled with the following command:

Terminal window
docker pull ghcr.io/mikndotdev/chat:latest

Setup the environment variables in your Docker container. A sample .env file might look like this:

Terminal window
DATABASE_URL="postgres://postgres:password@1.2.3.4:5402/postgres"
REDIS_URL="redis://:username@5.6.7.8:5409/0"
LOGTO_APP_ID="your-logto-app-id"
LOGTO_APP_SECRET="your-logto-app-secret"
LOGTO_ENDPOINT="https://(your-logto-instance).logto.io"
LOGTO_COOKIE_SECRET="a-random-secret-string"
S3_ENDPOINT="https://s3.example.com"
S3_ACCESS_KEY_ID="your-s3-access-key-id"
S3_SECRET_ACCESS_KEY="your-s3-secret-access-key"
S3_BUCKET_NAME="your-s3-bucket-name"
S3_REGION="your-s3-region"
S3_UPLOAD_DIR="any-directory-you-want"
S3_PUBLIC_URL="https://s3.example.com/your-s3-bucket-name/"

You can then run the container with the following command:

Terminal window
docker run -d \
--name md-chat \
-p 3000:80 \
--env-file .env \
ghcr.io/mikndotdev/chat:latest
  • This will start the MD Chat server on port 3000, and you can access it at http://localhost:3000.
  • Make sure to adjust the port and other settings as needed for your deployment environment.
  • An example Docker Compose file is available in the repository, which has all the necessary services configured except for Logto and S3.
  • You can use this file to quickly set up a local development environment with MD Chat, and the databases.