DocumentationFauxDB Documentation
FauxDB Getting Started
Prerequisites
Before installing FauxDB, ensure you have:
- Rust toolchain (for building from source) or Docker
- PostgreSQL 16, 17, or 18 installed and running
- MongoDB client tools (mongosh) for testing
- System packages: libpq-dev, build-essential
Install FauxDB Binary
Download and install the FauxDB binary on your system.
Install from source
# Prerequisites
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
sudo apt-get install -y postgresql-17 postgresql-client-17 libpq-dev
# Clone and build FauxDB from source
git clone https://github.com/pgElephant/fauxdb.git
cd fauxdb
# Build with optimizations
cargo build --release
# Or use Docker for quick start
docker-compose up -dConfigure Database
Set up PostgreSQL connection and FauxDB configuration.
Configuration file (config/fauxdb.toml)
[server]
host = "0.0.0.0"
port = 27018
max_connections = 10000
connection_timeout_ms = 30000
idle_timeout_ms = 60000
worker_threads = 4
[database]
uri = "postgresql://fauxdb:password@localhost:5432/fauxdb"
max_connections = 100
connection_timeout_ms = 5000
idle_timeout_ms = 60000
enable_jsonb_extensions = true
[logging]
level = "info"
format = "json"
output = "stdout"
log_file = "/var/log/fauxdb/fauxdb.log"
[metrics]
enabled = true
port = 9090
path = "/metrics"Start FauxDB Server
Launch FauxDB server and connect to PostgreSQL.
Setup and start
# Setup PostgreSQL database
sudo -u postgres createdb fauxdb
sudo -u postgres psql -d fauxdb -c "CREATE USER fauxdb WITH PASSWORD 'password';"
sudo -u postgres psql -d fauxdb -c "GRANT ALL PRIVILEGES ON DATABASE fauxdb TO fauxdb;"
# Start FauxDB server
./target/release/fauxdb --config config/fauxdb.toml
# Or use Docker
docker-compose up -dVerify Setup
Test MongoDB compatibility and database operations.
Connect and test
# Connect with MongoDB client
mongosh mongodb://localhost:27018
# Verify MongoDB compatibility
mongosh --host localhost --port 27018 --eval "db.runCommand({ping: 1})"
# Test CRUD operations
db.users.insertOne({name: "John", email: "john@example.com"})
db.users.find({name: "John"})
db.users.updateOne({name: "John"}, {$set: {age: 30}})
db.users.deleteOne({name: "John"})Next Steps
- Configuration - Learn about advanced configuration options
- API Reference - Explore MongoDB-compatible API endpoints
- Examples - See practical usage examples and integrations