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
| Tool | Version | Check | Install |
|---|---|---|---|
| Node.js | 20+ | node -v | nodejs.org |
| PostgreSQL | 15+ | psql --version | See below |
Installing PostgreSQL
macOS (Homebrew):
brew install postgresql@15
brew services start postgresql@15
createdb strakturUbuntu/Debian:
sudo apt install postgresql-15
sudo systemctl start postgresql
sudo -u postgres createdb strakturWindows: Download from postgresql.org and run the installer.
Setup Steps
1. Clone and install
git clone <repo-url> my-app
cd my-app
npm install2. Configure environment
cp .env.example .env.localOpen .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 323. Setup database
npm run db:push # Create tables
npm run db:seed # Create user + organization4. Start the app
npm run dev| Password | |
|---|---|
[email protected] | password123 |
Seed Options
Basic seed (default)
Creates minimum data to get started:
npm run db:seedThis 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:demoThis 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 postgresqlDatabase "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 32Copy 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 postgresqlAdding Storage and Email (Optional)
For file uploads and email functionality, see:
- Cloud Setup - Configure Cloudflare R2 and Resend
- Environment Variables - All config options
Next Steps
- Project Structure - Understand the codebase
- Add Your First Feature - Build something