Skip to content

Development Setup

This guide covers everything you need to run OpenScouter locally, from installing prerequisites to starting the development server.

Prerequisites

You need Node.js 20 or later. The project uses features available only in Node 20+, so older versions will not work.

The recommended way to manage Node versions is nvm:

Terminal window
nvm install 20
nvm use 20
node --version # should print v20.x.x or later

You also need npm 10+, which ships with Node 20. Verify with npm --version.

Cloning the Repository

Terminal window
git clone https://github.com/your-org/openscouter.git
cd openscouter

If you are contributing as an external collaborator, fork the repository first and clone your fork instead. See Contributing for fork-based workflow details.

Installing Dependencies

Terminal window
npm install

This installs all runtime and development dependencies. Do not use --legacy-peer-deps or --force unless you have raised the issue with the team first.

Environment Variables

Create a .env.local file in the project root. This file is listed in .gitignore and will never be committed.

Copy the example template to get started:

Terminal window
cp .env.example .env.local

Fill in the values for your local setup. The table below describes every variable:

VariableDescriptionRequiredExample
DATABASE_URLPostgreSQL connection stringYespostgresql://user:pass@localhost:5432/openscouter
NEXTAUTH_SECRETSecret for NextAuth.js signingYesA 32-character random string
NEXTAUTH_URLBase URL for OAuth callbacksYeshttp://localhost:3000
OPENAI_API_KEYOpenAI API key for the AI analysis pipelineYessk-...
ANTHROPIC_API_KEYAnthropic API key for the AI analysis pipelineNosk-ant-...
GOOGLE_AI_API_KEYGoogle Gemini API key for the AI analysis pipelineNoAIza...
STRIPE_SECRET_KEYStripe secret key for payout processingYessk_test_...
STRIPE_WEBHOOK_SECRETStripe webhook signing secretYeswhsec_...
TELEGRAM_BOT_TOKENToken for the Telegram bot integrationNo123456:ABC-DEF...
S3_BUCKET_NAMES3-compatible bucket for note attachmentsNoopenscouter-dev
S3_REGIONAWS region for the S3 bucketNoeu-west-1
S3_ACCESS_KEY_IDAWS access key ID for S3NoAKIAIOSFODNN7EXAMPLE
S3_SECRET_ACCESS_KEYAWS secret access key for S3NowJalrXUtnFEMI/K7MDENG/...
LOG_LEVELLogging verbosityNodebug

Variables marked Yes must be set before the dev server will start. Optional variables enable specific features. If they are absent, those features degrade gracefully.

Never commit .env.local or any file containing real credentials.

Starting the Development Server

Terminal window
npm run dev

The application starts at http://localhost:3000. Hot module replacement is enabled, so most changes take effect without a manual reload.

API routes are available under http://localhost:3000/api/.

Building for Production

To verify the production build locally before deploying:

Terminal window
npm run build
npm run start

npm run build compiles TypeScript, bundles assets, and runs build-time validations. Fix any TypeScript or build errors before opening a pull request.

Linting and Formatting

Run these checks locally before pushing:

Terminal window
npm run lint # ESLint
npm run lint:fix # ESLint with auto-fix
npm run format # Prettier
npm run typecheck # TypeScript compiler check (no emit)

The CI pipeline runs all of these on every pull request. Passing them locally first saves time.