Skip to content

Latest commit

 

History

History
142 lines (100 loc) · 2.79 KB

File metadata and controls

142 lines (100 loc) · 2.79 KB

Getting Started with Fakestack

This guide will help you get started with Fakestack in just a few minutes.

Installation

Choose your preferred installation method:

Python (pip)

pip install fakestack

Node.js (npm)

npm install fakestack

Homebrew (macOS/Linux)

brew tap 0xdps/packages
brew install fakestack

Direct Binary Download

Download pre-built binaries from GitHub Releases.

Your First Database

Step 1: Download Example Schema

fakestack -d .

This creates a schema.json file with an example database structure.

Step 2: Generate the Database

fakestack -c -p -f schema.json

This will:

  1. Create database tables based on the schema
  2. Populate them with realistic fake data

Step 3: Verify the Data

# For SQLite (default)
sqlite3 test.db "SELECT * FROM users LIMIT 5;"

# For MySQL
mysql -u root -p testdb -e "SELECT * FROM users LIMIT 5;"

# For PostgreSQL
psql -U postgres -d testdb -c "SELECT * FROM users LIMIT 5;"

Using in Your Code

Python

from fakestack import fakestack

# Generate database
exit_code = fakestack(['-c', '-p', '-f', 'schema.json'])

if exit_code == 0:
    print("Database generated successfully!")

Node.js / TypeScript

import { fakestack } from 'fakestack';

// Generate database
const exitCode = await fakestack(['-c', '-p', '-f', 'schema.json']);

if (exitCode === 0) {
    console.log('Database generated successfully!');
}

Next Steps

Common Commands

# Download example schema
fakestack -d .

# Create tables only
fakestack -c -f schema.json

# Populate data only (tables must exist)
fakestack -p -f schema.json

# Create and populate in one command
fakestack -c -p -f schema.json

# Get help
fakestack -h

Troubleshooting

Binary Not Found

If you get a "binary not found" error, make sure you've installed fakestack correctly:

# Python
pip install --upgrade fakestack

# Node.js
npm install --save fakestack

# Homebrew
brew upgrade 0xdps/fakestack

Permission Denied (Unix/macOS/Linux)

The binary might not have execute permissions:

chmod +x ~/.local/lib/python*/site-packages/fakestack/bin/fakestack-*

Database Connection Errors

Verify your database configuration in the schema file:

  • Check credentials (username, password)
  • Verify host and port
  • Ensure database exists
  • Check network connectivity

For more help, see Troubleshooting.