This repository contains the code for the KnowAll.ai website, an AI consultancy specializing in agent development, Microsoft Copilots, and Bitcoin-powered value-for-value transactions.
- Modern, responsive design with dark mode
- Interactive AI chat assistant powered by OpenAI's GPT-4o
- Speech recognition for voice input in the chat interface
- Sections highlighting KnowAll.ai's services and projects
- Information about Zapp.ie, an open-source platform for Bitcoin microtransactions
- Details about Microsoft Copilot development and multi-agent teams
- Next.js: React framework with App Router
- TypeScript: For type-safe code
- Tailwind CSS: For styling
- shadcn/ui: Component library
- OpenAI API: For the chat assistant
- Vercel: For deployment
- Node.js 22.x or later
-
Clone the repository:
git clone https://github.com/knowall-ai/website.git cd website -
Install dependencies:
npm install
-
Create a
.env.localfile in the root directory and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_here -
Start the development server:
npm run dev
-
Open http://localhost:3000 in your browser to see the website.
For local development, create a .env.local file in the root directory with the following variables:
OPENAI_API_KEY=your_openai_api_key_here
ADMIN_API_KEY=your_admin_api_key_here
Make sure to replace the placeholder values with your actual API keys.
If you're experiencing issues with the chat functionality not responding:
- Verify that your OpenAI API key is valid and has sufficient quota
- Check the browser console for any API-related errors
- Ensure the API key is correctly set in your environment variables
- For local development, restart the development server after updating the
.env.localfile
The website uses Playwright for end-to-end testing to ensure key functionality works as expected.
To run all tests:
npm run testPlaywright provides a UI mode that allows you to visualize test execution and debug tests interactively.
Let's add this to our package.json scripts:
npm run test:uiThis will open the Playwright UI interface in your browser where you can:
- Run specific tests or test files
- See test executions in real-time
- View and debug test steps
- Examine test reports with screenshots
To see the browser window during test execution:
npm run test:headedTests are organized in the tests directory and follow the naming convention [feature-name].spec.ts.
Each test file focuses on a specific feature or requirement from the /docs/requirements.yaml file.
To create a new test file:
- Create a new TypeScript file in the
testsdirectory - Import the Playwright test utilities
- Write your test cases based on requirements
- Run the tests to verify they work as expected
The website is deployed on Azure App Service. Any push to the master branch will trigger a new deployment via GitHub Actions.
The deployment uses the following environment variables that must be set in the GitHub repository secrets:
AZURE_CREDENTIALS: The Azure service principal credentials for deploymentAZURE_RESOURCE_GROUP: The name of the Azure resource groupOPENAI_API_KEY: Your OpenAI API key for the chat functionalityADMIN_API_KEY: Your admin API key for accessing the chat logs in production
These secrets are configured in the GitHub repository under Settings > Environments > Production - Azure.
The GitHub Actions workflow (.github/workflows/azure-app-service.yml) configures these environment variables for the deployed application.
The following environment variables need to be set in the "Production - Azure" GitHub environment:
AZURE_CREDENTIALS: The Azure service principal credentials for deploymentAZURE_RESOURCE_GROUP: The name of the Azure resource groupOPENAI_API_KEY: Your OpenAI API key for the chat functionalityADMIN_API_KEY: Your admin API key for accessing the chat logs in production
- Make your changes locally
- Commit and push to the master branch:
git add . git commit -m "Your commit message" git push origin master
- GitHub Actions will automatically build and deploy the site to Azure
- You can monitor the deployment in the Actions tab of your GitHub repository
app/: Next.js App Router pages and API routescomponents/: Reusable React componentspublic/: Static assets like imagestypes/: TypeScript type definitionshooks/: Custom React hookslib/: Utility functions
ConversationInterface: Interactive chat interface with speech recognitionServiceCard: Cards displaying KnowAll.ai's servicesBackgroundImage: Component for handling background images with loading statesLogo: KnowAll.ai logo with dark mode supportHeaderandFooter: Site navigation and information
The website includes a comprehensive chat logging system that records all conversations between users and the AI assistant. This helps in monitoring user interactions and improving the assistant's responses over time.
- Every chat interaction is automatically logged to a JSON file stored in a
logsdirectory at the root of the project - Each log entry includes the user message, assistant response, timestamp, and user metadata
- Logs can be accessed through a secure admin interface
To view the chat logs:
- Visit
/admin/logsin your browser - Authenticate with your admin API key
- Browse through the conversation history
The logs admin interface is protected with API key authentication. Make sure to set a secure ADMIN_API_KEY in your environment variables.
The KnowAll.ai website follows security best practices for handling API keys:
-
Server-Side API Calls: All calls to external APIs (like OpenAI) are made from server-side API routes, never from the client side. This ensures API keys are never exposed to users.
-
Environment Variables: API keys are stored as environment variables:
- Development:
.env.localfile (not committed to the repository) - Production: GitHub Secrets and Azure Static Web Apps configuration
- Development:
-
Authentication for Admin Features: The admin interface (chat logs) is protected with a separate
ADMIN_API_KEYthat is different from the OpenAI API key. -
No Client-Side Exposure: The architecture ensures that sensitive keys are never:
- Included in client-side JavaScript bundles
- Exposed in browser network requests
- Visible in the application source code
- Rate Limiting: The API routes implement basic rate limiting to prevent abuse
- Error Handling: Errors are logged server-side but only generic messages are returned to clients
- Input Validation: All user inputs are validated before processing
- Secure Headers: API responses use appropriate security headers
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ │ │ │ │ │
│ Browser │──────▶ Next.js │──────▶ OpenAI │
│ Client │ │ API Route │ │ API │
│ │ │ │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
│
│
┌──────▼──────┐
│ │
│ Chat Logs │
│ Storage │
│ │
└─────────────┘
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
KnowAll.ai - hello@knowall.ai
Project Link: https://github.com/knowall-ai/website