Installation#

Install embapi by compiling from source.

Prerequisites#

  • Go 1.21 or later
  • PostgreSQL 11+ with pgvector extension
  • sqlc for code generation

Quick Install#

# Clone the repository
git clone https://github.com/mpilhlt/embapi.git
cd embapi

# Install dependencies and generate code
go get ./...
sqlc generate --no-remote

# Build the binary
go build -o build/embapi main.go

Detailed Steps#

1. Install Dependencies#

Download all Go module dependencies:

go get ./...

2. Generate Database Code#

Generate type-safe database queries using sqlc:

sqlc generate --no-remote

This creates Go code from SQL queries in internal/database/queries/.

3. Build the Application#

Compile the application:

go build -o build/embapi main.go

The binary will be created at build/embapi.

Running Without Building#

You can run the application directly without building a binary:

go run main.go

This is useful during development but slower than running a pre-built binary.

Verify Installation#

Check that the binary was created successfully:

./build/embapi --help

You should see the available command-line options.

Next Steps#

After installation, you need to:

  1. Set up the database
  2. Configure environment variables
  3. Run the service

System Requirements#

  • Memory: Minimum 512MB RAM (2GB+ recommended for production)
  • Disk: Minimal (< 50MB for binary, database size varies)
  • CPU: Any modern CPU (multi-core recommended for concurrent requests)

Troubleshooting#

sqlc Command Not Found#

Install sqlc:

go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

Make sure $GOPATH/bin is in your PATH.

Build Errors#

Ensure you’re using Go 1.21 or later:

go version

Clean the build cache if you encounter issues:

go clean -cache
go build -o build/embapi main.go

Missing Dependencies#

Force update all dependencies:

go mod download
go get -u ./...