Overview
RestAI can be installed in multiple ways depending on your use case:Local Development
Best for development and testing
Docker Compose
Simplified deployment with containers
Production
Scalable production deployment
System Requirements
Local Development
Version 1.3 or higher - JavaScript runtime and package managerInstall:
curl -fsSL https://bun.sh/install | bashVersion 17 - Relational databaseInstall via:
- macOS:
brew install postgresql@17 - Ubuntu:
apt install postgresql-17 - Windows: Download from postgresql.org
For running Redis and optional full containerizationInstall: docker.com/get-started
Bun can replace Node.js, but some tools may require it
Production
- CPU: 2+ cores recommended
- RAM: 2GB minimum, 4GB+ recommended
- Storage: 10GB+ for database and logs
- OS: Linux (Ubuntu 22.04 LTS recommended)
Local Development Installation
1. Clone Repository
2. Install Dependencies
Install all workspace dependencies with Bun:3. Environment Configuration
RestAI uses environment variables for configuration. Create your.env file:
Core Environment Variables
Copy to Individual Apps
Environment variables need to be copied to specific apps:4. Start PostgreSQL
Ensure PostgreSQL is running:5. Create Database
Create the RestAI database:Make sure the database name matches the one in your
DATABASE_URL environment variable.6. Start Redis
Use Docker Compose to start Redis:7. Database Setup
Apply the Drizzle schema to create all tables:What this does:
- Creates all tables (organizations, users, branches, menu items, orders, etc.)
- Sets up foreign key relationships
- Creates indexes for performance
- Applies enum types
Seed Demo Data (Optional)
Load sample data for testing:- Demo organization: “RestAI Demo”
- Default branch: “Sede Principal”
- Admin user:
[email protected]/admin12345 - Sample menu categories and items
- Tables with QR codes
8. Start Development Servers
Launch both API and web app:http://localhost:3000Admin dashboard and customer QR flow
http://localhost:3001REST API + WebSocket endpoint at
/wsSuccess! RestAI is now running locally. Open http://localhost:3000 to access the dashboard.
Docker Compose Installation
For a fully containerized setup, use Docker Compose to run all services:1. Configure Environment
Create.env file with your configuration:
2. Build and Start Services
- postgres - PostgreSQL 17 database
- redis - Redis 7 for caching
- migrate - One-time migration service
- api - Hono API server on port 3001
- web - Next.js app on port 3100
The web app runs on port 3100 when using Docker Compose (not 3000) to avoid conflicts.
3. View Logs
4. Access Services
| Service | URL | Description |
|---|---|---|
| Web | http://localhost:3100 | Dashboard |
| API | http://localhost:3001 | REST API |
| PostgreSQL | localhost:5432 | Database |
| Redis | localhost:6379 | Cache |
5. Seed Database (Optional)
Run the seed script inside the API container:Database Management
RestAI uses Drizzle ORM for type-safe database operations.Available Commands
Database Schema Highlights
Key tables in the RestAI schema:Multi-Tenancy
Multi-Tenancy
organizations- Top-level tenant isolationbranches- Physical locations per organizationusers- User accounts with role-based accessuser_branches- Many-to-many user-branch assignments
Menu Management
Menu Management
Orders & Tables
Orders & Tables
tables- Physical tables with QR codestable_sessions- Active customer sessionsorders- Customer orders with status trackingorder_items- Line items with modifiers
Payments & Loyalty
Payments & Loyalty
payments- Transaction recordsinvoices- Tax receiptsloyalty_points- Customer reward pointscoupons- Discount codes
Production Deployment
Using Docker
For production deployments, use the provided Dockerfiles:Platform-Specific Guides
Docker Deployment
Deploy with Docker Compose
Environment Variables
Configure your deployment
Database Setup
Set up and manage your database
Security Best Practices
Secure your production deployment
Troubleshooting
Migration fails with 'relation already exists'
Migration fails with 'relation already exists'
This happens if you ran
db:push before db:migrate.Solution:WebSocket connection refused
WebSocket connection refused
Error: WebSocket connection to ws://localhost:3001/ws failedSolutions:
- Verify API is running:
curl http://localhost:3001/health - Check
NEXT_PUBLIC_WS_URLmatches API host - Ensure no firewall blocking port 3001
Image uploads fail
Image uploads fail
Error: Failed to upload image or R2 errorSolutions:
- Verify R2 credentials in
.env - Check bucket name and permissions
- For local dev, image uploads are optional
- Images are stored as URLs if R2 is not configured
Bun workspace resolution errors
Bun workspace resolution errors
Error: Cannot find module ‘@restai/…’Solutions:
Next Steps
API Reference
Explore all available endpoints and authentication
Core Features
Learn how to use all features of the dashboard