Skip to content

Repository files navigation

Swipetris

Like Wordle, but with blocks.
One daily sequence. Same pieces for everyone. Only your best run counts.
Free, no ads, and built for your phone.

Play now

GitHub stars Version MIT license Free with no ads

Swipetris daily game demo

What it is

Swipetris is a mobile-first PWA built around one-thumb controls:

  • Drag to move
  • Tap to rotate
  • Flick down to drop
  • Play the same seeded piece sequence as everyone else each day
  • Submit your best run to the daily arcade leaderboard
  • Install it to your home screen and play offline

There are no accounts, ads, cookies, tracking, or product analytics. Gameplay stays local; only leaderboard requests and score submissions send game data to the Swipetris server.

Stack

  • The game is rendered with three.js in public/app.js
  • The play UI uses Alpine.js in public/play.html
  • Landing-page motion is mostly CSS; the phone demo is driven by public/landing.js
  • Local development runs on Bun and Hono
  • Production is static Cloudflare Pages plus dependency-free Pages Functions
  • Scores are stored in Turso

Generate the brand image

The README lockup is rendered from the landing-page .brand-lockup with Vercel Satori:

bun run generate:brand

This updates public/brand.svg and public/play-button.svg from the brand and CTA markup in public/index.html.

Run locally

Requirements: Bun 1.2 or newer.

git clone https://github.com/bitbonsai/swipetris.git
cd swipetris
bun install
bun run dev

Open http://localhost:3000. Without environment variables, the server creates a local swipetris.db SQLite database.

To use Turso instead:

cp .env.example .env
# Fill in TURSO_URL and TURSO_TOKEN
bun run dev

Careful: a Turso-backed local server writes to that remote database. Use a development database unless you intentionally want to write to production.

Test the Pages deployment locally

cp .env.example .env
bunx wrangler pages dev public

Wrangler serves public/ and loads the routes in functions/api/. The Pages Functions intentionally use the raw libSQL HTTP API and have no npm imports; this repository has no production build step.

Deploy

  1. Create a Turso database and apply schema.sql, for example with turso db shell <database> < schema.sql.
  2. Create a Cloudflare Pages project connected to your fork.
  3. Leave the build command empty and set the output directory to public.
  4. Add TURSO_URL and TURSO_TOKEN in the Pages project settings.
  5. Deploy the main branch.

Cloudflare discovers functions/ automatically. Environment-variable changes only apply to new deployments.

Project layout

public/          Static site, game, PWA assets, and vendored browser libraries
functions/api/   Cloudflare Pages leaderboard endpoints
src/             Bun/Hono local development server and database schema
schema.sql       Production database bootstrap

Leaderboard trust model

Scores are untrusted client input. The API validates payload shape, daily seeds, score plausibility, timing, and submission rate before storing a result. These checks discourage casual abuse; they are not cryptographic proof of gameplay. Production operators should also configure platform-level rate limiting and monitor anomalous scores.

See SECURITY.md for reporting vulnerabilities.

Contributing

Bug reports and focused pull requests are welcome. Read CONTRIBUTING.md before opening a PR.

License

Swipetris is released under the MIT License. Vendored dependencies retain their own licenses; see THIRD_PARTY_NOTICES.md.

This is an independent project and is not affiliated with or endorsed by The Tetris Company. Third-party names and trademarks belong to their respective owners.

About

Gesture-first daily falling-blocks PWA. Swipe, stack, repeat.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages