When you choose to self-host, the responsibility for updates, maintenance, and merging future enhancements rests entirely with you.

We highly recommend the Cloud version, unless you have hard requirements to manage your own infrastructure.

Requirements

  • NodeJS 20
  • Postgres
  • Redis
  • GitHub App

Prepare the environment

1

Create a GitHub Application

Firstly, you’ll need to create a GitHub application.

Setup your GitHub app following the instructions below:

2

Host API

Secondly, you’ll need to setup hosting for the API application.

Update the .env file

Make it production-ready.

# App
NODE_ENV=production
APP_ENV=production
PORT=8000
FRONTEND_URL= # Update to the URL of your web app
USE_SSL=true
JWT_SECRET= # Add a random sequence of characters

Set your database credentials.

# Prisma
DB_DATABASE=sweetr
DB_HOST=localhost
DB_USERNAME=sweetr
DB_PASSWORD=sweetr
DATABASE_URL="postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}?sslaccept=strict"

Set your Redis credentials.

# Redis (BullMQ)
REDIS_CONNECTION_STRING="redis://default@127.0.0.1:6379"

Set your GitHub App credentials.

# GitHub App
GITHUB_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_OAUTH_REDIRECT_PATH=/github/callback
GITHUB_APP_ID=
GITHUB_APP_HANDLE=
GITHUB_APP_PRIVATE_KEY=
3

Host Web App

Lastly, you’ll need to host the frontend, the web application.

Update the .env file:

VITE_GRAPHQL_API=https://your-api.com
VITE_AUTH_COOKIE_DOMAIN=you-web-app.com
VITE_GITHUB_APP=your-github-app-slug

API

  • Use npm to install dependencies.
  • Run npm run build to build the application.
  • Run npm run start to start the application.

Database migrations

Our API uses Prisma to communicate with the database.

Run npx prisma migrate deploy to run migrations.

Monitoring

We currently support LogTail and Sentry for monitoring.

Update .env to enable:

# Sentry
SENTRY_DSN=

# LogTail
LOGTAIL_TOKEN=