|
1 | | -# postbox_game |
| 1 | +# The Postbox Game |
2 | 2 |
|
3 | | -Find postboxes for megapoints |
| 3 | +**Find postboxes. Claim them. Score mega points.** |
4 | 4 |
|
5 | | -## Getting Started |
| 5 | +A location-based game that turns real-world UK postboxes into collectible targets. Discover postboxes near you, visit them in person to claim them, and climb the leaderboard. Different postbox eras (e.g. EIIR, GR, VR) award different point values, so hunting for rarer boxes pays off. |
6 | 6 |
|
7 | | -This project is a starting point for a Flutter application. |
| 7 | +--- |
8 | 8 |
|
9 | | -A few resources to get you started if this is your first Flutter project: |
| 9 | +## Overview |
10 | 10 |
|
11 | | -- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) |
12 | | -- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) |
| 11 | +The Postbox Game is a Flutter mobile app backed by Firebase. Players sign in, use **Nearby Postboxes** to see how many postboxes are in range and in which direction (compass-style), then use **Claim Postbox** when they’re at a postbox to claim it and earn points. Progress is stored in Firestore; friends and **Leaderboard** screens let you compare scores. A first-run intro introduces Postman James and the rules; settings cover sign out, distance units, and replaying the intro. |
13 | 12 |
|
14 | | -For help getting started with Flutter, view our |
15 | | -[online documentation](https://flutter.io/docs), which offers tutorials, |
16 | | -samples, guidance on mobile development, and a full API reference. |
| 13 | +--- |
| 14 | + |
| 15 | +## How it works |
| 16 | + |
| 17 | +1. **Find** — Open *Nearby Postboxes*, allow location, and see counts and a fuzzy compass for postboxes around you (no turn-by-turn navigation; exploration is part of the game). |
| 18 | +2. **Claim** — When you’re at a postbox, open *Claim Postbox*, refresh location, then tap *Claim postboxes here*. The backend records your claim and awards points based on the postbox type. Daily streaks are tracked for extra motivation. |
| 19 | +3. **Compete** — Add friends and check the leaderboard to see who’s ahead. |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Features |
| 24 | + |
| 25 | +- **Auth** — Sign in with Google or email; route guards keep protected screens (Nearby, Claim) for signed-in users only. |
| 26 | +- **Nearby** — Cloud Function returns postbox counts and compass buckets for a given location and radius. |
| 27 | +- **Claim** — Cloud Function `startScoring` records claims for the authenticated user and updates points; optional daily streak. |
| 28 | +- **Friends & leaderboard** — Firestore-backed social and rankings. |
| 29 | +- **Intro** — First-run cinematic with Postman James; replayable from Settings. |
| 30 | +- **Settings** — Sign out, replay intro, distance units (meters/miles), and About. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## Tech stack |
| 35 | + |
| 36 | +- **App:** Flutter (Dart 3), BLoC for auth state, Firebase Auth, Firestore, Cloud Functions (callables). |
| 37 | +- **Backend:** Firebase (Auth, Firestore, Cloud Functions in TypeScript). Postbox data sourced from OpenStreetMap-style geometry (UK). |
| 38 | +- **Local:** `shared_preferences` for first-run intro and app preferences (e.g. distance units). |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Getting started |
| 43 | + |
| 44 | +### Prerequisites |
| 45 | + |
| 46 | +- [Flutter](https://flutter.dev/docs/get-started/install) (SDK >=3.0.0) |
| 47 | +- A Firebase project with Auth, Firestore, and Cloud Functions enabled |
| 48 | +- `firebase_options.dart` (or equivalent) configured for your project |
| 49 | + |
| 50 | +### Run the app |
| 51 | + |
| 52 | +```bash |
| 53 | +flutter pub get |
| 54 | +flutter run |
| 55 | +``` |
| 56 | + |
| 57 | +### Firebase |
| 58 | + |
| 59 | +- Ensure **Firebase** is initialized (e.g. `DefaultFirebaseOptions` from `firebase_options.dart`). |
| 60 | +- Deploy **Cloud Functions** from the `functions/` directory (e.g. `nearbyPostboxes`, `startScoring`). |
| 61 | +- Deploy **Firestore rules** from `firestore.rules` if present. |
| 62 | + |
| 63 | +### First run |
| 64 | + |
| 65 | +On first launch, the app shows the Postman James intro, then the login/register screen. After that, opening the app goes straight to home or login depending on auth state. |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +## Project structure (high level) |
| 70 | + |
| 71 | +- `lib/` — Flutter app (screens, BLoC, intro, settings, preferences). |
| 72 | +- `functions/` — Firebase Cloud Functions (TypeScript) for nearby postboxes and claiming. |
| 73 | +- `firestore.rules` — Firestore security rules (when used). |
| 74 | +- `assets/` — Images and assets (e.g. compass, james). |
| 75 | + |
| 76 | +For detailed navigation and feature branches, see the codebase and any internal planning docs (e.g. `plan/CLAUDE.md` if present). |
0 commit comments