This is a local installation of n8n, a workflow automation tool.
- Node.js (v20.17.0 or higher recommended)
- npm
The installation has been completed. All dependencies are installed in the node_modules directory.
To start n8n, you can use one of the following methods:
npm startnpx n8n./node_modules/.bin/n8nOnce n8n is running, it will start a web interface. By default, you can access it at:
- URL: http://localhost:5678
- Open your browser and navigate to this address
On the first run, n8n will:
- Create a user account (you'll be prompted to set up credentials)
- Store data in
~/.n8nby default
n8n configuration can be customized through environment variables. Common settings include:
N8N_PORT- Change the port (default: 5678)N8N_HOST- Change the host (default: localhost)N8N_PROTOCOL- Set protocol (http or https)
Example:
N8N_PORT=3000 npm startBy default, n8n stores its data in ~/.n8n. To change this location, set the N8N_USER_FOLDER environment variable:
N8N_USER_FOLDER=/path/to/your/data npm startThis project is configured for easy deployment to Railway via GitHub.
- A Railway account (railway.app)
- GitHub account with this repository
- Railway CLI (optional):
npm i -g @railway/cli
-
Push to GitHub:
git add . git commit -m "Initial commit - n8n setup for Railway" git branch -M main git remote add origin <your-github-repo-url> git push -u origin main
-
Connect Railway to GitHub:
- Go to Railway.app and sign in
- Click "New Project"
- Select "Deploy from GitHub repo"
- Choose your n8n repository
-
Configure Environment Variables: In Railway dashboard, go to your service → Variables tab, and add:
Required:
N8N_ENCRYPTION_KEY- Generate with:openssl rand -base64 32N8N_HOST- Will be auto-set by Railway (format:your-app.up.railway.app)N8N_PROTOCOL- Set tohttpsPORT- Railway sets this automatically (usually 443 or dynamic)
Optional (Recommended for Production):
N8N_ENVIRONMENT=productionN8N_USER_MANAGEMENT_JWT_SECRET- Generate with:openssl rand -base64 32
-
Add PostgreSQL (Recommended):
- In Railway dashboard, click "+ New" → "Database" → "Add PostgreSQL"
- Railway will automatically set
DATABASE_URLenvironment variable - n8n will automatically use PostgreSQL if
DATABASE_URLis set
-
Deploy:
- Railway will automatically detect the Node.js app
- It will run
npm installandnpm start - Once deployed, Railway will provide a public URL
-
Access Your n8n Instance:
- Use the Railway-provided URL to access your n8n instance
- Complete the initial setup to create your admin account
# Install Railway CLI
npm i -g @railway/cli
# Login to Railway
railway login
# Initialize Railway project
railway init
# Link to existing project or create new one
railway link
# Set environment variables
railway variables set N8N_ENCRYPTION_KEY=$(openssl rand -base64 32)
railway variables set N8N_PROTOCOL=https
railway variables set N8N_ENVIRONMENT=production
# Deploy
railway upThis project includes:
railway.json- Railway configurationnixpacks.toml- Build configurationProcfile- Process definitionenv.example- Example environment variables
-
Port Configuration:
- Railway automatically sets the
PORTenvironment variable - n8n will use this port automatically
- You don't need to set
N8N_PORTmanually
- Railway automatically sets the
-
Database:
- For production, use Railway's PostgreSQL plugin
- n8n automatically detects and uses
DATABASE_URLif available - SQLite (default) works but is not recommended for production
-
Encryption Key:
- CRITICAL: Set a strong
N8N_ENCRYPTION_KEYbefore first deployment - This key encrypts sensitive data in your workflows
- Generate with:
openssl rand -base64 32 - Save this key securely - you'll need it for future deployments
- CRITICAL: Set a strong
-
Webhooks:
- Railway provides HTTPS URLs automatically
- Your webhook URLs will be:
https://your-app.up.railway.app/webhook/...
-
Persistent Storage:
- For production, use PostgreSQL for persistent data
- Ephemeral file storage is lost on redeploy without PostgreSQL
- Build fails: Ensure Node.js version is compatible (v20+)
- App won't start: Check Railway logs for environment variable errors
- Database connection issues: Verify
DATABASE_URLis set correctly in Railway - Webhook URLs not working: Ensure
N8N_HOSTandN8N_PROTOCOLare set correctly
- Documentation: https://docs.n8n.io
- Community: https://community.n8n.io
- GitHub: https://github.com/n8n-io/n8n
- Railway Docs: https://docs.railway.app