Skip to content

Commit 7aad95b

Browse files
Docs (#43)
* WireFrames and Code Snippets * More Snippets * More Report Stuff * Final Fixes * README
1 parent 672e5f2 commit 7aad95b

2 files changed

Lines changed: 101 additions & 84 deletions

File tree

README.md

Lines changed: 94 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# TrueNamePath - Context-Aware Identity Management API
22

3-
**University Final Project (CM3035 Advanced Web Design)**
3+
**University Final Project (CM3035 Advanced Web Development)**
44

5-
## Quick Start
5+
## Overview
66

7-
This project implements a context-aware identity management system where users control how their names are presented to different audiences. The system addresses real discrimination issues while maintaining privacy and GDPR compliance.
7+
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.
8+
9+
### Problem Statement
10+
11+
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.
12+
13+
### Technical Innovation
14+
15+
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.
816

917
## Prerequisites
1018

@@ -26,10 +34,10 @@ This project uses official Supabase SSR (Server-Side Rendering) patterns for aut
2634

2735
### 1. Prerequisites
2836

29-
Ensure you have a `.env.local` file in the project root with the following Supabase environment variables correctly configured. These are required for both the Next.js application and the user creation script.
37+
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.
3038

3139
```env
32-
NEXT_PUBLIC_SUPABASE_URL="https://txfcnjvmkaqzblztkjmr.supabase.co"
40+
NEXT_PUBLIC_SUPABASE_URL="https://your-project-id.supabase.co"
3341
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-supabase-anon-key"
3442
SUPABASE_SERVICE_ROLE_KEY="your-supabase-service-role-key"
3543
```
@@ -90,7 +98,7 @@ yarn test:e2e tests/e2e/auth/
9098

9199
This will execute all 7 test files located in the `tests/e2e/auth/` directory, covering UI, functionality, and integration scenarios.
92100

93-
**Expected**: 125+ test scenarios should pass, validating the authentication system across multiple browsers.
101+
**Expected**: Comprehensive test scenarios should pass, validating the authentication system across multiple browsers.
94102

95103
## Development Commands
96104

@@ -113,93 +121,108 @@ This will execute all 7 test files located in the `tests/e2e/auth/` directory, c
113121

114122
This is a monorepo using Turborepo and Yarn workspaces:
115123

116-
- `apps/web/` - Next.js frontend application with authentication system
117-
- `utils/supabase/` - Official Supabase SSR client utilities (`@supabase/ssr`)
118-
- `packages/database/` - Supabase client and generated types (legacy compatibility)
124+
- `apps/web/` - Next.js main application with authentication and dashboard
125+
- `utils/supabase/` - Supabase SSR client utilities (`@supabase/ssr`)
126+
- `apps/demo-hr/` - Demo HR application showcasing professional context
127+
- `apps/demo-chat/` - Demo chat application showcasing casual context
128+
- `packages/database/` - Supabase client and generated types
119129
- `packages/ui/` - Shared Mantine UI components
120-
- `tests/e2e/` - Playwright end-to-end tests including comprehensive auth testing
130+
- `packages/e2e-tests/` - Playwright end-to-end test suite
131+
- `packages/truename-oauth/` - Shared OAuth integration library
121132
- `scripts/` - Utility scripts including demo user creation
122133
- `docs/` - Project documentation and academic materials
123-
- `.claude/agents/` - AI agent definitions for development workflow
124-
- `.claude/commands/` - Custom slash commands for workflow automation
134+
- `supabase/` - Database migrations and SQL functions
125135

126-
## Core Features Implemented
136+
## Core Features
127137

128-
### Authentication System (Step 8 Complete - 100% Production Ready)
138+
### Authentication System
129139

130-
-**Official Supabase SSR Implementation**: Complete migration to `@supabase/ssr` patterns
131-
-**Cookie-Based Session Management**: Secure httpOnly cookies replacing custom JWT
132-
-**Professional Login Page**: Responsive UI with Mantine components
133-
-**SSR Client Architecture**: Separate browser/server clients (`apps/web/utils/supabase/`)
134-
-**AuthProvider Context**: Global state management with official SSR patterns
135-
-**Next.js Middleware**: Route protection using official `updateSession` pattern
136-
-**AuthGuard Component**: Client-side protection with loading states
137-
-**Comprehensive E2E Testing**: 125+ scenarios across 7 test files
138-
-**Demo User Automation**: Script using Supabase Admin API
139-
-**Backward Compatibility**: Legacy database package integration maintained
140+
-**Supabase SSR Implementation**: Built with official `@supabase/ssr` patterns
141+
-**Cookie-Based Session Management**: Secure httpOnly cookies for session handling
142+
-**Responsive Login Interface**: Professional UI built with Mantine components
143+
-**SSR Client Architecture**: Separate browser/server clients for optimal performance
144+
-**Global Authentication Context**: Centralized state management
145+
-**Route Protection**: Next.js middleware with session validation
146+
-**Comprehensive Testing**: End-to-end test coverage for all authentication flows
147+
-**Demo User Management**: Automated user creation for testing and demonstration
140148

141149
### Context-Aware Name Resolution
142150

143-
- ✅ OAuth/OIDC resolution with ~1.2s end-to-end performance
144-
- ✅ User-defined contexts (not hardcoded)
145-
- ✅ GDPR-compliant audit logging
146-
- ✅ Multi-persona demo interface
151+
-**OAuth/OIDC Compliance**: Standards-compliant identity resolution
152+
-**User-Defined Contexts**: Flexible context system without hardcoded values
153+
-**Privacy-by-Design**: GDPR-compliant audit logging and consent management
154+
-**Multi-Persona Interface**: Demonstration of different identity presentations
147155

148-
### API Layer
156+
### API Architecture
149157

150-
-REST API endpoints (names, consents, audit)
151-
- ✅ JSend format standardization
152-
- ✅ JWT authentication integration
153-
- ✅ Comprehensive API testing
158+
-**RESTful Endpoints**: Complete API for names, contexts, and consent management
159+
-**Standardized Responses**: JSend format for consistent API responses
160+
-**Secure Authentication**: JWT-based API authentication
161+
-**Comprehensive Testing**: Full test coverage for all API endpoints
154162

155-
## AI-Driven Development Workflow
163+
### Demo Applications
156164

157-
This project uses a sophisticated multi-agent AI system for efficient development. The system coordinates specialized agents to handle planning, implementation, testing, and documentation with optimal parallelization.
165+
-**HR Application**: Professional context demonstration
166+
-**Chat Application**: Casual context demonstration
167+
-**OAuth Integration**: Complete OAuth flows for external applications
158168

159-
### Quick Command Reference
169+
## Academic Project Context
160170

161-
Custom slash commands automate the development workflow:
171+
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:
162172

163-
- **`/status`** - Check comprehensive project status
164-
- **`/plan [step]`** - Create detailed implementation plan
165-
- **`/review [plan]`** - Critical review of plans or code
166-
- **`/execute [step]`** - Coordinate implementation with agent deployment
167-
- **`/debug [issue]`** - Investigate and troubleshoot problems
168-
- **`/research [topic]`** - Deep codebase analysis
169-
- **`/document [work]`** - Create professional documentation
173+
- **Modern Web Development**: Advanced React/Next.js patterns and TypeScript implementation
174+
- **Authentication Systems**: Professional-grade authentication and authorization
175+
- **Technical Innovation**: Novel application of OAuth/OIDC for context-aware identity management
176+
- **Quality Assurance**: Comprehensive testing strategies and quality assurance practices
177+
- **Privacy Engineering**: GDPR compliance and privacy-by-design principles
178+
- **Full-Stack Development**: Complete system from database design to user interface
170179

171-
### Example Workflow
180+
The project emphasizes technical excellence, innovative problem-solving, and professional software engineering practices suitable for academic evaluation and portfolio presentation.
172181

173-
```bash
174-
# Standard development flow
175-
/status # Check current state
176-
/plan 9 # Plan Step 9 (signup page)
177-
/review step-09 # Review the plan
178-
/execute 9 # Execute with agent coordination
179-
/document 9 # Document completion
180-
181-
# Troubleshooting flow
182-
/debug login redirect not working
183-
/research authentication middleware
184-
```
182+
## Technologies Used
185183

186-
### Agent System Benefits
184+
### Frontend
187185

188-
- **Parallel Development**: Multiple agents working simultaneously on independent tasks
189-
- **Quality Assurance**: Continuous testing and code review during development
190-
- **Comprehensive Planning**: Detailed analysis before implementation begins
191-
- **Academic Integration**: AI agents understand university project requirements
186+
- **Next.js 15** - React framework with App Router
187+
- **React 19** - Modern React with concurrent features
188+
- **TypeScript** - Type-safe development
189+
- **Mantine UI** - Professional component library
190+
- **SWR** - Data fetching and caching
192191

193-
See **CLAUDE.md** for complete documentation of the agent system, workflow process, and available agents.
192+
### Backend & Database
194193

195-
## Academic Project Context
194+
- **Supabase** - PostgreSQL database with real-time features
195+
- **PostgreSQL** - Relational database with custom functions
196+
- **Supabase Auth** - Authentication with SSR support
197+
198+
### Testing & Quality
199+
200+
- **Playwright** - End-to-end testing framework
201+
- **Vitest** - Unit testing framework
202+
- **ESLint & Prettier** - Code quality and formatting
203+
204+
### DevOps & Tooling
205+
206+
- **Turborepo** - Monorepo build system
207+
- **Yarn Workspaces** - Package management
208+
- **Vercel** - Deployment platform for demo applications
209+
210+
## Getting Started
211+
212+
To run this project locally, you'll need to:
213+
214+
1. Set up a Supabase project and configure environment variables
215+
2. Run the database migrations
216+
3. Create demo users for testing
217+
4. Start the development server
218+
219+
Follow the detailed setup instructions in the Authentication Setup section above for complete configuration steps.
220+
221+
## Demo Applications
196222

197-
This is a university final project demonstrating:
223+
The project includes two deployed demo applications that showcase different identity contexts:
198224

199-
- Advanced web development with modern React/Next.js patterns
200-
- Professional authentication and authorization implementation
201-
- Context-aware identity management innovation
202-
- Comprehensive testing and quality assurance practices
203-
- GDPR compliance and privacy-by-design principles
225+
- **Demo HR Application**: Demonstrates professional identity presentation in corporate environments
226+
- **Demo Chat Application**: Shows casual identity presentation in social contexts
204227

205-
The implementation focuses on academic demonstration rather than production deployment, emphasizing code quality, documentation, and educational value.
228+
Both applications integrate with the main TrueNamePath API using OAuth flows to demonstrate context-aware name resolution in real-world scenarios.

packages/e2e-tests/tests/utils/auth-helpers.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,15 @@ timeout: 10000,
131131
*/
132132
export async function logout(page: Page): Promise<void> {
133133
try {
134-
await page.goto('/dashboard/settings');
135-
136-
await page.waitForLoadState('domcontentloaded');
137-
await page.waitForSelector('[data-testid="tab-settings"]', {
138-
timeout: 30000,
139-
});
140-
141-
let logoutButton = page.getByTestId('sign-out-button');
142-
143-
if (!(await logoutButton.isVisible({ timeout: 2000 }))) {
144-
logoutButton = page.getByRole('button', {
145-
name: /sign out|logout/i,
146-
});
134+
// Ensure we're on a dashboard page where the sign-out button is available
135+
if (!page.url().includes('/dashboard')) {
136+
await page.goto('/dashboard');
137+
await page.waitForLoadState('domcontentloaded');
147138
}
148139

140+
// The sign-out button is in the top navigation, not in any specific tab
141+
const logoutButton = page.getByTestId('sign-out-button');
142+
149143
if (await logoutButton.isVisible({ timeout: 5000 })) {
150144
await logoutButton.click();
151145

0 commit comments

Comments
 (0)