S
Solo Kit
DocumentationComponentsPricingChangelogRoadmapFAQContact
LoginGet Started
DocumentationComponentsPricing
LoginGet Started
Welcome to Solo Kit DocumentationIntroductionTech StackRoadmapFAQGetting Started
Getting Started

Development

Development Workflow

This guide covers Solo Kit's development workflow, debugging techniques, and best practices for building features efficiently.

πŸš€ Starting Development

Quick Start

# Start web app (most common)
pnpm dev

# Or be explicit
pnpm dev:web

This starts the Next.js development server with:

  • Hot reloading - Changes reflect instantly
  • Turbopack - Ultra-fast bundling
  • TypeScript checking - Real-time error detection
  • ESLint integration - Code quality feedback

Development Servers

# Web app only (default)
pnpm dev:web

# Mobile app only
pnpm dev:mobile

# Both apps simultaneously
pnpm dev:all

Expected output:

β–² Next.js 15.5.2 (Turbopack)
- Local:        http://localhost:3000
- Network:      http://192.168.1.100:3000

βœ“ Ready in 1.2s

πŸ—οΈ Project Structure for Development

Development File Types

apps/web/
β”œβ”€β”€ πŸ“„ Pages & Routes
β”‚   β”œβ”€β”€ app/*/page.tsx          # Next.js pages
β”‚   β”œβ”€β”€ app/*/layout.tsx        # Layout files
β”‚   └── app/api/*/route.ts      # API routes
β”œβ”€β”€ 🧩 Components
β”‚   β”œβ”€β”€ components/ui/          # shadcn/ui (don't edit)
β”‚   β”œβ”€β”€ components/features/    # Feature components
β”‚   └── components/common/      # Reusable components
β”œβ”€β”€ 🎣 Hooks
β”‚   β”œβ”€β”€ hooks/use-*.ts          # Custom hooks
β”‚   └── lib/hooks/              # Complex hooks
β”œβ”€β”€ πŸ“š Business Logic
β”‚   β”œβ”€β”€ lib/actions/            # Server actions
β”‚   β”œβ”€β”€ lib/queries/            # Data fetching
β”‚   └── lib/utils.ts            # Utilities
└── 🎨 Styling
    β”œβ”€β”€ app/globals.css         # Global styles
    └── components/**/*.module.css # Component styles

πŸ”„ Development Workflow

1. Feature Development Cycle

# 1. Create new branch
git checkout -b feature/user-profile

# 2. Start development
pnpm dev

# 3. Make changes (hot reload active)
# 4. Test in browser at http://localhost:3000

# 5. Run quality checks (fast - changed files only)
pnpm lint:changed
pnpm type-check:changed

# 6. Commit changes
git add .
git commit -m "feat: add user profile management"

2. Adding New Features

Step-by-step process:

  1. Plan the feature - Identify required components, routes, and data
  2. Database changes - Update schema in packages/database/schema/
  3. API layer - Create server actions or API routes
  4. UI components - Build necessary components
  5. Pages/routes - Create or update pages
  6. Testing - Test functionality manually and with tests

3. Making Changes

Component Development:

// 1. Create component
// components/features/profile/user-avatar.tsx
interface UserAvatarProps {
  user: { name: string; email: string; avatar?: string };
  size?: 'sm' | 'md' | 'lg';
}

export function UserAvatar({ user, size = 'md' }: UserAvatarProps) {
  return (
    <div className="flex items-center space-x-3">
      {/* Implementation */}
    </div>
  );
}

// 2. Use in page
// app/profile/page.tsx
import { UserAvatar } from '@/components/features/profile/user-avatar';

export default function ProfilePage() {
  return (
    <div>
      <UserAvatar user={currentUser} />
    </div>
  );
}

Database Development:

// 1. Update schema
// packages/database/schema/users.ts
export const users = pgTable('users', {
  id: uuid('id').primaryKey().defaultRandom(),
  name: text('name').notNull(),
  avatar: text('avatar_url'),
  // ... other fields
});

// 2. Push changes
// Terminal
pnpm db:push

// 3. Use in queries
// lib/queries/users.ts
export async function getUserById(userId: string) {
  return db.select().from(users).where(eq(users.id, userId));
}

πŸ› Debugging

Browser DevTools

React Developer Tools:

  1. Install React DevTools browser extension
  2. Open DevTools β†’ Components tab
  3. Inspect component state and props
  4. Profile performance issues

Network Tab:

  • Monitor API calls and responses
  • Check request/response headers
  • Debug authentication issues
  • Verify data flow

