Skip to main content

System Requirements

Install Dependencies

1

Install Bun

Verify the installation:
2

Install Redis

Verify Redis is running:
3

Clone and install

This installs all workspace packages and automatically creates a .env file from .env.example with working defaults for local development:
If .env already exists, it will not be overwritten. To start fresh, delete it and run bun install again.

Environment Configuration

Application Settings

These control the runtime mode and URL references used in CORS headers, email links, and OAuth redirects.

JWT Authentication

BunShip uses a dual-token JWT strategy: short-lived access tokens (default 15 minutes) and long-lived refresh tokens (default 7 days). Each token type is signed with its own secret so that compromising one does not compromise the other.
The auto-generated .env includes placeholder secrets that work for local development. Before deploying, replace them with cryptographically random values.

How to generate a JWT secret

Pick whichever tool you have available — the result is the same: a long, random string.
Paste the output into your .env:
Use different values for JWT_SECRET and JWT_REFRESH_SECRET. Both must be at least 32 characters. Never commit real secrets to version control — .env is already in .gitignore.
The placeholder secrets in .env.example work fine for local development. But if you deploy with the default values, anyone who reads the source code can forge authentication tokens for your API. Always generate unique secrets before deploying.

Database Setup

BunShip uses Drizzle ORM with Turso (libSQL/SQLite). For local development you can use a file-based SQLite database with zero external dependencies.

Local Development (File-Based)

The default .env.example is already configured for local file storage:
No additional setup is needed. The database file is created automatically when you run migrations.

Turso Cloud

For staging or production, connect to a Turso cloud database:
1

Install the Turso CLI

2

Authenticate

bash turso auth login
3

Create a database

bash turso db create bunship
4

Get connection credentials

5

Update your .env

Run Migrations and Seed

The seed creates:
  • Demo userdemo@bunship.com / demo123456
  • Demo organization with a Pro plan on trial
  • Sample projects attached to the organization
| Command | Description | |---------|-------------| | bun run db:generate | Generate a new migration after editing the Drizzle schema | | bun run db:push | Push schema directly to the database (development only) | | bun run db:studio | Open Drizzle Studio, a visual database browser | | bun run db:reset | Drop all tables and re-run migrations (destroys all data) |

Stripe Setup

BunShip includes subscription management with free, Pro, and Enterprise tiers. All Stripe integration works in test mode without processing real payments.
1

Create a Stripe account

Sign up at stripe.com. The dashboard starts in test mode by default.
2

Get your API keys

Navigate to Developers > API keys in the Stripe Dashboard and copy your Secret key (starts with sk_test_).
3

Create products and prices

Go to Products in the Stripe Dashboard and create your pricing tiers. You need price IDs for each plan and billing interval:
4

Set up webhooks

Stripe sends events (subscription created, payment failed, etc.) to your API via webhooks.For local development, use the Stripe CLI:
The CLI prints a webhook signing secret (whsec_...). Add it to your .env:
For production, add a webhook endpoint in the Stripe Dashboard (Developers > Webhooks) pointing to https://your-domain.com/webhooks/stripe and subscribe to these events:
  • checkout.session.completed
  • customer.subscription.created
  • customer.subscription.updated
  • customer.subscription.deleted
  • invoice.paid
  • invoice.payment_failed
Stripe billing is optional for initial development. If STRIPE_SECRET_KEY is not set, billing endpoints return a configuration error but the rest of the API works normally.

S3 / R2 Storage Setup

File uploads use any S3-compatible object storage. Choose the tab matching your provider.
Create an S3 bucket in the AWS Console and an IAM user with s3:PutObject, s3:GetObject, and s3:DeleteObject permissions scoped to that bucket.
File storage is optional. If the S3 variables are not set, file upload endpoints return a configuration error but the rest of the API works normally.

Redis Setup

Redis powers two subsystems: BullMQ background job queues and a general-purpose caching layer.
For environments that require authentication:
Redis is required. BunShip will fail to start if it cannot connect to Redis because the BullMQ worker initialization runs at boot.

Email Setup (Optional)

BunShip sends transactional emails (verification, password reset, team invitations) through Resend.
1

Create a Resend account

Sign up at resend.com and copy your API key.
2

Verify your sending domain

In the Resend dashboard, go to Domains, add your domain, and configure the DNS records Resend provides (SPF, DKIM, DMARC).
3

Update .env

Set RESEND_API_KEY and change EMAIL_FROM to use your verified domain.
During development, Resend’s test mode sends to any email address without a verified domain. If RESEND_API_KEY is not set, emails are logged to the console instead of being sent.

OAuth Providers (Optional)

Google OAuth

  1. Go to the Google Cloud Console.
  2. Create a project (or select an existing one).
  3. Enable the Google+ API.
  4. Under Credentials, create an OAuth 2.0 Client ID.
  5. Add the authorized redirect URI: http://localhost:3000/api/v1/auth/google/callback

GitHub OAuth

  1. Go to GitHub Developer Settings.
  2. Create a new OAuth App.
  3. Set the callback URL to: http://localhost:3000/api/v1/auth/github/callback

Verifying the Installation

After completing the setup, start the development server and run through these checks.
1

Health check

Expected response:
2

API documentation

Open http://localhost:3000/docs in your browser. You should see the Scalar-powered OpenAPI documentation listing all available endpoints.
3

Test authentication

If you ran bun run db:seed:
A successful response includes accessToken and refreshToken fields.

Troubleshooting

Clear the workspace and reinstall:
  • File-based database: Ensure TURSO_DATABASE_URL=file:../../local.db is set in your apps/api/.env file.
  • Turso cloud: Verify the auth token is still valid:
Check that Redis is running and reachable:
If you are using Docker, confirm the container is up:
Find and stop the process occupying the port:
Or start BunShip on a different port:
Ensure both secrets are set and at least 32 characters long:
Make sure STRIPE_WEBHOOK_SECRET matches the secret shown by the Stripe CLI or the Stripe Dashboard. For local development, always use the Stripe CLI:
The CLI prints a new signing secret each time it starts. Copy it into your .env.

Complete .env Reference

Below is the full list of environment variables from .env.example: