University Final Project (CM3035 Advanced Web Development)
TrueNamePath is an innovative context-aware identity management system that addresses name-based discrimination in digital environments. The system allows users to control how their names are presented to different audiences while maintaining privacy and GDPR compliance.
Many individuals face discrimination based on their names in professional and social contexts. Traditional identity systems present static name information regardless of context, potentially exposing users to bias. This project demonstrates a technical solution that enables dynamic, context-appropriate name presentation while preserving user privacy and control.
The system implements OAuth/OIDC-compliant context-aware name resolution, allowing external applications to receive appropriate name variants based on user-defined contexts and consent preferences. This represents a novel application of existing identity provider patterns to address social discrimination issues.
- Node.js (v18 or later)
- Yarn package manager
- Supabase account access
- Clone the repository
- Install dependencies:
yarn install
- Configure environment variables (see Authentication Setup below)
- Create demo users:
node scripts/create-demo-users.js
- Start development server:
yarn dev
This project uses official Supabase SSR (Server-Side Rendering) patterns for authentication with the @supabase/ssr
package. The system implements cookie-based session management for secure, production-ready authentication. To run the application locally with working authentication, you must first create the required demo users in your Supabase instance.
Create a .env.local
file in the project root with your Supabase project credentials. You'll need to create a Supabase project and obtain these values from your project dashboard.
NEXT_PUBLIC_SUPABASE_URL="https://your-project-id.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-supabase-anon-key"
SUPABASE_SERVICE_ROLE_KEY="your-supabase-service-role-key"
Security Warning: The
SUPABASE_SERVICE_ROLE_KEY
provides administrative access to your Supabase project. Never commit this key to version control or expose it in client-side code.
We have a script that securely creates the demo users using the Supabase Admin API. This script reads your .env.local
file for credentials.
Run the script from the project root:
node ./scripts/create-demo-users.js
Expected Outcome: You should see a success message in your terminal for each user created:
Successfully created user: JJ Adams ([email protected])
Successfully created user: Li Wei ([email protected])
Successfully created user: Alex Reiter ([email protected])
All demo users created successfully.
Troubleshooting:
- Error:
AuthApiError: Database error saving new user
: Verify that yourSUPABASE_SERVICE_ROLE_KEY
in.env.local
is correct and has not been revoked. - Error:
TypeError: fetch failed
: Check your internet connection and ensureNEXT_PUBLIC_SUPABASE_URL
is correct and reachable. - "User already exists" error: Users were created successfully in a previous run - you can proceed to testing.
After creating the demo users, you can test the login flow in the running application.
- Start the development server:
yarn dev
- Navigate to
http://localhost:3000/auth/login
- Use one of the following credentials:
- Email:
[email protected]
, Password:demo123!
- Email:
[email protected]
, Password:demo123!
- Email:
[email protected]
, Password:demo123!
- Email:
Upon successful login, you should be redirected to the /dashboard
.
- After logging in, navigate to
http://localhost:3000/demo
- You should see different names displayed based on the selected audience context
- Try different personas to see how names change contextually
The project includes a comprehensive suite of Playwright tests for the authentication flow. To run them, use the following command:
yarn test:e2e tests/e2e/auth/
This will execute all 7 test files located in the tests/e2e/auth/
directory, covering UI, functionality, and integration scenarios.
Expected: Comprehensive test scenarios should pass, validating the authentication system across multiple browsers.
yarn dev
- Start development servers for all appsyarn build
- Build all packagesyarn test
- Run unit tests for all packagesyarn test:e2e
- Run Playwright end-to-end testsyarn lint
- Lint all packagesyarn format
- Format code with Prettier
yarn test:e2e tests/e2e/auth/
- Run only authentication E2E testsyarn test:e2e:ui
- Run Playwright tests with UI modeyarn test:e2e:headed
- Run Playwright tests in headed mode
This is a monorepo using Turborepo and Yarn workspaces:
apps/web/
- Next.js main application with authentication and dashboardutils/supabase/
- Supabase SSR client utilities (@supabase/ssr
)
apps/demo-hr/
- Demo HR application showcasing professional contextapps/demo-chat/
- Demo chat application showcasing casual contextpackages/database/
- Supabase client and generated typespackages/ui/
- Shared Mantine UI componentspackages/e2e-tests/
- Playwright end-to-end test suitepackages/truename-oauth/
- Shared OAuth integration libraryscripts/
- Utility scripts including demo user creationdocs/
- Project documentation and academic materialssupabase/
- Database migrations and SQL functions
- ✅ Supabase SSR Implementation: Built with official
@supabase/ssr
patterns - ✅ Cookie-Based Session Management: Secure httpOnly cookies for session handling
- ✅ Responsive Login Interface: Professional UI built with Mantine components
- ✅ SSR Client Architecture: Separate browser/server clients for optimal performance
- ✅ Global Authentication Context: Centralized state management
- ✅ Route Protection: Next.js middleware with session validation
- ✅ Comprehensive Testing: End-to-end test coverage for all authentication flows
- ✅ Demo User Management: Automated user creation for testing and demonstration
- ✅ OAuth/OIDC Compliance: Standards-compliant identity resolution
- ✅ User-Defined Contexts: Flexible context system without hardcoded values
- ✅ Privacy-by-Design: GDPR-compliant audit logging and consent management
- ✅ Multi-Persona Interface: Demonstration of different identity presentations
- ✅ RESTful Endpoints: Complete API for names, contexts, and consent management
- ✅ Standardized Responses: JSend format for consistent API responses
- ✅ Secure Authentication: JWT-based API authentication
- ✅ Comprehensive Testing: Full test coverage for all API endpoints
- ✅ HR Application: Professional context demonstration
- ✅ Chat Application: Casual context demonstration
- ✅ OAuth Integration: Complete OAuth flows for external applications
This project was developed as the final project for the Bachelor of Computer Science degree at the University of London (CM3035 Advanced Web Development), demonstrating:
- Modern Web Development: Advanced React/Next.js patterns and TypeScript implementation
- Authentication Systems: Professional-grade authentication and authorization
- Technical Innovation: Novel application of OAuth/OIDC for context-aware identity management
- Quality Assurance: Comprehensive testing strategies and quality assurance practices
- Privacy Engineering: GDPR compliance and privacy-by-design principles
- Full-Stack Development: Complete system from database design to user interface
The project emphasizes technical excellence, innovative problem-solving, and professional software engineering practices suitable for academic evaluation and portfolio presentation.
- Next.js 15 - React framework with App Router
- React 19 - Modern React with concurrent features
- TypeScript - Type-safe development
- Mantine UI - Professional component library
- SWR - Data fetching and caching
- Supabase - PostgreSQL database with real-time features
- PostgreSQL - Relational database with custom functions
- Supabase Auth - Authentication with SSR support
- Playwright - End-to-end testing framework
- Vitest - Unit testing framework
- ESLint & Prettier - Code quality and formatting
- Turborepo - Monorepo build system
- Yarn Workspaces - Package management
- Vercel - Deployment platform for demo applications
To run this project locally, you'll need to:
- Set up a Supabase project and configure environment variables
- Run the database migrations
- Create demo users for testing
- Start the development server
Follow the detailed setup instructions in the Authentication Setup section above for complete configuration steps.
The project includes two deployed demo applications that showcase different identity contexts:
- Demo HR Application: Demonstrates professional identity presentation in corporate environments
- Demo Chat Application: Shows casual identity presentation in social contexts
Both applications integrate with the main TrueNamePath API using OAuth flows to demonstrate context-aware name resolution in real-world scenarios.