Next.js Debugging

Server Components:

// Add logging in Server Components
export default async function Page() {
  const data = await getData();
  console.log('Server:', data); // Appears in terminal
  return <div>{data.title}</div>;
}

Client Components:

'use client';
import { useEffect } from 'react';

export function ClientComponent() {
  useEffect(() => {
    console.log('Client:', data); // Appears in browser console
  }, []);
}

Server Actions:

'use server';
export async function updateUser(data: FormData) {
  console.log('Action called:', data); // Terminal
  // Action implementation
}

Database Debugging

Drizzle Studio:

pnpm db:studio

Opens visual database browser at http://localhost:4983

Query Logging:

// Enable query logging in development
// packages/database/lib/db.ts
export const db = drizzle(connection, {
  schema,
  logger: process.env.NODE_ENV === 'development',
});

Database State:

# Check database connection
curl http://localhost:3000/debug

# View raw SQL
pnpm db:push --verbose

🎯 Development Best Practices

1. Component Development

Colocate related files:

components/features/dashboard/
β”œβ”€β”€ dashboard-layout.tsx
β”œβ”€β”€ dashboard-stats.tsx
β”œβ”€β”€ dashboard-stats.test.tsx
└── dashboard-stats.stories.tsx

Use TypeScript interfaces:

interface DashboardProps {
  user: User;
  stats: DashboardStats;
  onRefresh?: () => void;
}

export function Dashboard({ user, stats, onRefresh }: DashboardProps) {
  // Implementation
}

2. State Management

Server State (Recommended):

// Use Server Components for data fetching
async function UserProfile({ userId }: { userId: string }) {
  const user = await getUserById(userId);
  return <UserCard user={user} />;
}

Client State:

// Use React hooks for UI state
function UserSettings() {
  const [isEditing, setIsEditing] = useState(false);
  const [settings, setSettings] = useState(defaultSettings);
  
  return (
    <div>
      {isEditing ? <EditForm /> : <DisplaySettings />}
    </div>
  );
}

3. Error Handling

Server Components:

// app/profile/error.tsx
'use client';

export default function Error({
  error,
  reset,
}: {
  error: Error;
  reset: () => void;
}) {
  return (
    <div>
      <h2>Something went wrong!</h2>
      <button onClick={() => reset()}>Try again</button>
    </div>
  );
}

Client Components:

import { toastError } from '@/components/Toast';

function handleSubmit(data: FormData) {
  try {
    await updateUser(data);
    toastSuccess({ description: 'Profile updated!' });
  } catch (error) {
    toastError({ 
      title: 'Error',
      description: 'Failed to update profile'
    });
  }
}

πŸ“± Mobile Development

Starting Mobile Development

# Start mobile development server
pnpm dev:mobile

# Platform-specific
pnpm dev:mobile:ios
pnpm dev:mobile:android

Mobile vs Web Development

Shared Code:

  • UI components in packages/ui/
  • Utilities in packages/utils/
  • Database schemas and queries

Platform-Specific:

  • Navigation patterns
  • Platform APIs (camera, location, etc.)
  • Screen layouts and interactions

Mobile Testing

Expo Go App:

  1. Install Expo Go on your device
  2. Scan QR code from terminal
  3. Test on real device instantly

Simulators:

# iOS Simulator (macOS only)
npx expo run:ios

# Android Emulator
npx expo run:android

⚑ Performance Optimization

Development Performance

Fast Commands (Development):

# Only check changed packages (6-8x faster)
pnpm lint:changed
pnpm type-check:changed
pnpm test:changed

Full Validation (CI/Production):

# Complete validation
pnpm ci
pnpm lint
pnpm type-check

Code Splitting

// Lazy load heavy components
import dynamic from 'next/dynamic';

const HeavyChart = dynamic(
  () => import('@/components/features/analytics/heavy-chart'),
  { loading: () => <div>Loading chart...</div> }
);

Image Optimization

import Image from 'next/image';

function UserAvatar({ src, alt }: { src: string; alt: string }) {
  return (
    <Image
      src={src}
      alt={alt}
      width={40}
      height={40}
      className="rounded-full"
    />
  );
}

πŸ”§ Development Tools

VS Code Integration

Launch Configuration (.vscode/launch.json):

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Next.js: debug server-side",
      "type": "node-terminal",
      "request": "launch",
      "command": "pnpm dev",
      "serverReadyAction": {
        "pattern": "started server on .+, url: (https?://.+)",
        "uriFormat": "%s",
        "action": "debugWithChrome"
      }
    }
  ]
}

