A greenfield Next.js 15 application for phase one of the AMBI personality survey flow:
- intro page at
/ - survey chooser at
/surveys, with the AMBI personality survey at/surveys/personality - legacy
/personalitysurveyand/surveypaths preserved as compatibility redirects - per-question violin plot revealed after every answer
- account-based autosaved drafts plus final submission
- scored dashboards at
/surveys/personality/dashboardand/surveys/values-beliefs/dashboard, with legacy dashboard redirects preserved
- Next.js 15 App Router
- TypeScript
- Tailwind CSS v4
- Supabase Postgres via
DATABASE_URL - Vitest + Testing Library
- Playwright
- Copy
.env.exampleto.env.local. - Keep
SURVEY_STORAGE=memoryfor local contributor work without a database, or setDATABASE_URLto your Supabase Postgres connection string and useSURVEY_STORAGE=postgres. - Add your WorkOS AuthKit keys (
WORKOS_API_KEY,WORKOS_CLIENT_ID) when you need to test authenticated survey flows. GenerateWORKOS_COOKIE_PASSWORDvianode -e "console.log(require('crypto').randomBytes(32).toString('base64url'))". - In the WorkOS dashboard, add
http://localhost:3000/callbackas an allowed redirect URI and enable the social providers (GitHub, Google, LinkedIn) plus email/password under AuthKit. - Run
pnpm install. - Start the app with
pnpm dev.
Do not commit .env.local or any other file containing real credentials. The committed .env.example file is intentionally limited to empty placeholders.
If DATABASE_URL is omitted, the app automatically falls back to in-memory storage. That mode is useful for local UI work and automated tests, but it is not durable and should not be used for real survey data.
If the WorkOS keys are missing, the public home page still loads, but protected survey routes will redirect to the home page until auth is configured.
The canonical schema lives in db/schema.sql. Survey data is stored in:
survey_submissionsfor draft and submitted survey sessions keyed by the WorkOSuser_idsurvey_answersfor one normalized row per answered question per submission
The Postgres repository bootstraps these tables automatically on first use, so a Supabase Postgres database can be used without a separate migration step.
pnpm devstarts the Next.js dev serverpnpm lintruns ESLintpnpm testruns unit tests with coveragepnpm test:e2eruns the Playwright flow against an in-memory local server
- Response plots are seeded demo distributions in this MVP, not real respondent microdata.
- The item order and AMBI question IDs are aligned to Appendix A of Yarkoni (2010).
- Appendix-backed AMBI audit details and summary-level exceptions are documented in docs/ambi-paper-audit.md.
- Survey item, audit, and scoring data committed to this repository are limited to public/licensable source material intended for contributor visibility.