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.goDetailed 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-remoteThis creates Go code from SQL queries in internal/database/queries/.
3. Build the Application#
Compile the application:
go build -o build/embapi main.goThe binary will be created at build/embapi.
Running Without Building#
You can run the application directly without building a binary:
go run main.goThis is useful during development but slower than running a pre-built binary.
Verify Installation#
Check that the binary was created successfully:
./build/embapi --helpYou should see the available command-line options.
Next Steps#
After installation, you need to:
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@latestMake sure $GOPATH/bin is in your PATH.
Build Errors#
Ensure you’re using Go 1.21 or later:
go versionClean the build cache if you encounter issues:
go clean -cache
go build -o build/embapi main.goMissing Dependencies#
Force update all dependencies:
go mod download
go get -u ./...