Deploy wikijs-template
Deploy Wiki.js knowledge base on Railway with PostgreSQL support
Postgres-kRjT
Just deployed
/var/lib/postgresql/data
wikijs-app
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host Wiki.js on Railway
Wiki.js is a modern, lightweight, and highly powerful wiki and knowledge base platform with robust markdown support. One-click deploy on Railway with optional PostgreSQL companion database.
About Hosting
Wiki.js (requarks/wiki) provides a full-featured wiki experience with:
- Beautiful, responsive UI with real-time editing
- Markdown, WYSIWYG, and drag-and-drop editors
- Role-based access control
- Multi-language support
- REST API for integrations
- Support for PostgreSQL, MySQL, MariaDB, SQL Server, and SQLite
- Docker-based deployment on any platform
Deploying on Railway means you get automatic HTTPS, zero-config storage, and continuous updates.
Why Deploy Wiki.js
Wiki.js is one of the most popular open-source wiki solutions because it offers:
- Zero cost — completely free and open source (AGPL-3.0)
- Modern editor — Markdown, WYSIWYG, or code editor modes
- Powerful search — full-text search across all pages
- Version control — track changes, roll back, diff history
- Themes and templates — customize the look and feel
- OAuth2/LDAP/SSO — integrate with your identity provider
Common Use Cases
- Team Documentation — centralize wikis for engineering, product, marketing teams
- Project Knowledge Base — track decisions, architecture, API docs, runbooks
- Personal Notes and Planning — structured knowledge management for individuals
- Open Source Project Docs — public-facing documentation portals with versioning
Deploy
Click the button above to deploy Wiki.js on Railway. You will be prompted to:
- Create a new project in your Railway workspace or select an existing one
- Wait for the automatic build and deployment (usually 1-3 minutes)
- Add a PostgreSQL companion database service from the Integrations tab
- Once deployed, access Wiki.js at your Railway-provided URL (e.g.,
https://wikijs-template-production.up.railway.app) - Complete the setup wizard to create your admin account and configure settings
First-Time Setup
After deployment:
- Browse to your Railway-provided URL
- Create your first admin account via the setup wizard
- Configure your wiki — set site name, logo, language, and theme in Settings > General
- (Optional) Set up authentication — Wiki.js supports OAuth2, LDAP, SAML 2.0, OpenID Connect
Postgres Setup
If using PostgreSQL:
- Add a Redis cache service for session storage from the Integrations tab
- Set the
REDIS_HOSTvariable to your Redis service host from the Variables tab - Wiki.js will use the database credentials (DB_USER, DB_PASS) configured on wikijs-app
Configuration
Copy .env.example to configure database credentials:
- DB_TYPE: Database engine type — default
postgres - DB_HOST: PostgreSQL/MySQL host — required when using postgres
- DB_PORT: Database port — default 5432
- DB_NAME: Database name — default
wikijs - DB_USER: Database user — default
wikijs - DB_PASS: Database password — auto-generated on first deploy, must be set for non-postgres
- PORT: Service port (Railway sets automatically) — default 3000
- WIKI_PORT: Wiki.js application port — default 3000
- URL_BASE: Public URL (required after deploy for asset serving)
Environment Variables
The template includes the following configurable variables. Edit them in your Railway project's Variables tab to customize behavior.
| Variable | Type | Default | Description |
|---|---|---|---|
| DB_TYPE | Required | postgres | Database engine type (postgres, mysql, sqlite) |
| DB_HOST | Optional | db-postgres | PostgreSQL or MySQL host address |
| DB_PORT | Optional | 5432 | Database port number |
| DB_NAME | Optional | wikijs | Name of the database to connect to |
| DB_USER | Optional | wikijs | Username for database authentication |
| DB_PASS | Required | (auto-set) | Secret: password for database connections, use ${{ generate(32) }} template function in production |
| WIKI_PORT | Required | 3000 | Application listen port (must match PORT variable) |
Important: Set
URL_BASEto your application's public URL after deployment so all static assets and links resolve correctly.
Template Functions for Secrets
When setting DB_PASS in production, use Railway's secret generator:
DB_PASS = ${{ generate(32) }}
This generates a cryptographically secure random 32-character string that remains hidden in UI logs and the API.
Troubleshooting
"Connection refused" on database: Ensure you've connected a postgres service from the Integrations tab and the DB_HOST points to it. Verify the connection via railway exec -s wikijs-app 'psql $DATABASE_URL'.
Pages returning 404 or blank: Set your URL_BASE variable in the Railway Variables tab to match your deployed URL (including protocol), e.g., https://your-app.up.railway.app.
White screen after setup: Clear browser cache or try incognito mode; verify the database schema was updated on first boot by checking build logs for "Database Connection Successful".
Dependencies for wikijs-template
This template depends on the following services being configured in your Railway project:
- wikijs-app: The main Wiki.js application container (auto-configured from this repository)
- PostgreSQL database: Optional but recommended; add via
railway add postgres --service wikijs-appand connect from the Integrations tab - Redis (optional): For session storage in multi-process deployments; add via
railway add redis --service wikijs-app
Deployment Dependencies
| Service | Purpose | Required? | How to Add |
|---|---|---|---|
| postgresql | Persistent metadata and content storage | Recommended for production | Railway Marketplace > Postgres > Connect |
| Redis | Session cache (multi-process mode) | Optional, recommended | Railway Marketplace > Redis > Connect |
License
This template is released under the MIT license. Wiki.js itself (the application being deployed) uses the AGPL-3.0 license.
Template Content
Postgres-kRjT
ghcr.io/railwayapp-templates/postgres-ssl:18PGDATA
PGPORT
POSTGRES_DB
POSTGRES_USER
SSL_CERT_DAYS
RAILWAY_DEPLOYMENT_DRAINING_SECONDS
wikijs-app
INAPP-Mobile/wikijs-templatePORT
DB_HOST
DB_NAME
DB_PASS
DB_PORT
DB_TYPE
DB_USER
URL_BASE
PGDATA
PGPORT
DB_HOST
POSTGRES_DB
POSTGRES_USER
SSL_CERT_DAYS
RAILWAY_DEPLOYMENT_DRAINING_SECONDS