Getting Started

Local Setup

Manual setup with local PostgreSQL

Local Setup

Full control over your development environment. Run Node.js and PostgreSQL directly on your machine.

Prerequisites

ToolVersionCheckInstall
Node.js20+node -vnodejs.org
PostgreSQL15+psql --versionSee below

Installing PostgreSQL

macOS (Homebrew):

brew install postgresql@15
brew services start postgresql@15
createdb straktur

Ubuntu/Debian:

sudo apt install postgresql-15
sudo systemctl start postgresql
sudo -u postgres createdb straktur

Windows: Download from postgresql.org and run the installer.


Setup Steps

1. Clone and install

git clone <repo-url> my-app
cd my-app
npm install

2. Configure environment

cp .env.example .env.local

Open .env.local and set these values:

# Database
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/straktur"

# Auth secret - generate with: openssl rand -base64 32
BETTER_AUTH_SECRET="your-generated-secret-here"

# App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"

# Enable seeding
ALLOW_DB_SEED="true"

Generate the auth secret:

openssl rand -base64 32

3. Setup database

npm run db:push    # Create tables
npm run db:seed    # Create user + organization

4. Start the app

npm run dev

Open http://localhost:3000

EmailPassword
[email protected]password123

Seed Options

Basic seed (default)

Creates minimum data to get started:

npm run db:seed

This creates:

  • 1 user (configurable via SEED_USER_* env vars)
  • 1 organization
  • Dictionary values (statuses, industries, regions)

Demo seed (optional)

Creates a fully populated demo environment:

npm run db:seed:demo

This adds:

  • 44 companies with logos
  • 70+ contacts
  • Activities and files

Note: Demo seed requires S3 storage configured for company logos. Without it, companies are created but logos are skipped.


Customizing Seed Data

You can customize the seed user and organization via environment variables:

# .env.local
SEED_USER_EMAIL="[email protected]"
SEED_USER_PASSWORD="mysecurepassword"
SEED_USER_NAME="My Name"
SEED_ORG_NAME="My Company"
SEED_ORG_SLUG="my-company"

Troubleshooting

Connection refused on db:push

PostgreSQL isn't running. Start it:

# macOS
brew services start postgresql@15

# Linux
sudo systemctl start postgresql
Database "straktur" does not exist

Create the database:

# macOS/Linux
createdb straktur

# Or via psql
psql -c "CREATE DATABASE straktur"
BETTER_AUTH_SECRET must be at least 32 characters

Generate a proper secret:

openssl rand -base64 32

Copy the output to your .env.local.

ALLOW_DB_SEED is not set

Add to your .env.local:

ALLOW_DB_SEED="true"
Permission denied on PostgreSQL

On Linux, you may need to configure PostgreSQL authentication:

# Edit pg_hba.conf (location varies)
sudo nano /etc/postgresql/15/main/pg_hba.conf

# Change "peer" to "md5" for local connections
# Then restart PostgreSQL
sudo systemctl restart postgresql

Adding Storage and Email (Optional)

For file uploads and email functionality, see:


Next Steps

On this page