Useful Extensions:

  • TypeScript Importer
  • Auto Import ES6
  • Tailwind CSS IntelliSense
  • ESLint
  • Prettier

Terminal Productivity

Useful Aliases:

# Add to your shell profile
alias sd="pnpm dev"
alias sb="pnpm build"
alias sl="pnpm lint:changed"
alias st="pnpm type-check:changed"

Development Scripts:

# Quick development status
pnpm dev & 
pnpm db:studio &  # Database browser
code .            # Open in VS Code

πŸ§ͺ Testing During Development

Manual Testing Workflow

  1. Start development server - pnpm dev
  2. Test core functionality - Sign up, login, main features
  3. Test responsive design - Resize browser, mobile view
  4. Test error states - Invalid inputs, network errors
  5. Test performance - Large datasets, slow networks

Automated Testing

# Run tests in watch mode
pnpm test:watch

# Test specific files
pnpm test user-profile

# Run tests with coverage
pnpm test --coverage

Database Testing

Test with Demo Data:

# Add demo data for testing
pnpm seed:demo

# Clear data when done
pnpm seed:clear

πŸ” Common Development Issues

TypeScript Issues

Problem: Module not found or type errors

# Solutions
pnpm build:packages    # Rebuild shared packages
pnpm type-check        # Check for type errors
rm -rf .next && pnpm dev  # Clear Next.js cache

Problem: Auto-imports not working

// Check tsconfig.json paths
{
  "compilerOptions": {
    "paths": {
      "@/*": ["./apps/web/*"],
      "@packages/ui": ["./packages/ui/src"]
    }
  }
}

Hot Reload Issues

Problem: Changes not reflecting

# Solutions
rm -rf .next/          # Clear Next.js cache
rm -rf node_modules/.cache/  # Clear build cache
pnpm install           # Reinstall dependencies

Problem: CSS changes not updating

# Force reload Tailwind
pnpm dev --turbo --force

Database Issues

Problem: Database connection errors

# Check environment
cat .env.local | grep DATABASE_URL

# Test connection
pnpm db:studio

# Reset database
pnpm db:push

Performance Issues

Problem: Slow development server

# Use Turbopack (default in dev)
pnpm dev

# Clear all caches
pnpm clean
pnpm install
pnpm dev

🎯 Development Checklist

Before Starting Work

  • pnpm install - Dependencies up to date
  • DATABASE_URL configured in .env.local
  • pnpm dev starts without errors
  • Database connection works (/debug)

During Development

  • Hot reload working properly
  • TypeScript errors resolved
  • Console free of warnings/errors
  • Mobile responsiveness tested
  • Authentication flows working

Before Committing

  • pnpm lint:changed passes
  • pnpm type-check:changed passes
  • Manual testing completed
  • No console errors
  • Database migrations applied if needed

Code Quality

  • Components are reusable and well-named
  • TypeScript interfaces defined
  • Error handling implemented
  • Loading states added
  • Responsive design verified

πŸš€ Next Steps

With a solid understanding of the development workflow:

  1. Conventions - Learn coding standards and patterns
  2. Common Commands - Master the command-line tools
  3. Troubleshooting - Solve common development issues
  4. Database Guide - Deep dive into database development

Master this development workflow to build features efficiently and maintain high code quality throughout your Solo Kit project.

On this page

Development WorkflowπŸš€ Starting DevelopmentQuick StartDevelopment ServersπŸ—οΈ Project Structure for DevelopmentDevelopment File TypesπŸ”„ Development Workflow1. Feature Development Cycle2. Adding New Features3. Making ChangesπŸ› DebuggingBrowser DevToolsNext.js DebuggingDatabase Debugging🎯 Development Best Practices1. Component Development2. State Management3. Error HandlingπŸ“± Mobile DevelopmentStarting Mobile DevelopmentMobile vs Web DevelopmentMobile Testing⚑ Performance OptimizationDevelopment PerformanceCode SplittingImage OptimizationπŸ”§ Development ToolsVS Code IntegrationTerminal ProductivityπŸ§ͺ Testing During DevelopmentManual Testing WorkflowAutomated TestingDatabase TestingπŸ” Common Development IssuesTypeScript IssuesHot Reload IssuesDatabase IssuesPerformance Issues🎯 Development ChecklistBefore Starting WorkDuring DevelopmentBefore CommittingCode QualityπŸš€ Next Steps