Overview
What you’ll learn
Set up a complete n8n development environment using Railway for quick deployment, Docker for local development, and configure CLI tools and databases for building custom nodes.
Quick Start with Railway
Fastest deployment path
Production-ready n8n instance in 2 minutes with PostgreSQL, Redis, workers, automatic SSL, and built-in monitoring included.
Deploy n8n on Railway
One-click deploy with automatic SSL, managed databases, and scaling
- Automatic HTTPS/SSL
- PostgreSQL database
- Redis for queue management
- Worker processes for scaling
- Built-in monitoring and logs
Local Development Setup
Development options
Docker (recommended), Docker Compose, npm/yarn, or source code - each offering different levels of control and complexity.
- Docker (Recommended)
- Docker Compose
- npm/yarn
- Source Code
n8n CLI Setup
Command line tools
Essential commands for starting n8n, creating custom nodes, and managing workflows. Install globally with npm for development access.
Database Configuration
Database options
PostgreSQL recommended for production, MySQL also supported. Both set up easily with Docker and configured via environment variables.
PostgreSQL Setup (Recommended for Production)
MySQL Setup
Environment Variables
Configuration settings
Control n8n’s behavior - database connections, security, execution modes, logging, and custom extensions. Use .env file for development configuration.
Testing Your Setup
Verification steps
Check the health endpoint, create test workflows, and enable development features like tunnels and verbose logging to confirm everything works.
1. Verify n8n is Running
2. Create Test Workflow
3. Enable Development Mode Features
Troubleshooting
Common issues
Port conflicts, database connection failures, and custom node loading problems - each with specific solutions and troubleshooting steps.
Port 5678 already in use
Port 5678 already in use
Database connection failed
Database connection failed
Custom nodes not loading
Custom nodes not loading
Next Steps
Ready to build
With your environment configured, move on to building custom nodes or learning advanced workflow patterns.
Build Your First Node
Create a custom n8n node from scratch
Workflow Development
Learn workflow design patterns
Additional Resources
Frequently Asked Questions
Should I use Railway or local development for learning?
For learning, start with Railway to get familiar with n8n quickly, then move to local development when you’re ready to build custom nodes. Local development gives you more control and faster iteration cycles.What’s the difference between SQLite and PostgreSQL for development?
SQLite is simpler for local development but doesn’t support all production features. PostgreSQL matches production environments and supports advanced features like queue management with Redis.How do I switch between different n8n versions?
With Docker, change the image tag (e.g.,n8nio/n8n:0.200.0
). With npm, use npm install n8n@version
. Always backup your data before switching versions.
Can I use n8n with other databases like MongoDB?
n8n officially supports PostgreSQL, MySQL, and SQLite. MongoDB isn’t supported as the primary database, but you can connect to MongoDB through workflow nodes.How do I enable debug mode for troubleshooting?
SetN8N_LOG_LEVEL=debug
and NODE_ENV=development
. This provides verbose logging for troubleshooting issues with workflows, nodes, and connections.
What ports does n8n use besides 5678?
n8n uses port 5678 for the web interface. If using Redis, it typically uses 6379. PostgreSQL uses 5432, MySQL uses 3306. Ensure these ports are available or configure alternatives.How do I backup my development environment?
Export workflows via CLI (n8n export:workflow --all
), backup your database, and version control your custom nodes. For complete backups, include the .n8n
directory contents.
Can I run multiple n8n instances for different projects?
Yes, use different ports and data directories. SetN8N_PORT
, N8N_USER_FOLDER
, and separate database configurations for each instance to avoid conflicts.
What happens if I don’t set up a database?
n8n defaults to SQLite stored in the user folder. This works for development but isn’t recommended for production due to performance and concurrency limitations.How do I update n8n in my development environment?
For Docker, pull the latest image. For npm installations, runnpm update n8n
. For Railway, redeploy with the latest template. Always backup before updating.