A prototype full-stack social application built with Next.js 15, Auth.js , and TypeScript. It features a hybrid authentication system, real-time messaging, and community engagement tools.
Table of Contents
This repository contains the frontend portion of the CF Platform, a dedicated social space for the child-free community. It connects with a NestJS backend to provide a secure and interactive user experience.
The application leverages a Hybrid Session Architecture:
- Social Login: Google OAuth is managed by Auth.js (NextAuth v5).
- Credentials: Email/Password login is handled directly by the NestJS backend.
- Session Bridge: A specialized bridging mechanism synchronizes the NextAuth session with the backend's cookie-based HTTP-only session, to ensure a unified state across the app.
- Community Groups: Discover, create, and join interest-based groups to connect with like-minded individuals.
- Events & Meetups: Browse upcoming local and virtual events, create new ones, and manage RSVPs.
- Real-Time Messaging: Instant private messaging powered by Socket.io, featuring read receipts and live updates.
- Customizable Profiles: Users can edit their bio, location, and interests, and view their event/group history.
- Secure Authentication: Robust protection using JWTs and secure session cookies.
This project is built with a modern, type-safe, and performant technology stack.
- Next.js
- React
- TypeScript
- Auth.js
- SWR - for data fetching
- Socket.io Client - Real-time event-based communication
- TailwindCSS
- Shadcn UI
- Cypress - End-to-End Testing
To get a local copy up and running, follow these steps.
You must have Node.js 22 (or higher) and npm installed on your machine.
npm install npm@latest -g- Clone the repo
git clone https://github.com/sbassong/cf-platform-frontend.git
- Navigate into the project directory
cd cf-platform-frontend - Install NPM packages
npm install
This project requires several environment variables to run. Create a file named .env.local in the root of your project and add the following variables.
# Auth.js (NextAuth.js) Secret
# A long, random string used to encrypt the session JWT.
# Generate one with: openssl rand -base64 32
AUTH_SECRET="your-super-secret-string-for-next-auth"
# Google OAuth Credentials
# Get these from your project in the Google Cloud Console.
GOOGLE_CLIENT_ID="your-google-client-id.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# Auth.js (NextAuth.js) Configuration
# The canonical URL of your Next.js application. Required for OAuth redirects.
NEXTAUTH_URL="http://localhost:3000"
# Backend API URL
# The URL for your corresponding NestJS backend service.
NEXT_PUBLIC_LOCAL_BACKEND_URL="http://localhost:3001"Once the environment variables are set, you can run the development server:
npm run devOpen http://localhost:3000 with your browser to see the result. The page will auto-update as you edit the files.
This project uses Cypress for end-to-end (E2E) testing to ensure the reliability of key user flows.
The E2E test suite currently covers:
- Authentication: Sign-in/Sign-up (Credentials & OAuth), Sign-out, and Session Bridging.
-
Start the development server:
npm run dev
-
Open the Cypress Test Runner: In a separate terminal window, run:
npx cypress open
-
Select E2E Testing, choose your browser, and run the desired spec files.
/auth.ts: Configures Auth.js providers and callbacks.src/app/context/AuthContext.tsx: Provides a globaluseAuthhook that unifies NextAuth and Backend sessions into a single user object.src/app/(auth)/bridge: HHndles the synchronization of Google OAuth sessions with the backend database.
- SWR: Used throughout the application (e.g.,
useSWR('/events', fetcher)) for efficient, cached, and optimistic UI updates. src/lib/api.ts: Contains the corefetcherand API utility functions.
src/hooks/use-messaging-socket.ts: A custom hook that manages the Socket.io connection, handling events likesendMessageandreceiveMessagefor the chat functionality.
The following features have been implemented or are planned:
- User Authentication (Google & credentials)
- User Profile Editing (Bio, location, Interests)
- Events System (Create, View, Attend)
- Groups & Communities (Create, Join, Post)
- Real-time Chat (live messaging)
- Advanced moderation tools
- Push Notifications
- Mobile-responsive optimizations
- Mobile app migration
Distributed under the MIT License. See LICENSE.txt for more information.
Samuel Bassong – sam.bassong@gmail.com - linkedin.com/in/sambassong