Installation
Set up your BrewHoard development environment with all required dependencies and configurations.
This guide walks you through setting up a complete BrewHoard development environment from scratch.
Prerequisites
Before you begin, ensure you have the following installed:
Required Software
| Software | Version | Purpose |
|---|---|---|
| Node.js | 20.x or later | JavaScript runtime |
| npm | 10.x or later | Package manager |
| PostgreSQL | 15.x or later | Database |
| Git | 2.x | Version control |
Optional Software
| Software | Purpose |
|---|---|
| Docker | Containerized PostgreSQL |
| VS Code | Recommended editor with Svelte extension |
System Check
Verify your installations:
# Check Node.js version
node --version
# Should output: v20.x.x or higher
# Check npm version
npm --version
# Should output: 10.x.x or higher
# Check PostgreSQL
psql --version
# Should output: psql (PostgreSQL) 15.x or higher
# Check Git
git --version
# Should output: git version 2.x.xClone the Repository
# Clone via HTTPS
git clone https://github.com/Skediaio/beer-vault.git
# Or via SSH
git clone git@github.com:Skediaio/beer-vault.git
# Navigate to project directory
cd beer-vaultInstall Dependencies
# Install all npm packages
npm installThis installs:
- SvelteKit - Application framework
- Svelte 5 - UI library with runes
- postgres - PostgreSQL client
- postgres-shift - Migration tool
- @inlang/paraglide-sveltekit - i18n
- tailwindcss - Styling
- shadcn-svelte - Component library
- stripe - Payment processing
Database Setup
Option 1: Local PostgreSQL
# Create the database
createdb brewhoard_dev
# Verify connection
psql -d brewhoard_dev -c "SELECT version();"Option 2: Docker PostgreSQL
# Start PostgreSQL container
docker run -d
--name brewhoard-postgres
-e POSTGRES_DB=brewhoard_dev
-e POSTGRES_USER=postgres
-e POSTGRES_PASSWORD=postgres
-p 5432:5432
postgres:15-alpine
# Verify it's running
docker ps | grep brewhoard-postgresEnvironment Configuration
Create your local environment file:
# Copy the example environment file
cp .env.example .envEdit .env with your configuration:
# Database connection
DATABASE_URL="postgres://postgres:postgres@localhost:5432/brewhoard_dev"
# Session secret (generate a random string)
SESSION_SECRET="your-random-secret-at-least-32-characters"
# Stripe keys (for marketplace payments)
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
# Vision API (for beer scanner)
VISION_API_KEY="your-vision-api-key"
# File storage
STORAGE_PATH="./uploads"
# Email (optional)
SMTP_HOST="smtp.example.com"
SMTP_PORT="587"
SMTP_USER="user@example.com"
SMTP_PASS="password"Generating a Session Secret
# Using Node.js
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# Or using openssl
openssl rand -hex 32Run Migrations
Apply the database schema:
# Run all pending migrations
npm run migrateThis creates all required tables:
users- User accountssessions- Authentication sessionsapi_keys- API key authenticationbeers- Beer catalogbreweries- Brewery informationuser_collection- User’s beer collectioncollection_history- Consumption historymarketplace_listings- Items for saletransactions- Purchase recordsratings- User reviews- And more…
Verify Installation
Start the development server:
npm run devYou should see:
VITE v5.x.x ready in xxx ms
➜ Local: http://localhost:5173/
➜ Network: http://192.168.x.x:5173/
➜ press h + enter to show helpOpen http://localhost:5173 in your browser. You should see the BrewHoard homepage.
Seed Data (Optional)
For development, you may want sample data:
# Run the seed script
npm run seed
# This creates:
# - Sample beers and breweries
# - Test user accounts
# - Example collection items
# - Marketplace listingsIDE Setup
VS Code Extensions
Install these recommended extensions:
- Svelte for VS Code - Syntax highlighting and IntelliSense
- ESLint - Code linting
- Prettier - Code formatting
- Tailwind CSS IntelliSense - Tailwind autocomplete
- PostgreSQL - Database browser
VS Code Settings
Add to .vscode/settings.json:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"svelte.enable-ts-plugin": true,
"tailwindCSS.includeLanguages": {
"svelte": "html"
}
}Troubleshooting
Port Already in Use
# Find process using port 5173
lsof -i :5173
# Kill the process
kill -9 <PID>Database Connection Failed
Verify PostgreSQL is running:
Bashpg_isready -h localhost -p 5432Check your
DATABASE_URLin.envEnsure the database exists:
Bashpsql -l | grep brewhoard
Migration Errors
# Reset and re-run migrations (DESTRUCTIVE!)
npm run migrate:reset
# Or check migration status
npm run migrate:statusNode Module Issues
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm installNext Steps
With installation complete, you’re ready to:
- Quick Start - Build your first feature
- Architecture - Understand the codebase
- Database - Explore the schema
Having issues? Check our GitHub Issues or open a new one.