Quick Start Guide
Get up and running with Solobase in under 10 minutes. This guide will walk you through installing Solobase, setting up your first project, and making your first API call.
Prerequisites
Before you begin
Make sure you have the following installed on your system:
Server Requirements
- PHP 8.2 or higher
- PostgreSQL 12 or higher
- Composer (PHP package manager)
- Web server (Apache/Nginx)
Client Requirements
- Node.js 16 or higher (for SDK)
- npm or yarn package manager
- Modern web browser
Step 1: Install Solobase Server
Clone the Repository
git clone https://github.com/Enrique-Mertoe/solobase.git
cd solobase
composer install
Environment Configuration
Copy the example environment file and configure your database connection:
cp .env.example .env
Edit the .env
file with your database credentials:
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=solobase
DB_USERNAME=postgres
DB_PASSWORD=your_password
JWT_SECRET=your-super-secret-jwt-key
Initialize the Database
php artisan migrate
php artisan storage:link
Start the Server
php artisan serve
Server Running!
Your Solobase server is now running at http://localhost:8000
Step 2: Install the JavaScript SDK
Install the Solobase JavaScript SDK in your client application:
npm install solobase-js
Initialize the Client
Create a client instance in your application:
import { createClient } from 'solobase-js'
const solobase = createClient(
'http://localhost:8000', // Your Solobase URL
'your-api-key' // Your API key (optional for now)
)
export default solobase
Step 3: Make Your First API Call
User Signup
Let's create your first user account:
// Sign up a new user
const { data, error } = await solobase.auth.signUp({
email: 'user@example.com',
password: 'securepassword123'
})
if (error) {
console.error('Error:', error.message)
} else {
console.log('User created:', data.user)
console.log('Session:', data.session)
}
Authentication & Database Operations
Here are examples of common operations you'll use:
// Sign in an existing user
const { data, error } = await solobase.auth.signInWithPassword({
email: 'user@example.com',
password: 'securepassword123'
})
if (error) {
console.error('Error:', error.message)
} else {
console.log('Logged in:', data.user)
}
Complete Example
Here's a complete example showing authentication and database operations:
1import { createClient } from 'solobase-js'
2
3// Initialize client
4const solobase = createClient('http://localhost:8000')
5
6async function demo() {
7 try {
8 // Sign up
9 const { data: authData, error: authError } = await solobase.auth.signUp({
10 email: 'demo@example.com',
11 password: 'demopassword123'
12 })
13
14 if (authError) throw authError
15
16 console.log('✅ User created successfully!')
17
18 // Create a post
19 const { data: postData, error: postError } = await solobase
20 .from('posts')
21 .insert([{
22 title: 'Welcome to Solobase',
23 content: 'This is my first post using Solobase!',
24 user_id: authData.user.id
25 }])
26 .select()
27
28 if (postError) throw postError
29
30 console.log('✅ Post created:', postData[0])
31
32 // Fetch all posts
33 const { data: allPosts, error: fetchError } = await solobase
34 .from('posts')
35 .select('*')
36 .order('created_at', { ascending: false })
37
38 if (fetchError) throw fetchError
39
40 console.log('✅ All posts:', allPosts)
41
42 } catch (error) {
43 console.error('❌ Error:', error.message)
44 }
45}
46
47demo()
Next Steps
Congratulations! You've successfully set up Solobase and made your first API calls. Here's what to explore next:
Authentication Deep Dive
Learn about OAuth, JWT tokens, user management, and advanced authentication features.
Database Operations
Master filtering, joining, real-time subscriptions, and advanced database features.
File Storage
Upload, download, and manage files with buckets, signed URLs, and metadata.
Production Deployment
Deploy Solobase to production with Docker, VPS, cPanel, and performance optimization.
Need Help?
If you run into any issues during setup, we're here to help: