Real-time serverless chat application frontend built with Next.js 14, TypeScript, and Tailwind CSS for CPSC 465.
Team: Muhammad Shahwar Shamim, Daniel Wright, Ansh Tomar, John-Leon Rivera
Live Application: https://d57e9mww85f95.cloudfront.net
- User Authentication - Sign up, sign in, forgot password with email verification via AWS Cognito
- Real-Time Messaging - Instant message delivery via WebSocket connections
- Friend System - Search users, send/accept/reject friend requests
- AI Content Moderation - Messages flagged for inappropriate content shown with visual indicators
- Message History - Persistent chat history loaded on conversation open
- Multi-Tab Sync - Messages sync across multiple browser tabs
- Responsive UI - Mobile-friendly design delivered globally via CloudFront CDN
| Category | Technology |
|---|---|
| Framework | Next.js 14 (App Router, Static Export) |
| Language | TypeScript (strict mode) |
| Styling | Tailwind CSS |
| State Management | Zustand |
| Authentication | AWS Amplify + Cognito |
| Date Handling | date-fns |
| Build/Deploy | S3 + CloudFront |
| CI/CD | GitHub Actions |
serverless-chat-frontend/
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── layout.tsx
│ │ ├── page.tsx # Redirect to login
│ │ ├── login/page.tsx # Login page
│ │ ├── signup/page.tsx # Sign up page
│ │ ├── forgot-password/ # Password reset flow
│ │ └── chat/page.tsx # Main chat interface
│ ├── components/
│ │ ├── ChatWindow.tsx # Message display
│ │ ├── MessageInput.tsx # Message composer
│ │ ├── Sidebar.tsx # Friends list
│ │ └── ConnectionStatus.tsx
│ ├── lib/
│ │ ├── ws.ts # WebSocket manager
│ │ ├── store.ts # Zustand store
│ │ └── auth.ts # Cognito auth helpers
│ └── types/
│ └── message.ts # TypeScript types
├── .github/workflows/
│ ├── ci.yml # CI: typecheck, lint, build
│ └── deploy.yml # CD: S3 sync, CloudFront invalidation
└── public/
- Node.js 18+
- npm or yarn
- AWS account (for deployment)
- Clone and install:
git clone https://github.com/johnleonrive/serverless-chat-frontend.git
cd serverless-chat-frontend
npm install- Configure environment:
cp .env.example .envEdit .env:
NEXT_PUBLIC_WS_URL=wss://rnf7vtl93i.execute-api.us-east-1.amazonaws.com/prod
NEXT_PUBLIC_API_URL=https://gbctzghf5d.execute-api.us-east-1.amazonaws.com/prod
NEXT_PUBLIC_COGNITO_USER_POOL_ID=us-east-1_OncfX435Y
NEXT_PUBLIC_COGNITO_CLIENT_ID=<your-client-id>- Run development server:
npm run devOpen http://localhost:3000
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run export |
Build and export static site |
npm run typecheck |
Run TypeScript type checking |
npm run lint |
Run ESLint |
Push to main triggers:
- CI workflow - typecheck, lint, build
- Deploy workflow - build, S3 sync, CloudFront cache invalidation
npm run export
aws s3 sync out/ s3://serverless-chat-frontend-676206934447 --delete
aws cloudfront create-invalidation --distribution-id E3OPTSYB9E4RWP --paths "/*"| Resource | Value |
|---|---|
| S3 Bucket | serverless-chat-frontend-676206934447 |
| CloudFront Distribution | E3OPTSYB9E4RWP |
| Domain | d57e9mww85f95.cloudfront.net |
| Cognito User Pool | us-east-1_OncfX435Y |
| Password | |
|---|---|
| [email protected] | Test123! |
| [email protected] | Test123! |
| [email protected] | Test123! |
| [email protected] | Test123! |
| [email protected] | Test123! |
MIT