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
- Node.js 20 or later
- npm or pnpm
Services Overview
| Service | Purpose | Free Tier |
|---|---|---|
| Neon | PostgreSQL database | ✅ 0.5 GB |
| Cloudflare R2 | File storage (S3-compatible) | ✅ 10 GB |
| Resend | Transactional 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 install2. Database (Neon)
- Go to neon.tech and sign up
- Create a new project (name it "straktur" or similar)
- Copy your connection string
It looks like:
postgresql://username:[email protected]/neondb?sslmode=requireKeep ?sslmode=require at the end - it's required for Neon.
3. File Storage (Cloudflare R2)
Create bucket
- Go to Cloudflare Dashboard
- Navigate to R2 Object Storage
- Click Create bucket
- Name it
straktur-files(or similar)
Configure CORS
Your bucket needs CORS configured so the browser can upload files directly.
- Open your bucket settings
- Go to CORS policy
- 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
- In R2, go to Manage R2 API Tokens
- Click Create API token
- Select Object Read & Write permission
- Select your bucket
- Copy the credentials:
- Access Key ID
- Secret Access Key
- Endpoint URL (looks like
https://xxx.r2.cloudflarestorage.com)
4. Email (Resend)
- Go to resend.com and sign up
- Go to API Keys and create a new key
- 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.localOpen .env.local and fill in your values:
# 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 326. Setup Database
Create tables and seed your user:
npm run db:push
npm run db:seeddb:push creates all database tables. db:seed creates your user account and organization based on SEED_USER_* variables.
7. Start the App
npm run devOpen 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:demoThis 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=requireR2 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
- AWS S3 - Original S3
- Supabase Storage - Use
STORAGE_PROVIDER="supabase"
Next Steps
- Project Structure - Understand the codebase
- Environment Variables - All config options
- Add Your First Feature - Build something