Skip to main content

Development Workflow

This guide covers the day-to-day development workflow for SkyTeam ROBLOX, including running development servers, building, and testing.

Prerequisites

Before starting development, ensure you have:
  • Node.js 18.0.0 or later
  • pnpm 10.5.2 or later
  • PostgreSQL database running
  • Environment variables configured (see Environment Setup)

Initial Setup

1. Install Dependencies

pnpm install
This installs all dependencies for all workspace packages using pnpm’s efficient workspace linking.

2. Environment Setup

Copy the example environment file and configure it:
cp .env.example .env
Edit .env with your local configuration:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/skyteam"

# Discord Bot
DISCORD_TOKEN="your-discord-bot-token"
DISCORD_HOME_GUILD_ID="your-guild-id"
DISCORD_CLIENT_ID="your-client-id"

# API URL for frontend
NEXT_PUBLIC_API_URL="http://localhost:4000"

# Admin authentication
ADMIN_JWT_SECRET="your-secret-key"

# Development mode
NODE_ENV="development"

3. Initialize Database

Push the database schema to your PostgreSQL instance:
pnpm db:push
This runs drizzle-kit push in the @skyteam/database package.

Development Scripts

All scripts are defined in the root package.json and orchestrated by Turborepo.

Start All Applications

pnpm dev
What this does:
  • Starts all apps in parallel with hot reload
  • Runs turbo run dev which executes the dev script in all workspace packages
  • Uses dotenv-cli to load environment variables from .env
Services started:
  • Web: http://localhost:3000
  • Admin: http://localhost:3001
  • API: http://localhost:4000
  • Discord bot: Connects to Discord
  • Models: Rojo server for ROBLOX sync

Development Modes

pnpm dev:roblox
ROBLOX Mode (dev:roblox):
  • Starts: @skyteam/models, @skyteam/api, @skyteam/database
  • Use when working on ROBLOX integration
Web Mode (dev:web):
  • Starts: @skyteam/web, @skyteam/api
  • Use when working on the website

Database Management

pnpm db:push
Database Studio:
  • Launches Drizzle Studio at https://local.drizzle.studio
  • Provides a GUI for browsing and editing database data
  • Useful for debugging and manual data management

Building

Build All Applications

pnpm build
Runs turbo run build, which:
  1. Builds packages first (due to ^build dependency)
  2. Builds apps in parallel where possible
  3. Caches outputs in .turbo/ for faster rebuilds

Build Individual Packages

pnpm --filter @skyteam/api build
pnpm --filter @skyteam/web build
pnpm --filter @skyteam/database build
Use --filter to build specific workspace packages.

Build Outputs

Each application produces different build artifacts:
AppBuild ToolOutput DirectoryType
apitsupdist/Node.js bundle
webNext.js.next/Next.js build
adminNext.js.next/Next.js build
clienttsupdist/ESM bundle
modelsroblox-tsout/Luau code
databasetsupdist/CJS + ESM

Linting

Lint All Code

pnpm lint
Runs turbo run lint, executing ESLint in all packages.

Format Code

pnpm format
Formats all code with Prettier:
  • Formats: ts, tsx, js, jsx, json, md, mdx, css, scss, yaml, yml
  • Respects .gitignore patterns
Set up your editor to run Prettier on save for the best experience. See the .prettierrc file for formatting rules.

Development Workflow Examples

Working on the API

# Start API in watch mode
pnpm --filter @skyteam/api dev

# In another terminal, open database studio
pnpm db:studio
The API will automatically rebuild and restart when you save changes.

Working on the Website

# Start web app with API
pnpm dev:web
Visit http://localhost:3000 to see your changes with Fast Refresh.

Working on ROBLOX Models

# Start ROBLOX development environment
pnpm dev:roblox
This starts:
  1. Rojo server (live sync to ROBLOX Studio)
  2. TypeScript compiler (compiles .ts to Luau)
  3. API server (for data integration)
In ROBLOX Studio, connect to the Rojo server to see live updates.

Working on Shared Packages

When modifying @skyteam/database or @skyteam/ui:
# Start database package in watch mode
pnpm --filter @skyteam/database dev

# In another terminal, start consuming apps
pnpm dev:web
Changes to the shared package are immediately available to apps due to pnpm workspace linking.

Turborepo Cache

Turborepo caches task outputs to speed up builds:
# View cache hit rates
pnpm build --summarize

# Clear cache if needed
rm -rf .turbo
Cache behavior:
  • build and lint tasks are cached
  • dev tasks are never cached ("cache": false)
  • Cache is invalidated when .env changes

Common Tasks

To a specific package:
pnpm --filter @skyteam/api add express
To the root (dev tools):
pnpm add -D -w prettier
The -w flag adds to the workspace root.
Use the --filter flag:
pnpm --filter @skyteam/web <command>
Examples:
pnpm --filter @skyteam/api start
pnpm --filter @skyteam/database db:studio
Update all dependencies:
pnpm update -r
Update specific package:
pnpm --filter @skyteam/web update next
The -r flag updates recursively across all workspace packages.
# Clean all build outputs
rm -rf apps/*/dist apps/*/.next packages/*/dist

# Clean Turborepo cache
rm -rf .turbo

# Clean node_modules
rm -rf node_modules apps/*/node_modules packages/*/node_modules
pnpm install

Production Builds

Build for Production

NODE_ENV=production pnpm build

Run Production Servers

pnpm --filter @skyteam/api start
Ensure all required environment variables are set in production. The globalEnv configuration in turbo.json lists all required variables.

Git Workflow

The repository uses Git with the following conventions:
# Create a feature branch
git checkout -b feature/your-feature-name

# Make changes and commit
git add .
git commit -m "feat: add new feature"

# Push and create PR
git push origin feature/your-feature-name
Run pnpm lint and pnpm format before committing to ensure code quality.

Build docs developers (and LLMs) love