A powerful, modern PostgreSQL database management and visualization tool built with React and NestJS. Manage multiple database connections, explore schemas, execute queries, visualize relationships, and export data—all from a beautiful, intuitive interface.
🖥️ NEW: Desktop App Available! You can now run DB Manager as a standalone desktop application for Windows, macOS, and Linux. See the Desktop App section below.
- Features
- Desktop Application
- Tech Stack
- Prerequisites
- Quick Start
- Project Structure
- Configuration
- Documentation
- Development
- Production Deployment
- Security
- Troubleshooting
- Contributing
- Multiple Database Connections: Manage unlimited PostgreSQL database connections
- Secure Password Storage: Encrypted credentials using AES-256-CBC
- Connection Testing: Test connections before saving
- Connection Pooling: Efficient connection management with automatic pooling
- Schema Browser: Navigate through databases, schemas, and tables
- Table Viewer: Browse table data with advanced features:
- Pagination (configurable page size)
- Column filtering and sorting
- Full-text search across columns
- Column selection and visibility
- Database Statistics: View database size, table counts, and more
- SQL Query Editor: Execute custom SQL queries with syntax highlighting
- Query History: Automatic tracking of executed queries
- Saved Queries: Save frequently used queries with tags and descriptions
- Query Snippets: Reusable SQL code snippets
- Query Execution Plans: Analyze query performance with EXPLAIN
- Query Timeout: Configurable timeout limits
- ER Diagrams: Interactive entity-relationship diagrams
- Foreign Key Navigation: Explore relationships between tables
- Schema Visualization: Visual representation of database structure
- Charts: Create visualizations from query results
- Multiple Formats: Export to CSV or JSON
- Filtered Exports: Export filtered or selected data
- Schema Dumps: Export database schema definitions
- Index Recommendations: Get suggestions for database optimization
- Full-Text Search: Search across database metadata
- Dark Mode: Beautiful dark/light theme support
- Responsive Design: Works seamlessly on desktop and tablet
DB Manager is also available as a standalone desktop application! No web server setup needed - just install and run.
- ✅ Single executable - No
npm run devneeded - ✅ Cross-platform - Windows, macOS, Linux
- ✅ Offline-ready - Works without internet
- ✅ Native experience - Desktop file dialogs, notifications
- ✅ Portable - All data stored locally
- ✅ Same features - Identical to the web version
# 1. Navigate to desktop folder
cd desktop
# 2. Install dependencies
npm install
# 3. Build the desktop app
npm run build
# 4. Find installer in desktop/dist/
# - Windows: DB Manager Setup 1.0.0.exe
# - macOS: DB Manager-1.0.0.dmg
# - Linux: DB-Manager-1.0.0.AppImageFull documentation: See desktop/README.md and desktop/QUICK_START.md
- Framework: NestJS 10+
- Language: TypeScript 5+
- Database Driver: PostgreSQL (pg 8+)
- Validation: class-validator, class-transformer
- Encryption: AES-256-CBC for secure password storage
- Framework: React 18+ with TypeScript
- Build Tool: Vite 5+
- UI Components: Radix UI + shadcn/ui
- Styling: Tailwind CSS
- State Management: React Query (TanStack Query)
- Routing: React Router v6
- Visualization: ReactFlow, Recharts
- SQL Parsing: node-sql-parser
Before you begin, ensure you have:
- Node.js 18+ and npm (or yarn/pnpm)
- PostgreSQL database (for testing/development)
- Git (for cloning the repository)
- OpenSSL (for generating encryption keys)
git clone <repository-url>
cd db-managercd backend
# Install dependencies
npm install
# Create .env file
cp env.template .env
# Generate encryption key (required)
openssl rand -base64 32
# Add the generated key to .env:
# ENCRYPTION_KEY=your-generated-key-here
# Start development server
npm run start:devThe backend will run on http://localhost:3000
Verify Backend:
curl http://localhost:3000/api/health
# Should return: {"status":"ok"}# In a new terminal
cd frontend
# Install dependencies
npm install
# Start development server
npm run devThe frontend will run on http://localhost:5173 or http://localhost:8080
Verify Frontend:
Open http://localhost:5173 in your browser
db-manager/
├── backend/ # NestJS backend API
│ ├── src/
│ │ ├── connections/ # Connection management
│ │ ├── schemas/ # Schema metadata
│ │ ├── data/ # Table data operations
│ │ ├── queries/ # Query execution
│ │ ├── query-history/ # Query history & saved queries
│ │ ├── diagram/ # ER diagram generation
│ │ ├── export/ # Data export functionality
│ │ ├── foreign-keys/ # Foreign key navigation
│ │ ├── charts/ # Chart generation
│ │ ├── search/ # Database search
│ │ └── common/ # Shared utilities
│ ├── database/ # File storage (connections, history)
│ └── _docs/ # Backend documentation
│
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── lib/ # Utilities and API client
│ │ ├── contexts/ # React contexts
│ │ └── hooks/ # Custom hooks
│ └── public/ # Static assets
│
├── _docs/ # Project documentation
│ ├── SETUP_GUIDE.md # Detailed setup instructions
│ ├── API_SERVICE_DOCUMENTATION.md
│ └── FRONTEND_INTEGRATION_README.md
│
└── _scripts/ # Utility scripts
├── start-dev.sh # Start both services
└── start-prod.sh # Production start script
File: backend/.env
# Database Encryption Key (REQUIRED)
# Generate with: openssl rand -base64 32
ENCRYPTION_KEY=your-secure-encryption-key-here
# Server Port (optional, default: 3000)
PORT=3000
# Node Environment
NODE_ENV=development
# Frontend URL (optional, for CORS)
FRONTEND_URL=http://localhost:5173Important: The ENCRYPTION_KEY is required for encrypting database passwords. Generate a secure key:
openssl rand -base64 32File: frontend/.env (optional)
# API Base URL (optional, default: http://localhost:3000/api)
VITE_API_URL=http://localhost:3000/apiComprehensive documentation is available in the _docs/ directory:
- SETUP_GUIDE.md - Complete setup and installation guide
- API_SERVICE_DOCUMENTATION.md - Frontend API service reference
- FRONTEND_INTEGRATION_README.md - Frontend-backend integration guide
- STATE_MANAGEMENT_DOCUMENTATION.md - State management patterns
- backend/_docs/API_DOCUMENTATION.md - REST API reference
- backend/_docs/ARCHITECTURE.md - System architecture and design
- backend/_docs/DEPLOYMENT.md - Deployment guide
cd backend
# Start with hot reload
npm run start:dev
# Build for production
npm run build
# Start production server
npm run start:prod
# Run linting
npm run lint
# Run tests
npm testcd frontend
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run linting
npm run lintUse the provided scripts:
# Development mode
./_scripts/start-dev.sh
# Production mode
./_scripts/start-prod.shcd backend
# Build the application
npm run build
# Start production server
npm run start:prod
# Or use PM2 for process management
pm2 start dist/main.js --name db-manager-apicd frontend
# Build the application
npm run build
# Output will be in frontend/dist/
# Serve with any static file server:
# - nginx
# - Apache
# - Vercel
# - NetlifySee _scripts/SETUP_AUTOSTART.md for setting up the backend as a systemd service.
- Use strong
ENCRYPTION_KEY(32+ characters) - Don't commit
.envfiles - Use test databases, not production
- Keep dependencies updated
- Use environment variables for all secrets
- Enable HTTPS
- Configure CORS properly
- Use strong encryption keys
- Regular security audits
- Keep dependencies updated
- Password Encryption: All database passwords are encrypted using AES-256-CBC
- SQL Injection Prevention: All queries use parameterized statements
- Input Validation: DTOs with class-validator ensure data integrity
- CORS Protection: Configurable CORS settings for API access
# Find process using port 3000
lsof -i :3000
# Kill the process
kill -9 <PID>
# Or change port in .env
PORT=3001# Generate a new key
openssl rand -base64 32
# Add to backend/.env
ENCRYPTION_KEY=<generated-key>- Verify database credentials
- Check PostgreSQL is running:
pg_isready - Verify user permissions
- Check
pg_hba.conffor authentication settings
- Ensure backend CORS allows frontend origin
- Check
backend/src/main.tsCORS configuration - Verify frontend URL matches allowed origins
- Verify backend is running:
curl http://localhost:3000/api/health - Check
VITE_API_URLinfrontend/.env - Verify firewall/network settings
For more troubleshooting tips, see SETUP_GUIDE.md.
cd backend
# Run unit tests
npm test
# Run E2E tests
npm run test:e2e
# Test coverage
npm run test:covcd frontend
# Run tests (if configured)
npm test-
Start the application (see Quick Start above)
-
Create a Database Connection:
- Open the app in your browser
- Click the Settings icon
- Click "Add New Connection"
- Enter your PostgreSQL connection details
- Test the connection
- Save the connection
-
Explore Your Database:
- Select a connection from the sidebar
- Browse schemas and tables
- Click on a table to view its data
- Use filters, sorting, and search to explore
-
Execute Queries:
- Open the Query Editor
- Write and execute SQL queries
- View query history and save frequently used queries
-
Visualize Relationships:
- Navigate to the Diagram view
- Explore entity-relationship diagrams
- Click on foreign keys to navigate relationships
-
Export Data:
- View table data or query results
- Click the Export button
- Choose format (CSV/JSON) and options
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
- Built with NestJS
- UI components from shadcn/ui
- Database visualization with ReactFlow
- Charts powered by Recharts
For issues, questions, or contributions, please open an issue on the repository.
Happy Database Managing! 🚀