A demo intranet application showcasing Nhost's capabilities with modern web technologies. This project demonstrates department management, file sharing, knowledge base, and AI assistant features.
- Frontend: React 19 + TypeScript
- Backend: Nhost (GraphQL, PostgreSQL, Authentication, Storage, AI Assistant)
- UI: shadcn/ui + Tailwind CSS v4
- State Management: React Query + React Context
- Runtime: Bun
-
Clone and install dependencies:
bun install
-
Copy secrets template:
cp .secrets.example .secrets
-
Start the development environment:
make dev-env-up
-
Start the frontend:
bun run dev
The application will be available at http://localhost:3000
This demo comes with pre-populated mock data including users, departments, and content. To sign in locally:
- Use any mocked user email (see
MOCKED_USERS.md
for available users) - Check the OTP code at https://local.mailhog.local.nhost.run
- Enter the OTP to complete authentication
When connected to Nhost Cloud:
- Seed data first (see "Seeding Cloud Data" section below)
- Use the impersonation script (see "User Impersonation for Testing" section)
- Sign in with updated emails using any password
To enable the AI assistant feature:
-
Configure your secrets: Edit
.secrets
file with your API keys and configuration -
Start with AI support:
make dev-env-up-ai
-
Start the frontend:
bun run dev
To connect the frontend to your Nhost Cloud project instead of the local development environment:
- Create an
.env.local
file in the project root if it doesn't exist:touch .env.local
- Set your Nhost Cloud project details in
.env.local
:BUN_PUBLIC_NHOST_SUBDOMAIN=your-project-subdomain BUN_PUBLIC_NHOST_REGION=your-project-region
- Start the frontend:
bun run dev
The application will automatically connect to your cloud project using these environment variables.
To populate your Nhost Cloud project with demo data:
export NHOST_ADMIN_SECRET="your-admin-secret"
export NHOST_SUBDOMAIN="your-subdomain"
export NHOST_REGION="your-region"
# Apply database seeds
nhost dev hasura seed apply \
--admin-secret $NHOST_ADMIN_SECRET \
--endpoint https://$NHOST_SUBDOMAIN.hasura.$NHOST_REGION.nhost.run \
--database-name default
# Configure AI assistant (optional)
bun run scripts/configure-assistants.ts
For development and testing purposes, you can impersonate any user using the email update script:
# Run the impersonation script
bun run update-emails
How it works:
- Enter your email (e.g.,
developer@company.com
) - Script updates all user emails to format:
developer+original.username@company.com
- Sign in using any of the updated emails (you will receive OTPs at your email)
Example:
- Original user:
john.doe@acme.corp
- Your email:
developer@company.com
- New impersonation email:
developer+john.doe@company.com
- Departments: Create and manage organizational departments
- File Management: Department-based file sharing system
- Knowledge Base: Centralized information repository
- Dashboard: Overview of department activities
- AI Assistant: Smart assistant for enhanced productivity (optional)
The application implements a role-based access control system:
- Member: Can view department information, files, and knowledge base entries
- Manager: Can edit department details, manage members, and modify department content
- Users belong to departments with specific roles (member/manager)
- JWT claims carry department memberships:
x-hasura-departments
andx-hasura-department-manager
- All operations are validated both client-side and server-side
- File sharing and knowledge base access are scoped to department memberships
- Email + OTP: Traditional email-based authentication with one-time codes
- WebAuthn/Passkeys: Modern passwordless authentication with biometrics/security keys
- Multi-factor Options: Users can register multiple authentication methods
- Linting & Formatting:
bun run check
- GraphQL Codegen:
bun run build:codegen
- Production Build:
bun run build
For detailed development guidelines, see CLAUDE.md
.