Skip to main content

Dev Setup

This page walks you through setting up a complete local CleverThis development environment. The local stack runs the Next.js webapp, the FastAPI server, and all backing services (PostgreSQL, Redis) via Docker Compose.

Prerequisites

ToolMinimum versionInstall
Node.js20 LTSnodejs.org or nvm
pnpm9npm install -g pnpm
Python3.11python.org or pyenv
nox2024.xpip install nox
Docker + Docker ComposeDocker 24+docker.com

Clone and install

git clone https://github.com/cleverthis/cleverthis.git
cd cleverthis

# Install JS dependencies (webapp + tooling)
pnpm install

# Install Python dev dependencies
pip install nox
nox -s install # installs the Python packages in editable mode with dev extras

Start backing services

docker compose up -d postgres redis

This starts PostgreSQL on port 5432 and Redis on port 6379 with default dev credentials.

Run database migrations

nox -s migrate

Start the development servers

In one terminal, start the FastAPI server:

nox -s dev-api

In another terminal, start the Next.js webapp:

pnpm dev

The webapp is now available at http://localhost:3000. The API server runs on http://localhost:8000.

Environment variables

Copy .env.example to .env.local and fill in the required values:

cp .env.example .env.local

At minimum, set DATABASE_URL, REDIS_URL, NEXTAUTH_SECRET, and at least one LLM provider key (e.g. OPENAI_API_KEY).

Coming soon

A one-command docker compose up setup that starts everything (webapp, API, backing services) together with hot reload is being added.