Docs›Tutorials

Bring your game

Already have a web game? codetik init sets it up as a tik where it is, and an agent with the codetik skill can do the rest of the port.

How it works

You keep your repo, your editor and git. Codetik does not take your build output: codetik publish uploads your source, Codetik builds it with its own Vite setup, checks it and serves it in the feed. So the project has to fit the tik layout and the rules in How a tik works.

Two tools do most of the work: codetik init sets the project up and lists what to change, and the codetik agent skill can make those changes for you. You need the CLI and an API key first, see the Quickstart.

The fast way: let an agent port it

Shell
$ codetik skill

Then, in the project folder, ask your coding agent. In Claude Code that is /codetik init; in Codex or Cursor, say "publish this project as a Codetik tik". The agent asks before it runs codetik init, then works through every finding with the skill's port guide, runs codetik check until it passes, opens the game in a headless browser to check it on a phone-sized screen, and pushes a draft for you to try. See Using an agent.

1. Run codetik init

Shell
$ cd my-game$ codetik init

codetik init turns the project into a tik where it is:

  • Reads the layout: the entry page, the build tool (Vite or another), the build configs Codetik will ignore, the libraries Codetik serves and the ones it does not.
  • Creates tik.yaml with a title from package.json or the folder, and registers the tik on your account. --offline skips the registration until the first publish.
  • Adds src/tik.d.ts, the window.tik types.
  • Moves the shared libraries (Phaser, PixiJS, three.js, React and the rest) from dependencies to peerDependencies at Codetik's version, after asking. A new major version is flagged, since the code will need changes.
  • Writes AGENTS.md and CLAUDE.md, the brief for coding agents. If you already have either, it asks before adding the brief to it.
  • Lists what still has to change: the same findings codetik check gives.

--yes answers its questions for scripts and agents. It runs once per project: a no is not asked again, and codetik check keeps listing the libraries until they move. It never rewrites your code or moves your files.

2. Fix what it lists

my-game/Text
my-game/├─ index.html     # entry: <script type="module" src="/src/main.ts">├─ src/           # all code: ts, js, tsx, json, css, glsl, svg├─ public/        # images, audio, fonts, data, served from the root├─ package.json   # libraries go in peerDependencies├─ tsconfig.json  # optional, must not extend files outside the folder├─ tik.yaml       # written by codetik init; never shipped└─ tik.webp       # 512×512 logo, needed to go live

A file in public/ is served from the root: public/sfx/hit.mp3 is /sfx/hit.mp3. Nothing else ships. Run codetik check after each fix; the list shrinks as you go.

  • No index.html at the root. Move it there from public/ or src/ and point its script at your entry module.
  • A script the build does not bundle. The page loads one module, <script type="module" src="/src/main.ts">, which imports the rest. Classic <script src> files only work from public/.
  • A build config is not used. Your vite.config, webpack, postcss or Tailwind config never runs: Codetik builds with its own Vite. Move what you relied on into code; plain CSS and CSS imports work.
  • A library Codetik does not serve. Nothing is npm installed into a tik, so the import cannot resolve, and listing it in peerDependencies fails the build. Copy what you use into src/, or drop it. codetik manifest lists the shared libraries.
  • Code imported from a URL. A CDN import (https://esm.sh/...) never loads in a tik. Use the shared library, or copy the code into src/.
  • Media imported from src/. Images and audio imported from src/ (import hero from './hero.png') do not ship. Move them to public/ and use absolute paths (/assets/hero.webp). Use webp for images and small mp3s for audio.
  • Network. A tik has no network. Bundle fonts, scripts and data into public/; online scores and multiplayer move to the backend.
  • A file over 512 KB. One file is capped at 512 KB: split generated data, shrink media.
  • WebAssembly. .wasm files do not ship, so Unity, Godot and Emscripten exports cannot run as a tik.
  • Phone screen. Portrait, full screen, touch only. Swap keyboard and mouse controls for gestures on the play area (pointer events), never an on-screen D-pad. Design for 390×844 and use height: 100%.

Pause off screen

The feed loads tiks before they are on screen, so the game must start only when it is visible and pause when it leaves. codetik check warns when a loop or sound never does. window.tik is there before your code runs.

TypeScript
if (tik.visible()) start();tik.on('visible', start);tik.on('hidden', pause);

With Phaser 3 that is game.resume() and game.pause(); with PixiJS, start() and stop() on both app.ticker and Ticker.system; with three.js, renderer.setAnimationLoop(). Pause audio and timers too.

3. Preview and publish

Shell
$ codetik dev$ codetik publish$ codetik set --visibility unlisted$ codetik publish --live
  • codetik dev runs the game in a phone frame with the real window.tik.
  • A draft builds on Codetik and reaches nobody. Open it from Drafts in the Codetik app to try it on your phone.
  • --live releases at the visibility in tik.yaml: public (the feed), unlisted (on your profile and by link) or private (only you). It asks for a category the first time.
  • Every release goes through a check: Codetik's agent removes unused files and fixes build and type errors. The CLI asks before it writes those edits back into your repo.
Public is one way from the CLI

Once a tik is public, the CLI cannot republish, change or delete it. Release it as unlisted or private first; those you can republish as often as you like.