serve command starts the oForum web server. This is the default command—running oforum without arguments is equivalent to oforum serve.
Usage
Startup Sequence
When you start the server, oForum performs the following operations:- Load environment - Reads
.envfile if present - Validate configuration - Checks for required
DATABASE_URL - Run migrations - Automatically applies pending database migrations
- Connect to database - Establishes PostgreSQL connection
- Start web server - Begins listening for HTTP requests
Migrations run automatically on startup. You don’t need to run
oforum migrate separately unless you want to apply migrations without starting the server.Environment Variables
PostgreSQL connection string.If
DATABASE_URL is not set, the server will exit with an error message:Port number for the HTTP server.
Examples
Start with Default Port (8080)
Start on Custom Port
Start with Inline Database URL
Production Deployment
Create a systemd service file:/etc/systemd/system/oforum.service
Stopping the Server
Graceful Shutdown
PressCtrl+C to send SIGINT. The server will:
- Stop accepting new connections
- Close the database connection
- Exit cleanly
Force Quit
PressCtrl+C twice or send SIGKILL:
Server Features
The server starts with:- Gzip compression - Automatic response compression
- HTML minification - Reduced page sizes
- Session management - Cookie-based authentication
- Ban checking - Automatic banned user filtering
- Template rendering - Go templates with custom functions
- Static routes - Homepage, posts, user profiles, admin panel
- SEO routes -
robots.txt,sitemap.xml,llms.txt
Troubleshooting
Port Already in Use
Error:Database Connection Failed
Error:DATABASE_URL is correct: