Environment Setup
What is SourceQuote?
SourceQuote is a self-hosted audio transcription, editing, and review platform. It supports waveform-synchronized editing, multi-speaker labeling, collaborative sharing, and public embeds. The same codebase supports three distinct deployment targets:
- Local mode — A single-user desktop application packaged as a Windows/macOS executable. No authentication, no server, offline-capable. Uses SQLite for storage.
- Server mode — A self-hosted web server (Flask + PostgreSQL + Caddy). Supports multiple users, Firebase authentication, and optional Stripe payments.
- Cloud mode — A fully managed deployment on Google Cloud Run, backed by Cloud SQL, Google Cloud Storage, and Secret Manager. Auto-scales, requires no infrastructure management.
This guide covers everything needed to get a working development environment from a fresh clone, regardless of which deployment target you intend to use.
Prerequisites
Install the following tools before proceeding.
Required for all modes
| Tool | Minimum version | Notes |
|---|---|---|
| Git | Any recent | For cloning and version control |
| Python | 3.10+ | Use python --version to verify |
| Node.js | 18+ | Includes npm. Use node --version to verify |
| ffmpeg | Any recent | Must be on PATH. Used for audio transcoding |
Windows (winget):
winget install Git.Git
winget install Python.Python.3.12
winget install OpenJS.NodeJS.LTS
winget install Gyan.FFmpeg
After installing, restart your terminal so
PATHchanges take effect. Verify withgit --version,python --version,node --version, andffmpeg -version.
macOS:
brew install git python@3.12 node ffmpeg
Linux:
sudo apt install git python3.12 nodejs npm ffmpeg
Required for server and cloud modes
| Tool | Notes |
|---|---|
| PostgreSQL 13+ | Database for server and cloud modes; local mode uses SQLite |
| Caddy | Reverse proxy and automatic HTTPS (server mode only) |
Windows (winget):
winget install PostgreSQL.PostgreSQL
macOS:
brew install postgresql@15
Linux:
sudo apt install postgresql-15
The default Windows install path
C:\Program Files\PostgreSQL\<version>\is assumed bydatabase\build.bat. After installing, ensurepsqlis on yourPATH.
Installing Caddy:
Windows (winget):
winget install CaddyServer.Caddy
macOS:
brew install caddy
Linux:
sudo apt install caddy
Required for local desktop installer builds (Windows only)
These are only needed to run npm run installer. The npm run build step (PyInstaller) does not need them.
| Tool | Notes |
|---|---|
| 7-Zip | Used to create the tarball bundled inside the installer |
| Inno Setup 6 | Compiles the Windows .exe installer |
winget install 7zip.7zip
winget install JRSoftware.InnoSetup
Required for GPU desktop builds
| Tool | Notes |
|---|---|
| CUDA Toolkit 12.4 | Required to build and run the GPU variant (npm run build:gpu) |
Download from developer.nvidia.com/cuda-12-4-0-download-archive. An NVIDIA GPU with a compatible driver must also be present.
Required for cloud mode only
| Tool | Notes |
|---|---|
Google Cloud CLI (gcloud) | For GCP provisioning and deployment |
| Docker | For building the Cloud Run image |
Windows (winget):
winget install Google.CloudSDK
winget install Docker.DockerDesktop
macOS:
brew install --cask google-cloud-sdk docker
Linux:
# gcloud — see https://cloud.google.com/sdk/docs/install for distro-specific steps
# Docker
sudo apt install docker.io
After installing gcloud, run
gcloud auth loginandgcloud config set project YOUR_PROJECT_IDbefore using any cloud deploy commands.
1. Clone the Repository
git clone https://gitlab.com/vtleavs/sourcequote.git
cd sourcequote
2. Python Virtual Environment
Create and activate a virtual environment to isolate dependencies.
python -m venv .venv
Activate (Windows PowerShell):
.venv\Scripts\Activate.ps1
Activate (Windows CMD):
.venv\Scripts\activate.bat
Activate (macOS/Linux):
source .venv/bin/activate
Verify activation — the prompt should show (.venv).
3. Install Python Dependencies
There are three requirements files depending on your target:
| File | Use case |
|---|---|
requirements-cpu.txt | Local desktop builds and server mode (CPU-only transcription) |
requirements-gpu.txt | Local desktop builds with NVIDIA GPU (CUDA 12.4) |
requirements-gcp.txt | Cloud Run deployment |
For local and server development (most developers):
pip install -r requirements-cpu.txt
For GPU-accelerated local transcription (requires NVIDIA GPU + CUDA 12.4):
pip install -r requirements-gpu.txt
For cloud mode development:
pip install -r requirements-gcp.txt
4. Install Node.js Dependencies
npm install
This installs the JavaScript toolchain used for linting, testing, docs generation, and desktop builds.
5. Set Up Configuration Files
Configuration is split by deployment mode. Each mode has a .env file (non-secret settings) and a .secrets file (credentials and API keys — never committed to version control).
Copy the example files for the mode(s) you intend to use:
Local mode:
cp config/local/.env.local.example config/local/.env.local
cp config/local/.secrets.local.example config/local/.secrets.local
Server mode:
cp config/server/.env.server.example config/server/.env.server
cp config/server/.secrets.server.example config/server/.secrets.server
Cloud mode:
cp config/cloud/.env.cloud.example config/cloud/.env.cloud
cp config/cloud/.secrets.cloud.example config/cloud/.secrets.cloud
The .secrets.* files are listed in .gitignore and must never be committed.
6. Generate a Flask Secret Key
Required for server and cloud modes. Skip for local mode (a placeholder is already in the example file).
python -c "import secrets; print(secrets.token_hex(32))"
Copy the output into the SECRET_KEY field of your .secrets.server or .secrets.cloud file.
7. Set Up Firebase (Server and Cloud Modes Only)
Firebase provides authentication. Local mode does not use it.
7a. Create a Firebase Project
- Go to the Firebase Console
- Click Add project and follow the prompts
- Enable Authentication → Sign-in method → choose your providers (Email/Password and/or Google)
7b. Get the Web API Key and Auth Domain
- In the Firebase Console, go to Project Settings → General
- Under Your apps, click Add app → Web if you haven't already
- Copy the values for:
apiKey→FIREBASE_API_KEYauthDomain→FIREBASE_AUTH_DOMAINprojectId→FIREBASE_PROJECT_ID
Paste these into your .env.server or .env.cloud file.
7c. Download the Service Account Key
This is the backend credential that verifies Firebase JWT tokens.
- Firebase Console → Project Settings → Service Accounts
- Click Generate new private key
- Save the downloaded JSON file somewhere safe (e.g.,
config/server/firebase-service-account.json) - Set
FIREBASE_SERVICE_ACCOUNTin your.secrets.serveror.secrets.cloudto the path of that file
8. Set Up PostgreSQL (Server and Cloud Modes Only)
8a. Create the database
createdb transcriber
Or using psql:
CREATE DATABASE transcriber;
8b. Build the schema
Windows:
database\build.bat -h localhost -p 5432 -U postgres
macOS/Linux:
./database/build.sh -h localhost -p 5432 -U postgres
This runs base_schema.sql and all migration files in order. It is safe to re-run on a fresh database.
8c. Set the connection string
In your .secrets.server or .secrets.local file, set:
DATABASE_URL=postgresql://postgres:yourpassword@localhost:5432/transcriber
9. External API Keys
The following keys are optional depending on the features you need.
HuggingFace Token (for local transcription)
Required to download Whisper and Pyannote models the first time transcription is used.
- Create an account at huggingface.co
- Go to Settings → Access Tokens and create a token with Read access
- Accept the licence agreements for:
- Set
HF_TOKENin your.secrets.*file
Modal.com Token (for cloud-based transcription)
Required if you want transcription routed through Modal.com instead of running locally.
- Create an account at modal.com
- Go to Settings → API tokens and create a new token
- Set
MODAL_TOKEN_IDin your.env.*file (not secret) - Set
MODAL_TOKEN_SECRETin your.secrets.*file
Stripe Keys (for subscription payments — optional)
- Create an account at stripe.com
- Go to Developers → API keys
- Use test keys (
sk_test_...,pk_test_...) during development - Set
STRIPE_SECRET_KEYandSTRIPE_PUBLISHABLE_KEYin your.secrets.*file - For webhook verification (required for subscription events):
- Install the Stripe CLI
- Run
stripe listen --forward-to localhost:5000/api/stripe/webhook - Copy the
whsec_...secret it prints intoSTRIPE_WEBHOOK_SECRET
GitLab Token (for bug reporting — optional)
Used to automatically create GitLab issues from in-app bug reports.
- In GitLab, go to User Settings → Access Tokens
- Create a token with the
apiscope - Set
GITLAB_TOKENin your.secrets.*file - Set
GITLAB_PROJECT_IDin your.env.*file
SMTP Credentials (for email notifications — optional)
Used to send admin notifications (new user registrations, error alerts).
- Set
SMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_FROM,SMTP_FROM_NAMEin your.env.*file - Set
SMTP_PASSin your.secrets.*file - For Gmail: generate an App Password at Google Account → Security → 2-Step Verification → App passwords and use that as
SMTP_PASS
10. Verify the Setup
Run the test suite to confirm everything is working:
npm test
Or run backend and frontend tests individually:
npm run test:backend
npm run test:frontend
Summary of Config Files
| File | Mode | Contains |
|---|---|---|
config/local/.env.local | Local | App settings (no auth) |
config/local/.secrets.local | Local | SECRET_KEY, DATABASE_URL, HF_TOKEN |
config/server/.env.server | Server | App settings, Firebase config, SMTP, Stripe mode |
config/server/.secrets.server | Server | SECRET_KEY, DATABASE_URL, Firebase SA, SMTP pass, Stripe keys |
config/cloud/.env.cloud | Cloud | GCP project, Firebase config, domain, SMTP settings |
config/cloud/.secrets.cloud | Cloud | Firebase SA, SMTP pass, Stripe keys, Modal token, HF token |
Never commit any .secrets.* file.