@sunny-pirate/backend-dreamlab-datacenter v1.0.5
DreamLab Datacenter
A centralized Supabase-based backend infrastructure for DreamLab services, including the SimGarage racing platform.
Overview
DreamLab Datacenter is the core backend infrastructure that powers multiple DreamLab services:
- SimGarage Platform: A comprehensive sim racing community platform
- DreamLab Website: Corporate website and CMS with multilingual support
- Contact Management: Form submission processing with workflow system
This repository contains database schema definitions, migrations, edge functions, and TypeScript type definitions for the entire ecosystem.
Architecture
Database Structure
The project uses a multi-schema approach in PostgreSQL:
- public: Shared tables and utilities
- simgarage: Racing platform-specific schemas
- auth: Supabase authentication tables
- storage: File storage management
Key features:
- Row-Level Security (RLS) policies for fine-grained access control
- Custom roles system for SimGarage users
- Storage buckets for various asset types
- Edge functions for serverless operations
SimGarage Platform
The SimGarage platform ("Motorhome - The SimGarage") is a modular, multi-tenant web application for the sim racing community with features for:
- User and team management
- Championship organization
- Racing session tracking
- Car setup and telemetry storage
- Custom liveries and driver customization
- Subscription management with Stripe integration
Storage System
The project leverages Supabase Storage with multiple buckets:
acc-car-setups
: Car setup files with restricted accessacc-motec-telemetry
: Telemetry data filesacc-custom-cars
: Custom car configuration filesacc-driver-customization
: Driver appearance customizationsacc-liveries
: Livery textures and assets (public readable)
Getting Started
Prerequisites
- Node.js (v18+)
- pnpm package manager
- Supabase CLI
- Docker and Docker Compose
Installation
Clone the repository:
git clone https://github.com/dreamlab/backend-dreamlab-datacenter.git cd backend-dreamlab-datacenter
Install dependencies:
pnpm install
Start the local Supabase instance:
supabase start
Apply migrations:
supabase migration up
Load seed data:
supabase db reset
Generate TypeScript types:
./bin/generate-types.sh
Development Commands
# Generate TypeScript types from Supabase schema
pnpm run generate:ts
# Build the TypeScript project
pnpm run build
# Generate types with custom schema selection
./bin/generate-types.sh --schema "public,simgarage,auth,storage"
# Connect to local Supabase instance
supabase start
# Apply migrations
supabase migration up
# Create a new migration
supabase migration new migration_name
Documentation
Comprehensive documentation is maintained using Antora and can be found in the docs/
directory:
- Documentation is written in AsciiDoc format
- UML diagrams visualize system components and workflows
- The
docs/modules/simgarage/
directory contains SimGarage-specific documentation
To build the documentation:
npx antora antora-playbook.yml
This will generate static documentation in the public/
directory.
SimGarage Modules
- User Management: Profiles, authentication, and roles
- Team Organization: Teams, communities, and memberships
- Racing Structure: Championships, races, and sessions
- Racing Resources: Games, cars, and tracks
- Technical Resources: Setups, strategies, and telemetry
- Customization: Liveries, mods, and driver customizations
- Subscription Management: Plans, billing, and access
Working with Edge Functions
Edge Functions provide serverless capabilities:
- Navigate to function directory in
supabase/functions/
- Use Deno for local development
- Deploy using Supabase CLI
Contributing
- Create a new branch for your feature
- Follow the established code style and patterns
- Add appropriate database migrations
- Document your changes
- Create a pull request for review
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
For questions or support, contact the DreamLab development team.