Niche API Documentation - v0.1.0
    Preparing search index...

    Niche API Documentation - v0.1.0

    Fall2026-CS320-Team6: Niche

    Niche helps computer science majors explore which concentration fits them.

    Stack: Next.js 16 (TypeScript) · Supabase (Postgres, Auth, Row-Level Security) · Zod

    1. Landing page (/): what Niche is, for signed-out visitors.
    2. Sign up / log in (/signup, /login). Any email works; nothing is ever sent.
    3. Survey (/survey): one question per page, required once. The 14 Dreamer OS questions.
    4. Results (/results): your top 3 areas (sample ranking until the path algorithm exists).
    5. Home (/events): events in a masonry grid that loads more as you scroll. Switch Upcoming / Past and filter by area. Bookmark upcoming events, or rate past ones you went to (1-5 stars and a note). Bookmarked and rated events move to your Profile.
    6. Calendar (/calendar): every event on a month grid; click a day or an event.
    7. Profile (/profile): your Bookmarked and Attended events.
    8. Settings (/settings): account and log out.

    Light/dark mode: the moon/sun button in the header (light by default). Events are sample data from supabase/seed.sql (45 events across the semester).

    The UI uses MUI. Colors, fonts and component defaults live in src/theme.ts; the CS concentrations and their colors live in src/lib/paths.ts. Events are tagged with a concentration by keyword for now (guessPath), until the database has a category column.

    Name GitHub
    Meiling Chen meilingchen0
    Joyce Levine umass-jlevine
    August Singh augustlovesyou
    Shrish Kapoor shrish186
    Raunak Pandit rpandit10
    Toby Sol Tobiah0
    Ethan Kuang 24kuange
    Johnathan Santiago Johnathansan

    You need: Node.js 24 and Docker Desktop. Open Docker Desktop and wait until it says it's running.

    In a terminal, inside this repo folder:

    npm install
    
    npm run db:start
    

    The first time downloads about 4 GB and takes a few minutes. When it finishes, run:

    npx supabase status
    

    Copy .env.example to a new file called .env.local and fill in the two values from that output:

    In .env.local Copy from supabase status
    NEXT_PUBLIC_SUPABASE_URL Project URL / API URL (http://127.0.0.1:54321)
    NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY the Publishable key (sb_publishable_…)

    Then:

    npm run db:reset
    
    npm run dev
    

    Open http://localhost:3000 in your browser and sign up with any email, like you@test.local.

    Next time you only need: Docker running, npm run db:start, then npm run dev. When you're done: npm run db:stop.

    Useful local pages
    The app http://localhost:3000
    Database dashboard (Supabase Studio) http://127.0.0.1:54323
    Health check http://localhost:3000/api/health should say {"app":"ok","supabase":"ok"}

    Command What it does
    npm run dev Run the app (auto-reloads on save)
    npm run db:start / db:stop Start / stop the local database
    npm run db:reset Wipe the local database and rebuild it from supabase/migrations
    npm run db:test Run the database security tests
    npm run db:types Regenerate TypeScript types after changing the database
    npm run lint / npm run build Check code style / production build
    src/
    app/
    (auth)/ /login, /signup + their Server Actions
    survey/ /survey: the form + its Server Action
    (app)/ logged-in pages; layout.tsx adds the header and the survey gate
    profile/ /profile
    events/ /events, the event popup (event-card.tsx) and its Server Action
    settings/ /settings
    header.tsx the top bar (Home / Profile / Settings)
    components/ shared UI pieces (logo, transit map, event timeline, theme toggle, toast, links)
    theme.ts MUI theme: colors, fonts, component defaults
    lib/
    survey/questions.ts THE SURVEY QUESTIONS: edit this file to change the survey
    survey/answer-key.ts what each answer means (tags, guidance); server-only
    data/ server-only data functions (each checks who's logged in)
    events.ts loads events + the user's To do/Done/stars/note
    validation/ Zod rules for form input
    supabase/ database connection + generated types
    proxy.ts keeps users logged in; redirects signed-out visitors to /login
    supabase/
    migrations/ database tables, in order
    tests/ database security tests
    seed.sql sample events for local development
    1. npx supabase migration new <short_name> creates a SQL file in supabase/migrations/
    2. Write the SQL. Every table must turn on Row-Level Security and have policies.
    3. npm run db:reset, then npm run db:types
    4. Add tests in supabase/tests/ and run npm run db:test

    Don't change tables by hand in Studio. The migration files are the source of truth.

    • Health check says Supabase is unreachable: is Docker Desktop running? Run npm run db:start.
    • "Missing NEXT_PUBLIC_SUPABASE_URL": create .env.local (see Quick start) and restart npm run dev.
    • Stuck or erroring after npm run db:reset: the reset deleted your account, but your browser is still logged in as it. Clear cookies for localhost (or use a private window), then sign up again.
    • docker or supabase not found right after installing Docker: open a new terminal.