Skip to content
mikaelaldyPublic

About

Privykids - Ubah Anakmu Jadi Pahlawan Privasi Digital!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PrivyKids

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.

What children can do

  • 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

How it works

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.

Public demo and AI setup

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:

  1. Fork or clone this repository.
  2. Create an Azure OpenAI resource and deploy a chat-capable model in your own Azure account.
  3. Copy .env.example to .dev.vars and add your endpoint, API key, deployment name, and supported API version.
  4. 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.

Run it locally

Use Node.js 20 or newer.

npm install
npm run build

Copy .env.example to .dev.vars, then fill in your Azure OpenAI values. .dev.vars is ignored by Git.

npx wrangler pages dev dist

Wrangler 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-version

Do not add a VITE_ prefix to these names. Vite variables can enter the browser bundle.

Checks

npm run test:run
npm run typecheck
npm run lint
npm run build

The tests cover browser storage, request validation, the Pages Function, Azure failure handling, timeouts, and the minimal browser payload.

Deploy to Cloudflare Pages

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.

Privacy notes

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.

Main tools

  • React 18, TypeScript, Vite, and Tailwind CSS
  • Cloudflare Pages and Pages Functions
  • Azure OpenAI
  • Vitest and jsdom

About

Privykids - Ubah Anakmu Jadi Pahlawan Privasi Digital!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages