Getting Started

Cloud Setup

Setup with cloud services (Neon, Cloudflare R2, Resend)

Cloud Setup

Use cloud services for your database and infrastructure. Best for team collaboration and production-like environments.

Requirements

Services Overview

ServicePurposeFree Tier
NeonPostgreSQL database✅ 0.5 GB
Cloudflare R2File storage (S3-compatible)✅ 10 GB
ResendTransactional email✅ 3,000/month

All services have generous free tiers for development.


1. Clone the Repository

git clone <your-repo-url> straktur
cd straktur
npm install

2. Database (Neon)

  1. Go to neon.tech and sign up
  2. Create a new project (name it "straktur" or similar)
  3. Copy your connection string

It looks like:

postgresql://username:[email protected]/neondb?sslmode=require

Keep ?sslmode=require at the end - it's required for Neon.


3. File Storage (Cloudflare R2)

Create bucket

  1. Go to Cloudflare Dashboard
  2. Navigate to R2 Object Storage
  3. Click Create bucket
  4. Name it straktur-files (or similar)

Configure CORS

Your bucket needs CORS configured so the browser can upload files directly.

  1. Open your bucket settings
  2. Go to CORS policy
  3. Add this configuration:
[
  {
    "AllowedOrigins": ["http://localhost:3000"],
    "AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
    "AllowedHeaders": ["*"],
    "MaxAgeSeconds": 3600
  }
]

For production, add your domain to AllowedOrigins.

Create API token

  1. In R2, go to Manage R2 API Tokens
  2. Click Create API token
  3. Select Object Read & Write permission
  4. Select your bucket
  5. Copy the credentials:
    • Access Key ID
    • Secret Access Key
    • Endpoint URL (looks like https://xxx.r2.cloudflarestorage.com)

4. Email (Resend)

  1. Go to resend.com and sign up
  2. Go to API Keys and create a new key
  3. Copy the API key (starts with re_)

For development, you can use [email protected] as the sender. For production, verify your domain in Resend dashboard.


5. Configure Environment

Copy the example environment file:

cp .env.example .env.local

Open .env.local and fill in your values:

.env.local
# Database (Neon)
DATABASE_URL="postgresql://user:[email protected]/neondb?sslmode=require"

# Auth
BETTER_AUTH_SECRET="generate-with-openssl-rand-base64-32"
NEXT_PUBLIC_APP_URL="http://localhost:3000"

# Seed user (your login credentials)
ALLOW_DB_SEED="true"
SEED_USER_EMAIL="[email protected]"
SEED_USER_PASSWORD="your-password-min-8-chars"
SEED_USER_NAME="Your Name"
SEED_ORG_NAME="My Company"
SEED_ORG_SLUG="my-company"

# File Storage (Cloudflare R2)
STORAGE_PROVIDER="s3"
S3_BUCKET="straktur-files"
S3_REGION="auto"
S3_ENDPOINT="https://xxx.r2.cloudflarestorage.com"
S3_ACCESS_KEY_ID="your-access-key"
S3_SECRET_ACCESS_KEY="your-secret-key"

# Email (Resend)
EMAIL_PROVIDER="resend"
EMAIL_FROM="[email protected]"
RESEND_API_KEY="re_xxx"

Generate BETTER_AUTH_SECRET with:

openssl rand -base64 32

6. Setup Database

Create tables and seed your user:

npm run db:push
npm run db:seed

db:push creates all database tables. db:seed creates your user account and organization based on SEED_USER_* variables.


7. Start the App

npm run dev

Open http://localhost:3000 and log in with the email and password you set in SEED_USER_EMAIL and SEED_USER_PASSWORD.


Demo Data

Want to see the app with sample data? After setup, run:

npm run db:seed:demo

This creates 44 companies with logos, 70+ contacts, and sample activities - all uploaded to your R2 bucket.


Troubleshooting

Neon connection timeout

Make sure your connection string includes ?sslmode=require:

postgresql://[email protected]/neondb?sslmode=require

R2 access denied

Check that your API token has:

  • Object Read & Write permission
  • Access to the correct bucket

Also verify the endpoint URL format - it should NOT include the bucket name:

# Correct
S3_ENDPOINT="https://xxx.r2.cloudflarestorage.com"

# Wrong
S3_ENDPOINT="https://xxx.r2.cloudflarestorage.com/straktur-files"

File uploads not working

Make sure CORS is configured on your R2 bucket (see step 3).

Emails not sending

For development, use the test sender:

EMAIL_FROM="[email protected]"

For production, verify your domain in Resend dashboard.


Alternative Providers

Database

Storage

Email

  • SMTP - Use EMAIL_PROVIDER="smtp" with SMTP_HOST, SMTP_PORT, etc.
  • SendGrid, Postmark - Via SMTP

Next Steps

On this page