# Rallly

Rallly is an open source scheduling and group poll tool, an alternative to Doodle

[Rallly](https://github.com/lukevella/rallly) is a Next.js application in a pnpm and Turborepo monorepo, with Prisma on PostgreSQL. Upstream ships a Docker image and an installer script, so the steps here follow `apps/web/Dockerfile` and `scripts/docker-start.sh`. Rallly signs users in with one-time codes sent by email, so an SMTP provider is required.

## Requirements

Create a PostgreSQL database from the Databases tab and keep the variable named `DATABASE_URL`. You also need SMTP credentials from a transactional email provider. S3-compatible storage is optional and only used for uploads such as avatars.

Building the Next.js app comfortably needs 2 GB of RAM or more.

## Repository

Fork the upstream repository, add the script below, and deploy the fork:

```
https://github.com/lukevella/rallly.git
```

Upstream publishes tagged releases (`v4.15.3` at the time of writing) and `main` moves between them, so create a branch in your fork from the latest `vX.Y.Z` tag, commit the script there, and set that branch on the app. Node 24 (`.nvmrc`) and pnpm (`packageManager`) are installed automatically; Hatchbox runs `pnpm install`.

## Environment Variables

```
NEXT_PUBLIC_SELF_HOSTED=true
NEXT_PUBLIC_BASE_URL=https://rallly.example.com
AUTH_URL=https://rallly.example.com
SECRET_PASSWORD=&lt;openssl rand -base64 32&gt;
SUPPORT_EMAIL=you@example.com
INITIAL_ADMIN_EMAIL=you@example.com
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=&lt;username&gt;
SMTP_PWD=&lt;password&gt;
```

`NEXT_PUBLIC_SELF_HOSTED=true` turns off the paywall and billing and must be present at build time, which it is because build scripts receive the app&#39;s environment. `NEXT_PUBLIC_BASE_URL` is also read at build time, so set it before the first deploy and redeploy if it changes. `AUTH_URL` mirrors `NEXT_PUBLIC_BASE_URL`; the Docker start script derives it the same way. `SECRET_PASSWORD` must be at least 32 characters. `DATABASE_URL` comes from the attached database. Add `S3_ENDPOINT`, `S3_BUCKET_NAME`, `S3_REGION`, `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY` for uploads.

Do not set `NODE_ENV=production` in the Environment tab; pnpm would skip the dev dependencies the build needs.

## Build Scripts

### .hatchbox/post-build

This generates the Prisma client, builds the standalone Next.js output, copies the static assets next to it as the Dockerfile does, and runs migrations on the cron server:

```
#!/usr/bin/env bash
set -e

pnpm db:generate
SKIP_ENV_VALIDATION=1 pnpm build

cp -r apps/web/.next/static apps/web/.next/standalone/apps/web/.next/static
cp -r apps/web/public apps/web/.next/standalone/apps/web/public

if [ &quot;$CRON&quot; = &quot;true&quot; ]; then
  pnpm db:deploy
fi
```

## Processes

1. `web`, web servers: `node apps/web/.next/standalone/apps/web/server.js`

The standalone server listens on the `PORT` variable Hatchbox provides.

## First Login

Open your domain and sign in with the email set in `INITIAL_ADMIN_EMAIL`; a 6-digit verification code is sent over SMTP. Then visit `/control-panel` and click &quot;Make me an admin&quot; to claim the admin role.

## Notes

Rallly keeps no files on local disk, so it can run on several web servers behind the same database. Upgrade by merging the next release tag into your branch and deploying; migrations run in the post-build script.
