Getting Started
This guide will help you set up and deploy your first AI model on Staque IO.
Prerequisites
Before you begin, ensure you have:
- Node.js 18.x or higher installed
- PostgreSQL database (version 13 or higher)
- AWS account with appropriate IAM permissions
- OpenAI API key (for AI recommendations feature)
- NVIDIA API key (optional, for NVIDIA NIM models)
Environment Setup
Create a .env.local file in the root directory with the following variables:
# Database DATABASE_URL=postgresql://user:password@localhost:5432/staque_io # Authentication JWT_SECRET=your-secret-key-here # AWS Credentials STAQUE_AWS_REGION=eu-north-1 STAQUE_AWS_ACCESS_KEY_ID=your-access-key-id STAQUE_AWS_SECRET_ACCESS_KEY=your-secret-access-key # SageMaker Configuration (Optional) SAGEMAKER_SUBNET_IDS=subnet-xxx,subnet-yyy SAGEMAKER_SECURITY_GROUP_IDS=sg-xxx SAGEMAKER_EXECUTION_ROLE_ARN=arn:aws:iam::xxx:role/SageMakerRole # OpenAI (for AI recommendations) OPENAI_API_KEY=sk-xxx # NVIDIA NIM (Optional) NVIDIA_API_KEY=nvapi-xxx NIM_BASE_URL=https://integrate.api.nvidia.com
Installation
Follow these steps to install and run the application:
1. Clone the Repository
git clone https://github.com/your-org/staque-io.git cd staque-io
2. Install Dependencies
npm install
3. Set Up Database
Run the database migrations to create the required tables:
npm run db:migrate
Or manually execute the SQL schema from database/schema.sql
4. Run Development Server
npm run dev
The application will be available at http://localhost:3000
First Steps
1. Create an Account
Navigate to /login and create a new user account. The first user will be assigned admin privileges.
2. Configure AWS Credentials
Go to your dashboard and verify that AWS credentials are properly configured by checking the AWS Credentials section in the admin panel.
3. Browse Available Models
Use the "Get Started" page to:
- Browse available models from AWS Bedrock
- View SageMaker model packages
- Explore NVIDIA NIM hosted models
4. Deploy Your First Model
Select a model and follow the deployment wizard:
- Choose your model (e.g., Amazon Nova Pro or Claude 3 Sonnet)
- Configure deployment settings
- Review pricing estimates
- Deploy and start chatting
Quick Start Example
Here's a quick example of deploying an AWS Bedrock model using the API:
// Create a conversation with deployed resource
const response = await fetch('/api/conversations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_JWT_TOKEN'
},
body: JSON.stringify({
title: 'My First AI Assistant',
use_case: 'general-purpose',
deployed_resource: {
resource_name: 'Nova Pro Assistant',
resource_type: 'bedrock',
aws_resource_id: 'amazon.nova-pro-v1:0',
region: 'eu-north-1',
estimated_hourly_cost: 0
}
})
})
const { conversation_id, resource_id } = await response.json()
// Start chatting
const chatResponse = await fetch('/api/chat/thread', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_JWT_TOKEN'
},
body: JSON.stringify({
message: 'Hello! How can you help me?',
conversationId: conversation_id,
resourceId: resource_id
})
})
const { messages } = await chatResponse.json()
console.log(messages)AWS IAM Permissions
Your AWS IAM user/role needs the following permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:ListFoundationModels",
"bedrock:GetFoundationModel",
"bedrock:InvokeModel",
"bedrock-runtime:InvokeModel"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"sagemaker:ListModelPackages",
"sagemaker:DescribeModelPackage",
"sagemaker:CreateModel",
"sagemaker:CreateEndpointConfig",
"sagemaker:CreateEndpoint",
"sagemaker:DescribeEndpoint",
"sagemaker:UpdateEndpoint",
"sagemaker:DeleteEndpoint",
"sagemaker:InvokeEndpoint"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"pricing:GetProducts"
],
"Resource": "*"
}
]
}Next Steps
Explore Architecture
Learn about the system architecture and design patterns
API Reference
Detailed documentation of all API endpoints
Deployment Guide
Advanced deployment strategies for production
Chat System
Understanding the conversation and threading system
⚠️ Production Considerations
Before deploying to production, ensure you:
- Use strong JWT secrets and rotate them regularly
- Enable SSL/TLS for all connections
- Set up proper database backups
- Configure rate limiting on API endpoints
- Review and restrict AWS IAM permissions
- Enable CloudWatch monitoring and logging