PrivyKids is a small digital safety academy for Indonesian children aged 8 to 12. It teaches privacy through short quizzes, two browser games, and Privacy Pal, an AI chat assistant that stays focused on online safety.
The project was one of four winners of Microsoft Online Hackathon 2025: elevAIte with Dicoding and received 10,000 Dicoding points. The winners page does not rank the four projects, so this repository does not claim a placement.
- Work through quizzes about personal information, phishing, passwords, and social media
- Play Benteng Kata Sandi and Bagikan atau Lindungi
- Ask Privacy Pal questions in Indonesian
- Earn points and badges without creating an account
Cloudflare Pages serves the React app. The browser stores learning progress, achievements, streaks, and chat history in local storage. A Pages Function at /api/chat validates each chat request and calls Azure OpenAI with credentials that stay on the server.
Browser
|-- React app
|-- local storage for progress and chat history
|
+-- POST /api/chat
|-- request validation
|-- server-owned safety prompt
+-- Azure OpenAI
The chat request contains only the current message and up to four recent messages:
{
"message": "Bagaimana cara membuat kata sandi yang aman?",
"history": [
{
"role": "assistant",
"content": "Kita bisa mulai dari panjangnya."
}
]
}It does not send learning progress, browser identifiers, or the full chat history.
The public demo includes the lessons, games, progress tracking, and the Privacy Pal interface. It does not include shared Azure OpenAI credentials, so Privacy Pal shows a short unavailable message instead of generating a reply.
If you want to test the complete chat flow, bring your own Azure OpenAI resource and deployment:
- Fork or clone this repository.
- Create an Azure OpenAI resource and deploy a chat-capable model in your own Azure account.
- Copy
.env.exampleto.dev.varsand add your endpoint, API key, deployment name, and supported API version. - Run the project through Wrangler so the React app and Pages Function are available together.
The rest of PrivyKids works without Azure OpenAI. Provider credentials are optional unless you want generated Privacy Pal replies.
Use Node.js 20 or newer.
npm install
npm run buildCopy .env.example to .dev.vars, then fill in your Azure OpenAI values. .dev.vars is ignored by Git.
npx wrangler pages dev distWrangler serves the built app and the Pages Function together. The default local address is usually http://localhost:8788.
The function reads these server-side values:
AZURE_OPENAI_ENDPOINT=https://YOUR_RESOURCE_NAME.openai.azure.com
AZURE_OPENAI_API_KEY=replace-with-your-server-side-key
AZURE_OPENAI_DEPLOYMENT=replace-with-your-deployment-name
AZURE_OPENAI_API_VERSION=replace-with-your-supported-api-versionDo not add a VITE_ prefix to these names. Vite variables can enter the browser bundle.
npm run test:run
npm run typecheck
npm run lint
npm run buildThe tests cover browser storage, request validation, the Pages Function, Azure failure handling, timeouts, and the minimal browser payload.
For a Git-based Pages project, use npm run build as the build command and dist as the output directory. Add AZURE_OPENAI_API_KEY as a secret. Add the endpoint, deployment, and API version as server-side environment variables for both preview and production.
Production should also have a Cloudflare rate limiting rule for /api/chat. The intended limit for this project is 10 requests per minute for each IP address.
PrivyKids does not have user accounts or a server database. Its own code does not store chat messages on the server. Browser data stays on the current device until the browser or the user clears it.
Messages sent to Privacy Pal are processed by Azure OpenAI. Azure's processing and retention depend on the Azure account and service policy. Children should not enter names, addresses, school details, phone numbers, passwords, locations, or account information.
This is an educational project, not a compliance certification. It does not claim COPPA compliance or promise that third-party services never retain request data.
- React 18, TypeScript, Vite, and Tailwind CSS
- Cloudflare Pages and Pages Functions
- Azure OpenAI
- Vitest and jsdom