Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.production.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Deployment secrets
# Copy to .env.production and fill in values

# Path to SQLite database file
DB_PATH=/data/db.sqlite3

# Your site URL (auto-filled from app name, change if using custom domain)
ORIGIN=https://editable-test.fly.dev

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Thumbs.db
.env.*
!.env.example
!.env.test
!.env.production.example


# Data
Expand Down
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,74 @@ npm run dev

This is v2, a complete rewrite using [Svedit](https://github.com/michael/svedit). It's under active development — feel free to explore locally, but hold off on production deployments for now.

## Deploying to Fly.io

### Prerequisites

1. Install the Fly CLI: https://fly.io/docs/flyctl/install/
2. Sign up or log in: `fly auth login`

### First-time setup

Run the init command to create your deployment configuration:

```sh
npm run deploy:init
```

This will ask for your app name and region, then create:
- `fly.toml` — Fly.io configuration
- `Dockerfile` — Container build instructions
- `.env.production.example` — Template for your secrets

Copy the example and add your values:

```sh
cp .env.production.example .env.production
```

Edit `.env.production` with your actual values (this file is gitignored).

### Deploy

Build and deploy your site:

```sh
npm run build
npm run deploy
```

Your site will be live at `https://your-app-name.fly.dev`

### Updating secrets

When you add new secrets to `deploy/config.js`:

1. Add the value to `.env.production`
2. Run `npm run deploy:secrets`

### Custom domain

```sh
fly certs add yourdomain.com
```

Then configure DNS to point to your Fly.io app:

| Type | Name | Value |
|-------|------|--------------------------|
| CNAME | www | your-app-name.fly.dev |

For the root domain (@), use one of these options:
- **ALIAS/ANAME** (if your DNS supports it): Point to `your-app-name.fly.dev`
- **A/AAAA records**: Run `fly ips list` and create A (IPv4) and AAAA (IPv6) records

## Deploying to other platforms

This repo is configured for Fly.io deployment by default (using `@sveltejs/adapter-node`).

**For Vercel or Cloudflare Pages:** You'll need to switch the adapter in `svelte.config.js`.

## Looking for v1?

Find it [here](https://github.com/michael/editable-website/tree/v1).
31 changes: 31 additions & 0 deletions deploy/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Deployment configuration
*
* This file defines the secrets schema for your application.
* Values go in .env.production (which is gitignored).
*
* Add new secrets here as your app grows, then run:
* npm run deploy:secrets
*/

export default {
secrets: {
DB_PATH: {
required: true,
default: '/data/db.sqlite3',
validate: (v) => v.endsWith('.sqlite3') || v.endsWith('.db'),
hint: 'Path to SQLite database file',
},
ORIGIN: {
required: true,
validate: (v) => v.startsWith('https://') && !v.endsWith('/'),
hint: 'Your site URL (auto-filled from app name, change if using custom domain)',
},
// Add more secrets as needed:
// AUTH_SECRET: {
// required: true,
// validate: (v) => v.length >= 32,
// hint: 'Random string for session encryption (min 32 chars)',
// },
},
};
Loading