init command creates a .env file with your database and server configuration through an interactive prompt.
Usage
Interactive Prompts
The command prompts you for two configuration values:Database URL
PostgreSQL connection string in the format:Press Enter to use the default value for local development.
Port
HTTP server port number. Press Enter to use the default port 8080.
Output Format
The generated.env file contains:
.env
Overwrite Behavior
If a.env file already exists, you’ll be prompted for confirmation:
Examples
Local Development
Use defaults for local PostgreSQL:Production Deployment
Configure for remote database:Custom Port
Use local database on different port:Manual Configuration
You can also create or edit.env manually:
.env
The
.env file is loaded automatically by oforum serve and other commands. You don’t need to export variables manually.Connection String Format
Basic Format
With Authentication
With SSL
Without SSL (Local Development)
SSL Mode Options
Thesslmode parameter controls PostgreSQL SSL behavior:
disable- No SSL (local development only)require- Require SSL but don’t verify certificateverify-ca- Require SSL and verify CA certificateverify-full- Require SSL and verify certificate + hostname
If your connection string doesn’t include
sslmode, oForum automatically appends sslmode=disable for local connections. In production, explicitly set sslmode=require.Next Steps
After creating your.env file:
-
Start the server (migrations run automatically):
-
Seed demo data (optional for development):
-
Access the forum at
http://localhost:8080