Skip to main content

Local Development Setup

This guide walks you through setting up Pawtograder for local development.

Prerequisites

Before starting, ensure you have the following installed:

Quick Start (Staging Backend)

The fastest way to get started is using our staging environment as a backend. This is ideal for frontend development that doesn’t require database changes.

Steps

  1. Clone the repository
  2. Install dependencies
  3. Configure environment
    Edit .env.local and fill in your own values if needed.
  4. Start the development server
  5. Access the application Open https://localhost:3000 in your browser. You’ll need to accept the self-signed certificate warning (HTTPS is required for camera/microphone access in the help queue).

Creating Test Accounts

In the staging environment, you can register with any email without confirmation:
  • Student account: Use any email (e.g., test@example.com)
  • Instructor account: Include “instructor” in your email (e.g., testinstructor@example.com)
New accounts are automatically added to the demo class.

Full Local Setup (Supabase)

For development requiring database changes, RLS policy modifications, or running E2E tests, you’ll need a local Supabase instance.

Prerequisites

  • Docker installed and running
  • Node.js v22 or later

Setup Steps

  1. Install dependencies
  2. Start Supabase
    This starts all Supabase services in Docker containers. First run may take several minutes to download images.
  3. Initialize the database
    This applies all migrations and seeds initial data.
  4. Configure environment variables After supabase start, you’ll see output like:
    Update your .env.local:
    Never expose SUPABASE_SERVICE_ROLE_KEY to the browser or commit it to version control. Keep it in server-only code and CI secrets.
  5. Start Edge Functions
  6. Start the development server
  7. Seed test data (optional)
    This creates a test class with students and assignments. Scroll up in the output to find “Login Credentials” with email/password pairs.
The build process now runs in GitHub Actions for continuous integration. Local development uses npm run dev for hot-reloading without requiring a separate build step.

Local Services

Once Supabase is running, these services are available:

Supabase Studio

Access the Supabase dashboard at http://localhost:54323 to:
  • Browse and edit database tables
  • View and manage auth users
  • Test RLS policies
  • Monitor realtime subscriptions
  • Manage storage buckets

Email Testing

View captured emails at http://localhost:54324. Useful for testing:
  • Authentication flows (magic links, password reset)
  • Notification emails
  • Email verification

CI/CD Pipeline

Pawtograder uses GitHub Actions for continuous integration and deployment. The build process was migrated from Coolify to GitHub Actions to improve reliability and reduce test flakiness.

Build Process

The CI pipeline runs on every push and pull request, executing:
  1. Dependency Installation: Installs npm packages and system dependencies
  2. Type Checking: Validates TypeScript types across the codebase
  3. Linting: Runs ESLint to enforce code quality standards
  4. Unit Tests: Executes Jest test suites
  5. E2E Tests: Runs Playwright tests against a test environment
  6. Build: Compiles the Next.js application

Running CI Checks Locally

Before pushing code, run the same checks that CI will execute:
See the MCP server guide for details on the AI assistance endpoint exposed at http://127.0.0.1:54321/mcp.

Development Commands

Daily Development

Database Operations

Testing

Build and Deployment

Seeding Data

CLI Operations

The CLI provides commands for classes, assignments, surveys, flashcards, rubrics, submissions, and repository maintenance. Use --help on any command for detailed options. Repository operations use local SSH git for student repo writes.

Project Structure

Environment Variables

Required Variables

Optional Variables

Troubleshooting

Supabase won’t start

  1. Ensure Docker is running
  2. Check for port conflicts (54321, 54323, 54324)
  3. Try stopping and removing containers:

Database connection errors

  1. Verify Supabase is running: npx supabase status
  2. Check .env.local has correct URLs and keys
  3. Ensure you ran npx supabase db reset after starting

TypeScript errors after schema changes

Regenerate types after any database changes:

HTTPS certificate warnings

The dev server uses a self-signed certificate. This is expected:
  • Click “Advanced” → “Proceed to localhost”
  • Or add an exception in your browser settings

Edge Functions not working

  1. Ensure functions are running: npx supabase functions serve
  2. Check the terminal for function errors
  3. Verify function URLs in your requests

Hot reload not working

  1. Check for file system watcher limits (Linux):
  2. Restart the dev server

Cursor Agent Development

Pawtograder includes a Cursor agent development environment that lets AI assistants help with development tasks. Configuration files live in the .cursor directory and cover:
  • Development container settings
  • Code style and formatting rules
  • Project-specific AI assistant guidelines
For Cursor Cloud-specific setup instructions, see the AGENTS.md file in the repository root. It covers Docker daemon configuration for cloud environments, Supabase migration workarounds, environment variable setup, pre-commit formatting requirements, and build/test commands.

Next Steps

  • Read the Surveys Developer Guide for feature-specific documentation
  • Join the development discussion on GitHub Issues