Help & Resources

Stuck? You're in the right place.

πŸš€ Getting Started

This sandbox teaches AI-assisted development by building a real expense tracker. Here's the flow:

  1. Start with Challenge 0 β€” Set up Supabase and your environment
  2. Work through Challenges 1-4 β€” Build the form, database connection, display, and filtering
  3. Finish with Challenge 5 β€” Deploy your app to the internet

Time estimate: 2-3 hours for all challenges

Start Challenge 0 β†’

πŸ†˜ When You're Stuck

Try these in order:

  1. Re-read the instructions β€” 80% of issues come from missing a step
  2. Check Common Issues below β€” Your problem is probably listed
  3. Check the hints β€” In the /hints/ folder for your challenge
  4. Use a rescue prompt β€” Copy from /prompts/ into your AI assistant

πŸ”§ Common Issues

CORS Errors with Supabase β–Ό

Symptom

Console shows: "Access blocked by CORS policy"

Cause

You're opening index.html directly as a file instead of through a local server.

Fix

Use a local server:

  • VS Code: Install "Live Server" extension, right-click β†’ Open with Live Server
  • Python: python -m http.server 8000
  • Node: npx http-server
RLS Policies Blocking Operations β–Ό

Symptom

Insert/select returns { data: null, error: null } β€” no error but no data either!

Cause

Row Level Security is enabled but policies don't allow the operation.

Fix

  1. Go to Supabase Dashboard β†’ Authentication β†’ Policies
  2. Find your expenses table
  3. Ensure policies exist for SELECT and INSERT
  4. If missing, run the policy SQL from schema.sql
Config Not Found β–Ό

Symptom

Console shows: "supabaseConfig is not defined"

Cause

You haven't created your config.js file yet.

Fix

  1. Find config.example.js in the project folder
  2. Make a copy and rename it to config.js
  3. Open config.js in your code editor
  4. Replace YOUR_SUPABASE_PROJECT_URL with your actual URL
  5. Replace YOUR_SUPABASE_ANON_KEY with your actual key
  6. Save the file

Note: config.js is gitignoredβ€”it stays on your computer only and won't be pushed to GitHub.

Dates Display as ISO Strings β–Ό

Symptom

Dates show as 2024-01-15T08:00:00.000Z instead of "Jan 15, 2024"

Cause

The database returns dates in ISO format. You need to format them.

Fix

function formatDate(isoDate) {
  const date = new Date(isoDate + 'T00:00:00');
  return date.toLocaleDateString('en-US', {
    year: 'numeric',
    month: 'short',
    day: 'numeric'
  });
}
Form Refreshes the Page β–Ό

Symptom

When you submit the form, the page reloads and data may or may not save.

Cause

Default form behavior is to submit and reload. You need to prevent this.

Fix

Add event.preventDefault() as the first line in your submit handler:

form.addEventListener('submit', function(event) {
  event.preventDefault();
  // Handle form data with JavaScript
});
Supabase Client Undefined β–Ό

Symptom

supabase is not defined or supabase.from is not a function

Cause

The Supabase library isn't loaded, or scripts are in wrong order.

Fix

Ensure scripts load in this order in your HTML:

<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
<script src="config.js"></script>
<script src="app.js"></script>

And initialize with window.supabase.createClient()

Changes Not Showing After Deploy β–Ό

Symptom

You pushed to GitHub, Vercel says "deployed", but site shows old content.

Fix

  1. Hard refresh: Cmd+Shift+R (Mac) or Ctrl+Shift+R (Windows)
  2. Check Vercel: Dashboard β†’ Deployments β†’ verify your commit deployed
  3. Force redeploy: In Vercel, click "..." β†’ "Redeploy"

πŸ€– Using AI Assistants

When asking for help, give your AI assistant:

  • Context: "I'm working on Challenge 2 of an expense tracker"
  • Your code: Paste the relevant function
  • The error: Copy exact error messages from console
  • What you tried: List your debugging attempts

Check the /prompts/ folder for ready-made rescue prompts you can copy-paste!

πŸ“š Best Practices

  • Design System: Use CSS variables, never hardcode colors
  • Error Handling: Always wrap API calls in try/catch
  • Git: Commit often with meaningful messages
  • Security: Anon keys are safe for frontend; service keys are not

Read CONSTITUTION.md for the full best practices guide.