Prerequisites
Before installing KnowledgeCheckr, ensure you have the following installed:- Docker & Docker Compose (for containerized deployment)
- Node.js 20+ and Yarn (for local development)
- MySQL 8.0+ (if running without Docker)
Quick start with Docker
The fastest way to get KnowledgeCheckr running is using Docker Compose.Configure environment variables
Create a
.env file in the root directory with the required configuration:OAuth providers (GitHub, Google, Dex) are optional. KnowledgeCheckr will automatically disable any provider without complete credentials.
Start the services
Launch all services using Docker Compose:This will start three services:
- db - MySQL database on port 3305
- knowledgeCheckr - Application on port 3000
- dex - OAuth provider on port 5556 (optional)
Docker Compose configuration
Thedocker-compose.yml file defines the complete application stack:
docker-compose.yml
Local development setup
For active development, run KnowledgeCheckr directly with Node.js.Install dependencies
package.json:- Next.js 16 - React framework
- Better Auth - Authentication library
- Drizzle ORM - Database toolkit
- Tailwind CSS - Styling
- Cypress - Testing framework
Set up the database
Start a MySQL database using Docker:Or use your local MySQL installation. Ensure it’s running on port 3305 (or update your
.env).Run database migrations
Generate and push the database schema:The schema is defined in
database/drizzle/schema.ts using Drizzle ORM:database/drizzle/schema.ts
Start the development server
- Turbopack - Fast bundler for development
- Hot reloading - Instant updates on file changes
- i18n preparation - Automatic locale updates
package.json
Environment variable reference
KnowledgeCheckr uses Zod for environment variable validation. All variables are validated at startup.Required variables
| Variable | Type | Description |
|---|---|---|
BETTER_AUTH_URL | URL | Trusted domain for authentication |
NEXT_PUBLIC_BASE_URL | URL | Base URL of the application |
AUTH_SECRET | Base64 | Secret for session encryption |
DATABASE_HOST | String | Database host (IP, URL, or service name) |
DATABASE_PORT | Number | Database port (typically 3306) |
DATABASE_NAME | String | Database name |
DATABASE_USER | String | Database user |
DATABASE_PASSWORD | String | Database password (optional) |
Optional OAuth variables
- GitHub
- Google
- Dex (Custom)
- Go to GitHub Settings → Developer settings → OAuth Apps
- Create a new OAuth App
- Set callback URL:
{BETTER_AUTH_URL}/api/auth/callback/github
Optional application variables
| Variable | Type | Default | Description |
|---|---|---|---|
NEXT_PUBLIC_MODE | Enum | production | Application mode: production, development, or test |
ENABLE_FILE_LOGGING | Boolean | true | Enable Winston file logging |
CAPTURE_CLIENT_LOGS | Boolean | false | Send client-side logs to server |
SHOW_APP_VERSION | Boolean | false | Display version in UI |
Environment validation is performed in
src/lib/Shared/Env.ts using Zod schemas. Missing or invalid variables will prevent the application from starting.Building for production
Create an optimized production build:- Compiles TypeScript to JavaScript
- Optimizes assets with Next.js compiler
- Generates static pages where possible
- Creates standalone output in
.next/standalone/
package.json
Running in production
Start the production server:package.json
Testing
KnowledgeCheckr includes comprehensive test suites:- Cypress for E2E and component testing
- Jest for unit tests
- Code coverage via Istanbul and NYC
Troubleshooting
Database connection errors
If you encounter database connection issues:-
Check the database is running:
-
Verify environment variables:
-
Check database logs:
Port conflicts
If ports 3000 or 3305 are already in use:-
Change application port in
docker-compose.yml: -
Change database port in
docker-compose.yml:
OAuth configuration issues
If OAuth providers aren’t working:- Check environment variables are complete (both ID and SECRET)
- Verify callback URLs match OAuth provider settings
- Check logs for specific error messages:
The application automatically disables OAuth providers with incomplete credentials. Check startup logs for messages about enabled/disabled providers.
Next steps
Create your first check
Follow the quickstart to create your first knowledge assessment
Development guide
Learn about the codebase structure and contributing
API reference
Explore the authentication and data APIs
Deploy to production
Deploy KnowledgeCheckr to your infrastructure