Quickstart
This guide will help you get started with Gateway using Docker, discover your database and launch API on top of it.
Prerequisites
- OpenAI API key for AI-powered API generation
- Your PostgreSQL Database or any other db that gateway supports. You can also take our example databases:
Installation and Launching Steps
1. Binary Installation
Choose your operating system below for specific installation instructions for Linux:
# Download the latest binary for Linuxwget https://github.com/centralmind/gateway/releases/latest/download/gateway-linux-amd64.tar.gz
# Extract the archivetar -xzf gateway-linux-amd64.tar.gzmv gateway-linux-amd64 gateway
# Make the binary executablechmod +x gateway
Windows (Intel)
# Download the latest binary for WindowsInvoke-WebRequest -Uri https://github.com/centralmind/gateway/releases/latest/download/gateway-windows-amd64.zip -OutFile gateway-windows.zip
# Extract the archiveExpand-Archive -Path gateway-windows.zip -DestinationPath .
# RenameRename-Item -Path "gateway-windows-amd64.exe" -NewName "gateway.exe"
macOS (Intel)
# Download the latest binary for macOS (Intel)curl -LO https://github.com/centralmind/gateway/releases/latest/download/gateway-darwin-amd64.tar.gz
# Extract the archivetar -xzf gateway-darwin-amd64.tar.gzmv gateway-darwin-amd64 gateway
# Make the binary executablechmod +x gateway
macOS (Apple Silicon)
# Download the latest binary for macOS (Apple Silicon)curl -LO https://github.com/centralmind/gateway/releases/latest/download/gateway-darwin-arm64.tar.gz
# Extract the archivetar -xzf gateway-darwin-arm64.tar.gzmv gateway-darwin-arm64 gateway
# Make the binary executablechmod +x gateway
2. Create a connection.yaml
configuration file:
echo 'hosts: - localhostuser: "your-database-user"password: "your-database-password"database: "your-database-name"port: 5432' > connection.yaml
3. Run the discovery process with AI-powered API generation:
./gateway discover \ --config connection.yaml \ --db-type postgres \ --ai-api-key $OPENAI_KEY \ --prompt "Develop an API that enables a chatbot to retrieve information about data. \Try to place yourself as analyst and think what kind of data you will require, \based on that come up with useful API methods for that"
4. Start the REST server:
./gateway --config gateway.yaml start rest
Verification
After starting the REST server, you can verify the installation by accessing the Swagger UI:
http://localhost:9090/swagger/